Commit a7377c53 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remapcons: renamed to remapycon

parent 5d814be4
......@@ -44,7 +44,7 @@
enum {REMAPCON, REMAPCON2, REMAPBIL, REMAPBIC, REMAPDIS, REMAPNN, REMAPLAF, REMAPSUM,
GENCON, GENCON2, GENBIL, GENBIC, GENDIS, GENNN, GENLAF, REMAPXXX, REMAPCONS, GENCONS};
GENCON, GENCON2, GENBIL, GENBIC, GENDIS, GENNN, GENLAF, REMAPXXX, REMAPYCON, GENYCON};
enum {HEAP_SORT, MERGE_SORT};
......@@ -53,9 +53,9 @@ void get_map_type(int operfunc, int *map_type, int *submap_type, int *num_neighb
{
switch ( operfunc )
{
case REMAPCONS:
case GENCONS:
*map_type = MAP_TYPE_CONSPHERE;
case REMAPYCON:
case GENYCON:
*map_type = MAP_TYPE_CONSERV_YAC;
*remap_order = 1;
break;
case REMAPCON:
......@@ -127,10 +127,10 @@ int maptype2operfunc(int map_type, int submap_type, int num_neighbors, int remap
}
}
}
else if ( map_type == MAP_TYPE_CONSPHERE )
else if ( map_type == MAP_TYPE_CONSERV_YAC )
{
operfunc = REMAPCONS;
// cdoPrint("Using remapcons");
operfunc = REMAPYCON;
// cdoPrint("Using remapycon");
}
else if ( map_type == MAP_TYPE_BILINEAR )
{
......@@ -176,7 +176,7 @@ void print_remap_info(int operfunc, remapgrid_t *src_grid, remapgrid_t *tgt_grid
else if ( operfunc == REMAPCON || operfunc == GENCON ) strcpy(line, "SCRIP first order conservative");
else if ( operfunc == REMAPCON2 || operfunc == GENCON2 ) strcpy(line, "SCRIP second order conservative");
else if ( operfunc == REMAPLAF || operfunc == GENLAF ) strcpy(line, "SCRIP largest area fraction");
else if ( operfunc == REMAPCONS || operfunc == GENCONS ) strcpy(line, "First order conservative");
else if ( operfunc == REMAPYCON || operfunc == GENYCON ) strcpy(line, "YAC first order conservative");
else strcpy(line, "Unknown");
strcat(line, " remapping from ");
......@@ -516,8 +516,8 @@ void *Remap(void *argument)
cdoOperatorAdd("gennn", GENNN, 1, NULL);
cdoOperatorAdd("genlaf", GENLAF, 1, NULL);
cdoOperatorAdd("remap", REMAPXXX, 0, NULL);
cdoOperatorAdd("remapcons", REMAPCONS, 0, NULL);
cdoOperatorAdd("gencons", GENCONS, 1, NULL);
cdoOperatorAdd("remapycon", REMAPYCON, 0, NULL);
cdoOperatorAdd("genycon", GENYCON, 1, NULL);
operatorID = cdoOperatorID();
operfunc = cdoOperatorF1(operatorID);
......@@ -699,7 +699,7 @@ void *Remap(void *argument)
get_map_type(operfunc, &map_type, &submap_type, &num_neighbors, &remap_order);
}
if ( map_type == MAP_TYPE_CONSERV ||map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV ||map_type == MAP_TYPE_CONSERV_YAC )
{
norm_opt = NORM_OPT_FRACAREA;
......@@ -785,7 +785,7 @@ void *Remap(void *argument)
}
}
if ( map_type != MAP_TYPE_CONSERV && map_type != MAP_TYPE_CONSPHERE &&
if ( map_type != MAP_TYPE_CONSERV && map_type != MAP_TYPE_CONSERV_YAC &&
gridInqType(gridID1) == GRID_GME && gridInqType(gridID2) == GRID_GME )
cdoAbort("Only conservative remapping is available to remap between GME grids!");
/*
......@@ -934,7 +934,7 @@ void *Remap(void *argument)
memcpy(remaps[r].src_grid.mask, imask, remaps[r].src_grid.size*sizeof(int));
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSERV_YAC )
{
memset(remaps[r].src_grid.cell_area, 0, remaps[r].src_grid.size*sizeof(double));
memset(remaps[r].src_grid.cell_frac, 0, remaps[r].src_grid.size*sizeof(double));
......@@ -955,7 +955,7 @@ void *Remap(void *argument)
else if ( map_type == MAP_TYPE_BILINEAR ) scrip_remap_weights_bilinear(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( map_type == MAP_TYPE_BICUBIC ) scrip_remap_weights_bicubic(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( map_type == MAP_TYPE_DISTWGT ) scrip_remap_weights_distwgt(num_neighbors, &remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( map_type == MAP_TYPE_CONSPHERE ) remap_weights_conserv(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( map_type == MAP_TYPE_CONSERV_YAC ) remap_weights_conserv(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
if ( remaps[r].vars.num_links != remaps[r].vars.max_links )
resize_remap_vars(&remaps[r].vars, remaps[r].vars.num_links-remaps[r].vars.max_links);
......@@ -1025,7 +1025,7 @@ void *Remap(void *argument)
gridsize2 = gridInqSize(gridID2);
/* used only to check the result of remapcon */
if ( operfunc == REMAPCON || operfunc == REMAPCON2 || operfunc == REMAPCONS )
if ( operfunc == REMAPCON || operfunc == REMAPCON2 || operfunc == REMAPYCON )
{
double grid2_err;
......@@ -1086,7 +1086,7 @@ void *Remap(void *argument)
}
vlistInqVarName(vlistID1, varID, varname);
if ( operfunc == REMAPCON || operfunc == REMAPCON2 || operfunc == REMAPCONS )
if ( operfunc == REMAPCON || operfunc == REMAPCON2 || operfunc == REMAPYCON )
if ( strcmp(varname, "gridbox_area") == 0 )
{
scale_gridbox_area(gridsize, array1, gridsize2, array2, remaps[r].tgt_grid.cell_area);
......
......@@ -369,8 +369,8 @@ void *Maggraph(void *argument);
#define PressureOperators {"pressure_fl", "pressure_hl", "deltap"}
#define RegresOperators {"regres"}
#define RemapOperators {"remap"}
#define RemapgridOperators {"remapcons", "remapcon", "remapbil", "remapbic", "remapdis", "remapnn", "remaplaf", "remapcon2", "remapsum"}
#define GenweightsOperators {"gencons", "gencon", "genbil", "genbic", "gendis", "gennn", "genlaf", "gencon2"}
#define RemapgridOperators {"remapycon", "remapcon", "remapbil", "remapbic", "remapdis", "remapnn", "remaplaf", "remapcon2", "remapsum"}
#define GenweightsOperators {"genycon", "gencon", "genbil", "genbic", "gendis", "gennn", "genlaf", "gencon2"}
#define RemapetaOperators {"remapeta", "remapeta_s", "remapeta_z"}
#define ReplaceOperators {"replace"}
#define ReplacevaluesOperators {"setvals", "setrtoc", "setrtoc2"}
......
......@@ -57,19 +57,19 @@ typedef RESTR_TYPE restr_t;
#define TINY_FRAC 1.e-10
#define NORM_OPT_NONE 1
#define NORM_OPT_DESTAREA 2
#define NORM_OPT_FRACAREA 3
#define MAP_TYPE_CONSERV 1
#define MAP_TYPE_BILINEAR 2
#define MAP_TYPE_BICUBIC 3
#define MAP_TYPE_DISTWGT 4
#define MAP_TYPE_CONSPHERE 5
#define SUBMAP_TYPE_NONE 0
#define SUBMAP_TYPE_LAF 1
#define SUBMAP_TYPE_SUM 2
#define NORM_OPT_NONE 1
#define NORM_OPT_DESTAREA 2
#define NORM_OPT_FRACAREA 3
#define MAP_TYPE_CONSERV 1
#define MAP_TYPE_BILINEAR 2
#define MAP_TYPE_BICUBIC 3
#define MAP_TYPE_DISTWGT 4
#define MAP_TYPE_CONSERV_YAC 5
#define SUBMAP_TYPE_NONE 0
#define SUBMAP_TYPE_LAF 1
#define SUBMAP_TYPE_SUM 2
typedef struct {
......
......@@ -909,4 +909,4 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
if ( cdoTimer ) timer_stop(timer_remap_con);
} /* remap_consphere */
} /* remap_weights_conserv */
......@@ -121,7 +121,7 @@ void write_remap_scrip(const char *interp_file, int map_type, int submap_type, i
strcpy(map_method, "Conservative remapping");
break;
}
case MAP_TYPE_CONSPHERE:
case MAP_TYPE_CONSERV_YAC:
lgridarea = TRUE;
/*
if ( submap_type == SUBMAP_TYPE_LAF )
......@@ -504,7 +504,7 @@ void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *ma
{
int iatt;
if ( strcompare(map_method, "Conservative remapping using clipping on sphere") == 0 )
rv->map_type = MAP_TYPE_CONSPHERE;
rv->map_type = MAP_TYPE_CONSERV_YAC;
else
rv->map_type = MAP_TYPE_CONSERV;
......
......@@ -104,7 +104,7 @@ void calc_lat_bins(remapgrid_t* src_grid, remapgrid_t* tgt_grid, int map_type)
calc_bin_addr(src_grid->size, nbins, bin_lats, src_grid->cell_bound_box, src_grid->bin_addr);
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSERV_YAC )
{
tgt_grid->bin_addr = realloc(tgt_grid->bin_addr, 2*nbins*sizeof(int));
......@@ -114,7 +114,7 @@ void calc_lat_bins(remapgrid_t* src_grid, remapgrid_t* tgt_grid, int map_type)
}
}
if ( map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV_YAC )
{
free(tgt_grid->cell_bound_box); tgt_grid->cell_bound_box = NULL;
}
......
......@@ -199,7 +199,7 @@ void remapGridRealloc(int map_type, remapgrid_t *grid)
grid->cell_center_lat = realloc(grid->cell_center_lat, grid->size*sizeof(double));
}
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSERV_YAC )
{
grid->cell_area = realloc(grid->cell_area, grid->size*sizeof(double));
memset(grid->cell_area, 0, grid->size*sizeof(double));
......@@ -833,13 +833,13 @@ void remap_grids_init(int map_type, int lextrapolate, int gridID1, remapgrid_t *
remapgrid_init(tgt_grid);
if ( map_type == MAP_TYPE_BILINEAR || map_type == MAP_TYPE_BICUBIC ||
map_type == MAP_TYPE_DISTWGT || map_type == MAP_TYPE_CONSPHERE )
map_type == MAP_TYPE_DISTWGT || map_type == MAP_TYPE_CONSERV_YAC )
{
if ( IS_REG2D_GRID(gridID1) ) src_grid->remap_grid_type = REMAP_GRID_TYPE_REG2D;
// src_grid->remap_grid_type = 0;
}
if ( map_type == MAP_TYPE_CONSPHERE && src_grid->remap_grid_type == REMAP_GRID_TYPE_REG2D )
if ( map_type == MAP_TYPE_CONSERV_YAC && src_grid->remap_grid_type == REMAP_GRID_TYPE_REG2D )
{
if ( IS_REG2D_GRID(gridID2) ) tgt_grid->remap_grid_type = REMAP_GRID_TYPE_REG2D;
// else src_grid->remap_grid_type = -1;
......@@ -850,7 +850,7 @@ void remap_grids_init(int map_type, int lextrapolate, int gridID1, remapgrid_t *
else
src_grid->lextrapolate = FALSE;
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSPHERE )
if ( map_type == MAP_TYPE_CONSERV || map_type == MAP_TYPE_CONSERV_YAC )
{
if ( src_grid->remap_grid_type != REMAP_GRID_TYPE_REG2D )
{
......@@ -981,7 +981,7 @@ void remap_vars_init(int map_type, long src_grid_size, long tgt_grid_size, remap
if ( ompNumThreads > 1 )
{
if ( map_type == MAP_TYPE_CONSERV ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_CONSPHERE ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_CONSERV_YAC ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_BILINEAR ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_BICUBIC ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_DISTWGT ) rv->sort_add = TRUE;
......@@ -991,7 +991,7 @@ void remap_vars_init(int map_type, long src_grid_size, long tgt_grid_size, remap
#endif
{
if ( map_type == MAP_TYPE_CONSERV ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_CONSPHERE ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_CONSERV_YAC ) rv->sort_add = TRUE;
else if ( map_type == MAP_TYPE_BILINEAR ) rv->sort_add = FALSE;
else if ( map_type == MAP_TYPE_BICUBIC ) rv->sort_add = FALSE;
else if ( map_type == MAP_TYPE_DISTWGT ) rv->sort_add = FALSE;
......@@ -999,7 +999,7 @@ void remap_vars_init(int map_type, long src_grid_size, long tgt_grid_size, remap
}
if ( map_type == MAP_TYPE_CONSERV ) rv->num_wts = 3;
else if ( map_type == MAP_TYPE_CONSPHERE ) rv->num_wts = 1;
else if ( map_type == MAP_TYPE_CONSERV_YAC ) rv->num_wts = 1;
else if ( map_type == MAP_TYPE_BILINEAR ) rv->num_wts = 1;
else if ( map_type == MAP_TYPE_BICUBIC ) rv->num_wts = 4;
else if ( map_type == MAP_TYPE_DISTWGT ) rv->num_wts = 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment