Commit 2160282b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribex: use timerange indication to identify different variables

parent d8d7a3d4
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* Version 1.7.0 released * Version 1.7.0 released
* using CGRIBEX library version 1.7.0 * using CGRIBEX library version 1.7.0
2014-08-13 Uwe Schulzweida
* cgribex: use timerange indication to identify different variables
2014-08-12 Daniel Reinert 2014-08-12 Daniel Reinert
* listDestroy(): set resHListSize=0 [Bug #5058] * listDestroy(): set resHListSize=0 [Bug #5058]
......
...@@ -375,6 +375,8 @@ void printShortinfo(int streamID, int vlistID, int vardis) ...@@ -375,6 +375,8 @@ void printShortinfo(int streamID, int vlistID, int vardis)
else if ( tsteptype == TSTEP_MIN ) fprintf(stdout, "%-8s ", "min"); else if ( tsteptype == TSTEP_MIN ) fprintf(stdout, "%-8s ", "min");
else if ( tsteptype == TSTEP_MAX ) fprintf(stdout, "%-8s ", "max"); else if ( tsteptype == TSTEP_MAX ) fprintf(stdout, "%-8s ", "max");
else if ( tsteptype == TSTEP_ACCUM ) fprintf(stdout, "%-8s ", "accum"); else if ( tsteptype == TSTEP_ACCUM ) fprintf(stdout, "%-8s ", "accum");
else if ( tsteptype == TSTEP_RANGE ) fprintf(stdout, "%-8s ", "range");
else if ( tsteptype == TSTEP_DIFF ) fprintf(stdout, "%-8s ", "diff");
else fprintf(stdout, "%-8s ", "unknown"); else fprintf(stdout, "%-8s ", "unknown");
/* layer info */ /* layer info */
......
...@@ -533,16 +533,15 @@ compvar_t cgribexVarSet(int param, int level1, int level2, int leveltype, int tr ...@@ -533,16 +533,15 @@ compvar_t cgribexVarSet(int param, int level1, int level2, int leveltype, int tr
static static
int cgribexVarCompare(compvar_t compVar, record_t record) int cgribexVarCompare(compvar_t compVar, record_t record)
{ {
int rstatus;
compvar_t compVar0; compvar_t compVar0;
compVar0.param = record.param; compVar0.param = record.param;
compVar0.level1 = record.ilevel; compVar0.level1 = record.ilevel;
compVar0.level2 = record.ilevel2; compVar0.level2 = record.ilevel2;
compVar0.ltype = record.ltype; compVar0.ltype = record.ltype;
compVar0.tsteptype = record.tsteptype; compVar0.tsteptype = record.tsteptype;
rstatus = memcmp(&compVar0, &compVar, sizeof(compvar_t)); int rstatus = memcmp(&compVar0, &compVar, sizeof(compvar_t));
return (rstatus); return (rstatus);
} }
......
...@@ -121,7 +121,7 @@ void paramInitEntry(int varID, int param) ...@@ -121,7 +121,7 @@ void paramInitEntry(int varID, int param)
} }
static static
int varGetEntry(int param, int zaxistype, int ltype, const char *name) int varGetEntry(int param, int zaxistype, int ltype, int tsteptype, const char *name)
{ {
int varID; int varID;
...@@ -129,7 +129,8 @@ int varGetEntry(int param, int zaxistype, int ltype, const char *name) ...@@ -129,7 +129,8 @@ int varGetEntry(int param, int zaxistype, int ltype, const char *name)
{ {
if ( vartable[varID].param == param && if ( vartable[varID].param == param &&
vartable[varID].zaxistype == zaxistype && vartable[varID].zaxistype == zaxistype &&
vartable[varID].ltype == ltype ) vartable[varID].ltype == ltype &&
vartable[varID].tsteptype == tsteptype )
{ {
if ( name && name[0] && vartable[varID].name && vartable[varID].name[0] ) if ( name && name[0] && vartable[varID].name && vartable[varID].name[0] )
{ {
...@@ -325,17 +326,17 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds, ...@@ -325,17 +326,17 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
int levelID = -1; int levelID = -1;
if ( ! (cdiSplitLtype105 == 1 && zaxistype == ZAXIS_HEIGHT) ) if ( ! (cdiSplitLtype105 == 1 && zaxistype == ZAXIS_HEIGHT) )
varID = varGetEntry(param, zaxistype, ltype, name); varID = varGetEntry(param, zaxistype, ltype, tsteptype, name);
if ( varID == UNDEFID ) if ( varID == UNDEFID )
{ {
nvars++; nvars++;
varID = paramNewEntry(param); varID = paramNewEntry(param);
vartable[varID].gridID = gridID; vartable[varID].gridID = gridID;
vartable[varID].zaxistype = zaxistype; vartable[varID].zaxistype = zaxistype;
vartable[varID].ltype = ltype; vartable[varID].ltype = ltype;
vartable[varID].lbounds = lbounds; vartable[varID].lbounds = lbounds;
vartable[varID].level_sf = level_sf; vartable[varID].level_sf = level_sf;
vartable[varID].level_unit = level_unit; vartable[varID].level_unit = level_unit;
if ( tsteptype != UNDEFID ) vartable[varID].tsteptype = tsteptype; if ( tsteptype != UNDEFID ) vartable[varID].tsteptype = tsteptype;
if ( numavg ) vartable[varID].timave = 1; if ( numavg ) vartable[varID].timave = 1;
...@@ -449,23 +450,20 @@ void cdi_generate_vars(stream_t *streamptr) ...@@ -449,23 +450,20 @@ void cdi_generate_vars(stream_t *streamptr)
double *dlevels = NULL; double *dlevels = NULL;
double *dlevels1 = NULL; double *dlevels1 = NULL;
double *dlevels2 = NULL; double *dlevels2 = NULL;
int vlistID; int index, varid;
int *varids, index, varid;
double level_sf = 1; double level_sf = 1;
int vlistID = streamptr->vlistID;
vlistID = streamptr->vlistID; int *varids = (int *) malloc(nvars*sizeof(int));
varids = (int *) malloc(nvars*sizeof(int));
for ( varID = 0; varID < nvars; varID++ ) varids[varID] = varID; for ( varID = 0; varID < nvars; varID++ ) varids[varID] = varID;
if ( streamptr->sortname ) if ( streamptr->sortname )
{ {
int index;
param_t **varInfo; param_t **varInfo;
varInfo = (param_t **) malloc(nvars*sizeof(param_t *)); varInfo = (param_t **) malloc(nvars*sizeof(param_t *));
varInfo[0] = (param_t *) malloc(nvars*sizeof(param_t)); varInfo[0] = (param_t *) malloc(nvars*sizeof(param_t));
for ( index = 1; index < nvars; index++ ) for ( int index = 1; index < nvars; index++ )
varInfo[index] = varInfo[0] + index; varInfo[index] = varInfo[0] + index;
for ( varid = 0; varid < nvars; varid++ ) for ( varid = 0; varid < nvars; varid++ )
......
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