Commit 7715988f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

setpartab: added support to combine setpartab operators (bug fix)

parent fca4cc41
......@@ -3,9 +3,13 @@
* using CDI library version 1.7.1
* Version 1.7.1 released
2016-01-07 Uwe Schulzweida
* setpartab: added support to combine setpartab operators (bug fix) [report: Karl-Hermann Wieners]
2016-01-06 Uwe Schulzweida
* genbil: generate weight file also for num_links=0
* genbil: generate weight file also for num_links=0
2016-01-05 Uwe Schulzweida
......
......@@ -598,8 +598,7 @@ void check_data(int vlistID2, int varID2, int varID, var_t *vars, long gridsize,
void *Setpartab(void *argument)
{
int nrecs;
int recID, varID, levelID;
int varID2, levelID2;
int varID, levelID;
int nmiss;
int delvars = FALSE;
int tableID = -1;
......@@ -681,31 +680,54 @@ void *Setpartab(void *argument)
if ( tableformat == 0 )
{
for ( varID = 0; varID < nvars; varID++ )
vlistDefVarTable(vlistID2, varID, tableID);
/*
for ( int varID = 0; varID < nvars; varID++ )
vlistDefVarTable(vlistID2, varID, tableID);
*/
char name[CDI_MAX_NAME], longname[CDI_MAX_NAME], units[CDI_MAX_NAME];
for ( int varID = 0; varID < nvars; varID++ )
{
int param = vlistInqVarParam(vlistID2, varID);
int pdis, pcat, pnum;
cdiDecodeParam(param, &pnum, &pcat, &pdis);
if ( pdis == 255 )
{
int code = pnum;
if ( tableInqParName(tableID, code, name) == 0 )
{
vlistDefVarName(vlistID2, varID, name);
longname[0] = 0;
tableInqParLongname(tableID, code, longname);
units[0] = 0;
tableInqParUnits(tableID, code, units);
vlistDefVarLongname(vlistID2, varID, longname);
vlistDefVarUnits(vlistID2, varID, units);
}
}
vlistDefVarTable(vlistID2, varID, tableID);
}
}
else
{
read_partab(ptmode, nvars, vlistID2, vars);
for ( varID = 0; varID < nvars; ++varID )
if ( vars[varID].remove ) break;
if ( varID < nvars ) delvars = TRUE;
for ( int varID = 0; varID < nvars; ++varID )
if ( vars[varID].remove )
{
delvars = TRUE;
break;
}
if ( delvars )
{
int levID, nlevs, zaxisID;
int vlistIDx;
vlistClearFlag(vlistID1);
vlistClearFlag(vlistID2);
for ( varID = 0; varID < nvars; varID++ )
for ( int varID = 0; varID < nvars; varID++ )
{
zaxisID = vlistInqVarZaxis(vlistID2, varID);
nlevs = zaxisInqSize(zaxisID);
for ( levID = 0; levID < nlevs; levID++ )
int zaxisID = vlistInqVarZaxis(vlistID2, varID);
int nlevs = zaxisInqSize(zaxisID);
for ( int levID = 0; levID < nlevs; levID++ )
{
vlistDefFlag(vlistID1, varID, levID, TRUE);
vlistDefFlag(vlistID2, varID, levID, TRUE);
......@@ -717,7 +739,7 @@ void *Setpartab(void *argument)
}
}
vlistIDx = vlistCreate();
int vlistIDx = vlistCreate();
vlistCopyFlag(vlistIDx, vlistID2);
vlistDestroy(vlistID2);
......@@ -725,7 +747,7 @@ void *Setpartab(void *argument)
vlistID2 = vlistIDx;
}
for ( varID = 0; varID < nvars; ++varID )
for ( int varID = 0; varID < nvars; ++varID )
convertVarUnits(vars, varID, vars[varID].name);
}
......@@ -749,12 +771,12 @@ void *Setpartab(void *argument)
streamDefTimestep(streamID2, tsID1);
for ( recID = 0; recID < nrecs; recID++ )
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
varID2 = varID;
levelID2 = levelID;
int varID2 = varID;
int levelID2 = levelID;
if ( delvars )
{
......@@ -826,7 +848,7 @@ void *Setpartab(void *argument)
#if defined(HAVE_UDUNITS2)
UDUNITS_LOCK();
for ( varID = 0; varID < nvars; varID++ )
for ( int varID = 0; varID < nvars; varID++ )
if ( vars[varID].ut_converter ) cv_free((cv_converter*)vars[varID].ut_converter);
if ( ut_read )
......
......@@ -141,7 +141,7 @@ pstream_t *pstream_to_pointer(int idx)
else
Error("pstream index %d undefined!", idx);
return (pstreamptr);
return pstreamptr;
}
/* Create an index from a pointer */
......@@ -173,7 +173,7 @@ int pstream_from_pointer(pstream_t *ptr)
else
Error("Internal problem (pointer %p undefined)", ptr);
return (idx);
return idx;
}
static
......@@ -210,7 +210,7 @@ pstream_t *pstream_new_entry(void)
if ( pstreamptr ) pstream_init_entry(pstreamptr);
return (pstreamptr);
return pstreamptr;
}
static
......@@ -274,7 +274,7 @@ int pstreamFindID(const char *name)
if ( pstreamID == _pstream_max ) pstreamID = -1;
return (pstreamID);
return pstreamID;
}
......@@ -282,7 +282,7 @@ int pstreamIsPipe(int pstreamID)
{
pstream_t *pstreamptr = pstream_to_pointer(pstreamID);
return (pstreamptr->ispipe);
return pstreamptr->ispipe;
}
......@@ -551,7 +551,7 @@ int pstreamOpenRead(const argument_t *argument)
if ( pstreamID < 0 ) cdiOpenError(pstreamID, "Open failed on >%s<", argument->args);
return (pstreamID);
return pstreamID;
}
static
......@@ -722,7 +722,7 @@ int pstreamOpenWrite(const argument_t *argument, int filetype)
pstreamptr->filetype = filetype;
}
return (pstreamID);
return pstreamID;
}
......@@ -775,7 +775,7 @@ int pstreamOpenAppend(const argument_t *argument)
pstreamptr->fileID = fileID;
}
return (pstreamID);
return pstreamID;
}
......@@ -1415,7 +1415,7 @@ int pstreamInqTimestep(int pstreamID, int tsID)
pstreamptr->tsID = tsID;
}
return (nrecs);
return nrecs;
}
......@@ -1677,7 +1677,7 @@ int pstreamInqFiletype(int pstreamID)
#endif
filetype = streamInqFiletype(pstreamptr->fileID);
return (filetype);
return filetype;
}
......@@ -1694,7 +1694,7 @@ int pstreamInqByteorder(int pstreamID)
#endif
byteorder = streamInqByteorder(pstreamptr->fileID);
return (byteorder);
return byteorder;
}
void pstreamInqGRIBinfo(int pstreamID, int *intnum, float *fltnum, off_t *bignum)
......
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