Skip to content

Commit

Permalink
remove reproduce_siena option from libfrencutils, make_coupler_mosaic…
Browse files Browse the repository at this point in the history
…, and make_quick_mosaic
  • Loading branch information
rem1776 authored and rem1776 committed Nov 7, 2024
1 parent 91428bb commit f79e9ec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 43 deletions.
27 changes: 6 additions & 21 deletions tools/libfrencutils/mosaic_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,9 @@

const double from_pole_threshold_rad = 0.0174533; // 1.0 deg

int reproduce_siena = 0;
int rotate_poly_flag = 0;
double the_rotation_matrix[3][3] = { 0 };

void set_reproduce_siena_true(void){
reproduce_siena = 1;
}

void set_rotate_poly_true(void){
rotate_poly_flag = 1;
set_the_rotation_matrix();
Expand Down Expand Up @@ -303,14 +298,9 @@ double poly_area_dimensionless(const double x[], const double y[], int n)
if ( fabs(lat1-lat2) < SMALL_VALUE) // cheap area calculation along latitude
area -= dx*sin(0.5*(lat1+lat2));
else {
if(reproduce_siena) {
area += dx*(cos(lat1)-cos(lat2))/(lat1-lat2);
}
else {
dy = 0.5*(lat1-lat2);
dat = sin(dy)/dy;
area -= dx*sin(0.5*(lat1+lat2))*dat;
}
dy = 0.5*(lat1-lat2);
dat = sin(dy)/dy;
area -= dx*sin(0.5*(lat1+lat2))*dat;
}
}
if(fabs(area) > HPI) {
Expand Down Expand Up @@ -453,14 +443,9 @@ double poly_area_main(const double x[], const double y[], int n) {
if (fabs(lat1 - lat2) < SMALL_VALUE) /* cheap area calculation along latitude */
area -= dx * sin(0.5 * (lat1 + lat2));
else {
if (reproduce_siena) {
area += dx * (cos(lat1) - cos(lat2)) / (lat1 - lat2);
} else {
// This expression is a trig identity with the above reproduce_siena case
dy = 0.5 * (lat1 - lat2);
dat = sin(dy) / dy;
area -= dx * sin(0.5 * (lat1 + lat2)) * dat;
}
dy = 0.5 * (lat1 - lat2);
dat = sin(dy) / dy;
area -= dx * sin(0.5 * (lat1 + lat2)) * dat;
}
}

Expand Down
1 change: 0 additions & 1 deletion tools/libfrencutils/mosaic_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ void getCoordinates(struct Node *node, double *p);
void setCoordinate(struct Node *node, double x, double y, double z);
void setInbound(struct Node *interList, struct Node *list);
int isInside(struct Node *node);
void set_reproduce_siena_true(void);

void set_rotate_poly_true(void);
int is_near_pole(const double y[], int n);
Expand Down
10 changes: 0 additions & 10 deletions tools/make_coupler_mosaic/make_coupler_mosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ char *usage[] = {
" --ocean_topog ocean_topog.nc [--land_mosaic land_mosaic.nc] [--wave_mosaic]",
" [--sea_level #] [--interp_order #] [--mosaic_name mosaic_name] ",
" [--area_ratio_thresh #] [--check ] [--verbose] [--print_memory] ",
" [--reproduce_siena] ",
" ",
"make_coupler_mosaic generates three exchange grids for the FMS coupler. The output ",
"file includes exchange grid files for fluxes between atmosphere and surface (sea ice ",
Expand Down Expand Up @@ -128,8 +127,6 @@ char *usage[] = {
" ",
"--print_memory debug memory usage when it is set ",
" ",
"--reproduce_siena Set to reproduce siena shared codes results ",
" ",
"--rotate_poly Set to calculate polar polygon areas by caculating the area of a copy ",
" of the polygon, with the copy being rotated far away from the pole. ",
" ",
Expand Down Expand Up @@ -407,7 +404,6 @@ int main (int argc, char *argv[])
int tile_nest, is_nest, ie_nest, js_nest, je_nest;
int tile_parent, is_parent, ie_parent, js_parent, je_parent;
int print_memory=0;
int reproduce_siena=0;
int rotate_poly=0;

static struct option long_options[] = {
Expand All @@ -423,7 +419,6 @@ int main (int argc, char *argv[])
{"check", no_argument, NULL, 'n'},
{"verbose", no_argument, NULL, 'v'},
{"print_memory", no_argument, NULL, 'p'},
{"reproduce_siena", no_argument, NULL, 'q'},
{"rotate_poly", no_argument, NULL, 'u'},
{NULL, 0, NULL, 0}
};
Expand Down Expand Up @@ -472,9 +467,6 @@ int main (int argc, char *argv[])
case 'p':
print_memory = 1;
break;
case 'q':
reproduce_siena = 1;
break;
case 'u':
rotate_poly = 1;
break;
Expand All @@ -500,8 +492,6 @@ int main (int argc, char *argv[])
/*if lmosaic is not specifiied, assign amosaic value to it */
if(!lmosaic) lmosaic = amosaic;

if(reproduce_siena) set_reproduce_siena_true();

if(rotate_poly) set_rotate_poly_true();

/*mosaic_file can not have the same name as amosaic, lmosaic or omosaic, also the file name of
Expand Down
12 changes: 1 addition & 11 deletions tools/make_quick_mosaic/make_quick_mosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ char *usage[] = {
"",
" make_quick_mosaic --input_mosaic input_mosaic.nc [--mosaic_name mosaic_name]",
" [--ocean_topog ocean_topog.nc] [--sea_level #] ",
" [--reproduce_siena] [--land_frac_file frac_file] ",
" [--land_frac_field frac_field] ",
" [--land_frac_file frac_file] [--land_frac_field frac_field]",
" ",
"make_quick_mosaic generate a complete grid a FMS coupler. When --ocean_topog ",
"is not specified, it takes a coupled mosaic as input_mosaic. Otherwise it ",
Expand Down Expand Up @@ -68,8 +67,6 @@ char *usage[] = {
"--land_frac_file frac_file : land fraction file. ",
"--land_frac_field frac_field: land fraction field. ",
" ",
"--reproduce_siena Set to reproduce siena shared codes results ",
" ",
"",
NULL };

Expand Down Expand Up @@ -112,7 +109,6 @@ int main (int argc, char *argv[])
char *land_frac_file=NULL;
char *land_frac_field=NULL;
double sea_level = 0.;
int reproduce_siena=0;
char mosaic_name[STRING] = "mosaic", mosaic_file[STRING];
char griddir[STRING], solo_mosaic[STRING], filepath[STRING];
char solo_mosaic_full_path[STRING] = "./";
Expand All @@ -133,7 +129,6 @@ int main (int argc, char *argv[])
{"ocean_topog", required_argument, NULL, 'o'},
{"land_frac_file", required_argument, NULL, 'l'},
{"land_frac_field", required_argument, NULL, 'f'},
{"reproduce_siena", no_argument, NULL, 'q'},
{NULL, 0, NULL, 0}
};

Expand Down Expand Up @@ -162,9 +157,6 @@ int main (int argc, char *argv[])
case 'f':
land_frac_field = optarg;
break;
case 'q':
reproduce_siena = 1;
break;
case '?':
errflg++;
}
Expand Down Expand Up @@ -206,8 +198,6 @@ int main (int argc, char *argv[])
}
}

if(reproduce_siena) set_reproduce_siena_true();

/* First get land grid information */

mpp_init(&argc, &argv);
Expand Down

0 comments on commit f79e9ec

Please sign in to comment.