Commit 84803fa9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

netCDF: don't decode timevalue if timeunits is missing.

parent f0cf1a5c
2019-05-23 Uwe Schulzweida
2019-06-11 Uwe Schulzweida
* using CGRIBEX library version 1.9.3
* Version 1.9.7 released
2019-05-26 Uwe Schulzweida
* netCDF: don't decode timevalue if timeunits is missing
2019-05-17 Uwe Schulzweida
* vlistInqVarLongname: return CDI_MAX_NAME chars (bug fix)
......
......@@ -14,6 +14,7 @@ void basetimeInit(basetime_t *basetime)
basetime->ncdimid = CDI_UNDEFID;
basetime->ncvarboundsid = CDI_UNDEFID;
basetime->leadtimeid = CDI_UNDEFID;
basetime->lunits = false;
basetime->lwrf = false;
basetime->timevar_cache = NULL;
}
......
......@@ -19,6 +19,7 @@ typedef struct {
int ncdimid;
int ncvarboundsid;
int leadtimeid;
bool lunits;
bool lwrf; // true for time axis in WRF format
timecache_t *timevar_cache;
}
......
......@@ -3992,6 +3992,7 @@ int cdfInqContents(stream_t *streamptr)
int nctimevarid = streamptr->basetime.ncvarid;
if (nctimevarid != CDI_UNDEFID && (!time_has_units || streamptr->basetime.lwrf)) ncvars[nctimevarid].units[0] = 0;
if (nctimevarid != CDI_UNDEFID && time_has_units) streamptr->basetime.lunits = true;
if ( time_has_units )
{
......@@ -4001,6 +4002,7 @@ int cdfInqContents(stream_t *streamptr)
{
nctimevarid = CDI_UNDEFID;
streamptr->basetime.ncvarid = CDI_UNDEFID;
streamptr->basetime.lunits = false;
}
if ( leadtime_id != CDI_UNDEFID && taxis->type == TAXIS_RELATIVE )
......@@ -4179,7 +4181,7 @@ int cdfInqTimestep(stream_t * streamptr, int tsID)
double timevalue = tsID;
int nctimevarid = streamptr->basetime.ncvarid;
if ( nctimevarid != CDI_UNDEFID )
if (nctimevarid != CDI_UNDEFID && streamptr->basetime.lunits)
{
int fileID = streamptr->fileID;
size_t index = (size_t)tsID;
......
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