Commit 5490f8b4 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

netCDF: ignore the attribute valid_range, if the data type is inconsitent

parent 0b5ac45d
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
2013-02-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2013-02-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* netCDF: ignore the attribute valid_range, if the data type is inconsitent
* netCDF: added env IGNORE_VALID_RANGE to ignore the attribute valid_range * netCDF: added env IGNORE_VALID_RANGE to ignore the attribute valid_range
2013-01-31 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2013-01-31 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
...@@ -4723,7 +4723,9 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, ...@@ -4723,7 +4723,9 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
if ( ncvars[ncvarid].lvalidrange == FALSE ) if ( ncvars[ncvarid].lvalidrange == FALSE )
{ {
extern int cdiIgnoreValidRange; extern int cdiIgnoreValidRange;
if ( cdiIgnoreValidRange == FALSE ) int lignore = FALSE;
if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
{ {
cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvars[ncvarid].validrange); cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvars[ncvarid].validrange);
ncvars[ncvarid].lvalidrange = TRUE; ncvars[ncvarid].lvalidrange = TRUE;
...@@ -4731,6 +4733,10 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, ...@@ -4731,6 +4733,10 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
ncvars[ncvarid].lunsigned = TRUE; ncvars[ncvarid].lunsigned = TRUE;
/* cdfSetVar(ncvars, ncvarid, TRUE); */ /* cdfSetVar(ncvars, ncvarid, TRUE); */
} }
else if ( lignore )
{
Warning("Inconsistent data type for attribute %s:valid_range, ignored!", name);
}
} }
} }
else if ( strcmp(attname, "valid_min") == 0 && attlen == 1 ) else if ( strcmp(attname, "valid_min") == 0 && attlen == 1 )
......
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