Commit 94f1dd9d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridCompare: change limit of difference from 0.001 to 0.0015

parent 6fb10c4e
2014-10-24 Uwe Schulzweida
* gridCompare: change limit of difference from 0.001 to 0.0015
2014-10-23 Nathanael Huebbe 2014-10-23 Nathanael Huebbe
* resource_handle: optimize error messages * resource_handle: optimize error messages
......
...@@ -2262,8 +2262,8 @@ int gridCompare(int gridID, grid_t grid) ...@@ -2262,8 +2262,8 @@ int gridCompare(int gridID, grid_t grid)
{ {
if ( ! (IS_EQUAL(grid.xfirst, 0) && IS_EQUAL(grid.xlast, 0) && IS_EQUAL(grid.xinc, 0)) && if ( ! (IS_EQUAL(grid.xfirst, 0) && IS_EQUAL(grid.xlast, 0) && IS_EQUAL(grid.xinc, 0)) &&
! (IS_EQUAL(grid.yfirst, 0) && IS_EQUAL(grid.ylast, 0)) ) ! (IS_EQUAL(grid.yfirst, 0) && IS_EQUAL(grid.ylast, 0)) )
if ( fabs(grid.xfirst - gridInqXval(gridID, 0)) > 0.001 || if ( fabs(grid.xfirst - gridInqXval(gridID, 0)) > 0.0015 ||
fabs(grid.yfirst - gridInqYval(gridID, 0)) > 0.001 || fabs(grid.yfirst - gridInqYval(gridID, 0)) > 0.0015 ||
(fabs(grid.xinc)>0 && fabs(fabs(grid.xinc) - fabs(gridInqXinc(gridID))) > fabs(grid.xinc/1000)) ) (fabs(grid.xinc)>0 && fabs(fabs(grid.xinc) - fabs(gridInqXinc(gridID))) > fabs(grid.xinc/1000)) )
{ {
differ = 1; differ = 1;
......
...@@ -62,7 +62,7 @@ int cgribexGetIsRotated(int *isec2) ...@@ -62,7 +62,7 @@ int cgribexGetIsRotated(int *isec2)
{ {
isRotated = 1; isRotated = 1;
} }
return (isRotated); return (isRotated);
} }
...@@ -154,9 +154,8 @@ int cgribexGetTsteptype(int timerange) ...@@ -154,9 +154,8 @@ int cgribexGetTsteptype(int timerange)
static static
void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, int iret) void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, int iret)
{ {
int gridtype; int compyinc = TRUE;
int gridtype = cgribexGetGridType(isec2);
gridtype = cgribexGetGridType(isec2);
if ( streamptr->unreduced && gridtype == GRID_GAUSSIAN_REDUCED && iret != -801 ) if ( streamptr->unreduced && gridtype == GRID_GAUSSIAN_REDUCED && iret != -801 )
{ {
...@@ -166,6 +165,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i ...@@ -166,6 +165,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
gridtype = GRID_GAUSSIAN; gridtype = GRID_GAUSSIAN;
ISEC2_NumLon = nlon; ISEC2_NumLon = nlon;
ISEC4_NumValues = nlon*ISEC2_NumLat; ISEC4_NumValues = nlon*ISEC2_NumLat;
compyinc = FALSE;
} }
memset(grid, 0, sizeof(grid_t)); memset(grid, 0, sizeof(grid_t));
...@@ -222,10 +222,9 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i ...@@ -222,10 +222,9 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
grid->ydef = 0; grid->ydef = 0;
/* if ( ISEC2_FirstLat != 0 || ISEC2_LastLat != 0 ) */ /* if ( ISEC2_FirstLat != 0 || ISEC2_LastLat != 0 ) */
{ {
if ( grid->ysize > 1 ) if ( grid->ysize > 1 && compyinc )
{ {
int recompinc = TRUE; int recompinc = TRUE;
if ( ISEC2_ResFlag && ISEC2_LatIncr > 0 ) if ( ISEC2_ResFlag && ISEC2_LatIncr > 0 )
{ {
if ( abs(ISEC2_LastLat - (ISEC2_FirstLat+ISEC2_LatIncr*(grid->ysize-1))) <= 2 ) if ( abs(ISEC2_LastLat - (ISEC2_FirstLat+ISEC2_LatIncr*(grid->ysize-1))) <= 2 )
...@@ -361,44 +360,36 @@ static ...@@ -361,44 +360,36 @@ static
void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, double *fsec2, double *fsec3, void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, double *fsec2, double *fsec3,
int *isec4, long recsize, off_t position, int datatype, int comptype, int lmv, int iret) int *isec4, long recsize, off_t position, int datatype, int comptype, int lmv, int iret)
{ {
int zaxistype; int varID;
int gridID = CDI_UNDEFID, varID;
int levelID = 0; int levelID = 0;
int tsID, recID;
int level1, level2;
int numavg;
int tsteptype;
int lbounds = 0;
record_t *record;
grid_t grid; grid_t grid;
int vlistID;
vlistID = streamptr->vlistID; int vlistID = streamptr->vlistID;
tsID = streamptr->curTsID; int tsID = streamptr->curTsID;
recID = recordNewEntry(streamptr, tsID); int recID = recordNewEntry(streamptr, tsID);
record = &streamptr->tsteps[tsID].records[recID]; record_t *record = &streamptr->tsteps[tsID].records[recID];
tsteptype = cgribexGetTsteptype(ISEC1_TimeRange); int tsteptype = cgribexGetTsteptype(ISEC1_TimeRange);
numavg = ISEC1_AvgNum; int numavg = ISEC1_AvgNum;
level1 = ISEC1_Level1; int level1 = ISEC1_Level1;
level2 = ISEC1_Level2; int level2 = ISEC1_Level2;
/* fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, ISEC1_LevelType); */ /* fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, ISEC1_LevelType); */
(*record).size = (size_t)recsize; record->size = (size_t)recsize;
(*record).position = position; record->position = position;
(*record).param = param; record->param = param;
(*record).ilevel = level1; record->ilevel = level1;
(*record).ilevel2 = level2; record->ilevel2 = level2;
(*record).ltype = ISEC1_LevelType; record->ltype = ISEC1_LevelType;
(*record).tsteptype = tsteptype; record->tsteptype = tsteptype;
cgribexGetGrid(streamptr, isec2, isec4, &grid, iret); cgribexGetGrid(streamptr, isec2, isec4, &grid, iret);
gridID = varDefGrid(vlistID, grid, 0); int gridID = varDefGrid(vlistID, grid, 0);
zaxistype = grib1ltypeToZaxisType(ISEC1_LevelType); int zaxistype = grib1ltypeToZaxisType(ISEC1_LevelType);
if ( zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_HYBRID_HALF ) if ( zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_HYBRID_HALF )
{ {
...@@ -408,7 +399,7 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d ...@@ -408,7 +399,7 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d
varDefVCT(vctsize, vctptr); varDefVCT(vctsize, vctptr);
} }
lbounds = cgribexGetZaxisHasBounds(ISEC1_LevelType); int lbounds = cgribexGetZaxisHasBounds(ISEC1_LevelType);
if ( datatype > 32 ) datatype = DATATYPE_PACK32; if ( datatype > 32 ) datatype = DATATYPE_PACK32;
if ( datatype < 0 ) datatype = DATATYPE_PACK; if ( datatype < 0 ) datatype = DATATYPE_PACK;
......
Markdown is supported
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