Commit 01db526e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remap cleanup for gridsize=1

parent d6b9827b
2006-11-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2006-11-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using CDI library version 1.0.3 * using CDI library version 1.0.3
* remaplib.sort_add: don't sort if num_links <= 1
* remaplib.remap_bi?: check that src_add is valid
* Remap: use REMAP_NON_GLOBAL only for gridsize > 1
* Version 1.0.3 released * Version 1.0.3 released
2006-09-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2006-09-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
...@@ -237,7 +237,7 @@ void *Remap(void *argument) ...@@ -237,7 +237,7 @@ void *Remap(void *argument)
remaps[0].gridsize = gridInqSize(gridID1); remaps[0].gridsize = gridInqSize(gridID1);
remaps[0].nmiss = 0; remaps[0].nmiss = 0;
if ( map_type != MAP_TYPE_CONSERV && if ( map_type != MAP_TYPE_CONSERV && remaps[0].gridsize > 1 &&
((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) || ((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) ||
(gridInqType(gridID1) == GRID_LONLAT && remap_non_global) || (gridInqType(gridID1) == GRID_LONLAT && remap_non_global) ||
(gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) ) (gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) )
...@@ -367,7 +367,7 @@ void *Remap(void *argument) ...@@ -367,7 +367,7 @@ void *Remap(void *argument)
missval = vlistInqVarMissval(vlistID1, varID); missval = vlistInqVarMissval(vlistID1, varID);
gridsize = gridInqSize(gridID1); gridsize = gridInqSize(gridID1);
if ( map_type != MAP_TYPE_CONSERV && if ( map_type != MAP_TYPE_CONSERV && gridsize > 1 &&
((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) || ((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) ||
(gridInqType(gridID1) == GRID_LONLAT && remap_non_global) || (gridInqType(gridID1) == GRID_LONLAT && remap_non_global) ||
(gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) ) (gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) )
...@@ -451,7 +451,7 @@ void *Remap(void *argument) ...@@ -451,7 +451,7 @@ void *Remap(void *argument)
if ( remaps[r].gridID != gridID1 ) if ( remaps[r].gridID != gridID1 )
{ {
remaps[r].grid.non_global = FALSE; remaps[r].grid.non_global = FALSE;
if ( map_type != MAP_TYPE_CONSERV && if ( map_type != MAP_TYPE_CONSERV && remaps[r].gridsize > 1 &&
((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) || ((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) ||
(gridInqType(gridID1) == GRID_LONLAT && remap_non_global) || (gridInqType(gridID1) == GRID_LONLAT && remap_non_global) ||
(gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) ) (gridInqType(gridID1) == GRID_CURVILINEAR && remap_non_global)) )
......
...@@ -74,6 +74,7 @@ int cdoDebug = 0; ...@@ -74,6 +74,7 @@ int cdoDebug = 0;
int cdoExpMode = -1; int cdoExpMode = -1;
char *cdoExpName = NULL; char *cdoExpName = NULL;
const char *cdojobfiles = "ftp_files";
int timer_total, timer_read, timer_write; int timer_total, timer_read, timer_write;
...@@ -786,6 +787,8 @@ int main(int argc, char *argv[]) ...@@ -786,6 +787,8 @@ int main(int argc, char *argv[])
fprintf(jobfilep, "uname -s\n"); fprintf(jobfilep, "uname -s\n");
fprintf(jobfilep, "pwd\n"); fprintf(jobfilep, "pwd\n");
fprintf(jobfilep, "cd tmp\n"); fprintf(jobfilep, "cd tmp\n");
fprintf(jobfilep, "rm -f %s\n", cdojobfiles);
fprintf(jobfilep, "echo $LD_LIBRARY_PATH\n");
fprintf(jobfilep, "setenv LD_LIBRARY_PATH /opt/gridware/sge/lib/lx24-x86:$LD_LIBRARY_PATH\n"); fprintf(jobfilep, "setenv LD_LIBRARY_PATH /opt/gridware/sge/lib/lx24-x86:$LD_LIBRARY_PATH\n");
fprintf(jobfilep, "%s\n", commandline); fprintf(jobfilep, "%s\n", commandline);
......
...@@ -383,7 +383,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg) ...@@ -383,7 +383,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg)
rg->gridID1 = gridID1; rg->gridID1 = gridID1;
rg->gridID2 = gridID2; rg->gridID2 = gridID2;
if ( map_type != MAP_TYPE_CONSERV && if ( map_type != MAP_TYPE_CONSERV && gridInqSize(rg->gridID1) > 1 &&
((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) || ((gridInqType(gridID1) == GRID_LONLAT && gridIsRotated(gridID1)) ||
(gridInqType(gridID1) == GRID_LONLAT && rg->non_global)) ) (gridInqType(gridID1) == GRID_LONLAT && rg->non_global)) )
{ {
...@@ -433,7 +433,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg) ...@@ -433,7 +433,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg)
rg->no_fall_back = TRUE; rg->no_fall_back = TRUE;
} }
if ( map_type != MAP_TYPE_CONSERV && if ( map_type != MAP_TYPE_CONSERV && gridInqSize(rg->gridID1) > 1 &&
(gridInqType(gridID1) == GRID_CURVILINEAR && rg->non_global) ) (gridInqType(gridID1) == GRID_CURVILINEAR && rg->non_global) )
{ {
int gridIDnew; int gridIDnew;
...@@ -1742,7 +1742,7 @@ void remap_bilin(REMAPGRID *rg, REMAPVARS *rv) ...@@ -1742,7 +1742,7 @@ void remap_bilin(REMAPGRID *rg, REMAPVARS *rv)
if ( src_add[0] > 0 ) if ( src_add[0] > 0 )
for ( n = 0; n < 4; n++ ) for ( n = 0; n < 4; n++ )
if ( src_add[n] > 0 ) /* Uwe Schulzweida: check if src_add is valid first */ if ( src_add[n] > 0 ) /* Uwe Schulzweida: check that src_add is valid first */
if ( ! rg->grid1_mask[src_add[n]-1] ) src_add[0] = 0; if ( ! rg->grid1_mask[src_add[n]-1] ) src_add[0] = 0;
/* if point found, find local i,j coordinates for weights */ /* if point found, find local i,j coordinates for weights */
...@@ -1830,17 +1830,26 @@ void remap_bilin(REMAPGRID *rg, REMAPVARS *rv) ...@@ -1830,17 +1830,26 @@ void remap_bilin(REMAPGRID *rg, REMAPVARS *rv)
} }
else if ( src_add[0] < 0 ) else if ( src_add[0] < 0 )
{ {
int lstore = TRUE;
for ( n = 0; n < 4; n++ ) src_add[n] = src_add[n] < 0 ? -1*src_add[n] : src_add[n]; for ( n = 0; n < 4; n++ ) src_add[n] = src_add[n] < 0 ? -1*src_add[n] : src_add[n];
icount = 0; icount = 0;
for ( n = 0; n < 4; n++ ) for ( n = 0; n < 4; n++ )
{ {
if ( rg->grid1_mask[src_add[n]-1] ) if ( src_add[n] > 0 ) /* Uwe Schulzweida: check that src_add is valid first */
icount++; {
if ( rg->grid1_mask[src_add[n]-1] )
icount++;
else
src_lats[n] = ZERO;
}
else else
src_lats[n] = ZERO; {
lstore = FALSE;
}
} }
if ( icount > 0 ) if ( lstore && icount > 0 )
{ {
/* renormalize weights */ /* renormalize weights */
sum_wgts = 0.0; sum_wgts = 0.0;
...@@ -1959,7 +1968,7 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv) ...@@ -1959,7 +1968,7 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv)
if ( src_add[0] > 0 ) if ( src_add[0] > 0 )
for ( n = 0; n < 4; n++ ) for ( n = 0; n < 4; n++ )
if ( src_add[n] > 0 ) /* Uwe Schulzweida: check if src_add is valid first */ if ( src_add[n] > 0 ) /* Uwe Schulzweida: check that src_add is valid first */
if ( ! rg->grid1_mask[src_add[n]-1] ) src_add[0] = 0; if ( ! rg->grid1_mask[src_add[n]-1] ) src_add[0] = 0;
/* if point found, find local i,j coordinates for weights */ /* if point found, find local i,j coordinates for weights */
...@@ -2067,17 +2076,26 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv) ...@@ -2067,17 +2076,26 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv)
} }
else if ( src_add[0] < 0 ) else if ( src_add[0] < 0 )
{ {
int lstore = TRUE;
for ( n = 0; n < 4; n++ ) src_add[n] = src_add[n] < 0 ? -1*src_add[n] : src_add[n]; for ( n = 0; n < 4; n++ ) src_add[n] = src_add[n] < 0 ? -1*src_add[n] : src_add[n];
icount = 0; icount = 0;
for ( n = 0; n < 4; n++ ) for ( n = 0; n < 4; n++ )
{ {
if ( rg->grid1_mask[src_add[n]-1] ) if ( src_add[n] > 0 ) /* Uwe Schulzweida: check that src_add is valid first */
icount++; {
if ( rg->grid1_mask[src_add[n]-1] )
icount++;
else
src_lats[n] = ZERO;
}
else else
src_lats[n] = ZERO; {
lstore = FALSE;
}
} }
if ( icount > 0 ) if ( lstore && icount > 0 )
{ {
/* renormalize weights */ /* renormalize weights */
sum_wgts = 0.0; sum_wgts = 0.0;
...@@ -2088,6 +2106,7 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv) ...@@ -2088,6 +2106,7 @@ void remap_bicub(REMAPGRID *rg, REMAPVARS *rv)
for ( n = 0; n < 4; n++ ) wgts[3][n] = ZERO; for ( n = 0; n < 4; n++ ) wgts[3][n] = ZERO;
rg->grid2_frac[dst_add] = ONE; rg->grid2_frac[dst_add] = ONE;
store_link_bicub(rv, dst_add, src_add, wgts); store_link_bicub(rv, dst_add, src_add, wgts);
} }
} }
...@@ -4889,7 +4908,7 @@ void sort_add(int num_links, int num_wts, int *add1, int *add2, double **weights ...@@ -4889,7 +4908,7 @@ void sort_add(int num_links, int num_wts, int *add1, int *add2, double **weights
int i, n; int i, n;
double wgttmp[4]; /* temp for holding wts during swap */ double wgttmp[4]; /* temp for holding wts during swap */
if ( num_links == 0 ) return; if ( num_links <= 1 ) return;
/* /*
for ( n = 0; n < num_links; n++ ) for ( n = 0; n < num_links; n++ )
......
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