Commit b7339103 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

netCDF: ignore the attribute valid_min/valid_max, if the data type is inconsistent

parent 4370c5a2
2013-03-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
2013-03-14 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.6.0 released
* using CGRIBEX library version 1.6.0
* using CGRIBEX library version 1.6.0
2013-03-07 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* netCDF: ignore the attribute valid_min/valid_max, if the data type is inconsistent
2013-02-18 Florian Prill <Florian.Prill@dwd.de>
......
......@@ -4761,13 +4761,39 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
}
else if ( strcmp(attname, "valid_min") == 0 && attlen == 1 )
{
cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[0]);
ncvars[ncvarid].lvalidrange = TRUE;
if ( ncvars[ncvarid].lvalidrange == FALSE )
{
extern int cdiIgnoreValidRange;
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, 1, &(ncvars[ncvarid].validrange)[0]);
ncvars[ncvarid].lvalidrange = TRUE;
}
else if ( lignore )
{
Warning("Inconsistent data type for attribute %s:valid_min, ignored!", name);
}
}
}
else if ( strcmp(attname, "valid_max") == 0 && attlen == 1 )
{
cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[1]);
ncvars[ncvarid].lvalidrange = TRUE;
if ( ncvars[ncvarid].lvalidrange == FALSE )
{
extern int cdiIgnoreValidRange;
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, 1, &(ncvars[ncvarid].validrange)[1]);
ncvars[ncvarid].lvalidrange = TRUE;
}
else if ( lignore )
{
Warning("Inconsistent data type for attribute %s:valid_max, ignored!", name);
}
}
}
else if ( strcmp(attname, "_Unsigned") == 0 && atttype == NC_CHAR )
{
......
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