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

cdfInqContents: check type of coordinates attribute

parent 26eb0ae5
...@@ -15,6 +15,8 @@ case "${HOSTNAME}" in ...@@ -15,6 +15,8 @@ case "${HOSTNAME}" in
hama*) hama*)
./configure --prefix=$HOME/local \ ./configure --prefix=$HOME/local \
--enable-maintainer-mode \ --enable-maintainer-mode \
--enable-swig \
--enable-python \
--with-jasper=/opt/local \ --with-jasper=/opt/local \
--with-grib_api=$HOME/local/gribapi-1.9.8 \ --with-grib_api=$HOME/local/gribapi-1.9.8 \
--with-netcdf=/opt/local \ --with-netcdf=/opt/local \
......
...@@ -4351,29 +4351,23 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, ...@@ -4351,29 +4351,23 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
} }
else if ( strcmp(attname, "add_offset") == 0 && atttype != NC_CHAR ) else if ( strcmp(attname, "add_offset") == 0 && atttype != NC_CHAR )
{ {
if ( atttype != NC_CHAR ) cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].addoffset);
{ /*
cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].addoffset); if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT )
/* if ( ncvars[ncvarid].addoffset != 0 )
if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT ) Warning("attribute add_offset not supported for atttype %d", atttype);
if ( ncvars[ncvarid].addoffset != 0 ) */
Warning("attribute add_offset not supported for atttype %d", atttype); cdfSetVar(ncvars, ncvarid, TRUE);
*/
cdfSetVar(ncvars, ncvarid, TRUE);
}
} }
else if ( strcmp(attname, "scale_factor") == 0 && atttype != NC_CHAR ) else if ( strcmp(attname, "scale_factor") == 0 && atttype != NC_CHAR )
{ {
if ( atttype != NC_CHAR ) cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].scalefactor);
{ /*
cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].scalefactor); if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT )
/* if ( ncvars[ncvarid].scalefactor != 1 )
if ( atttype != NC_BYTE && atttype != NC_SHORT && atttype != NC_INT ) Warning("attribute scale_factor not supported for atttype %d", atttype);
if ( ncvars[ncvarid].scalefactor != 1 ) */
Warning("attribute scale_factor not supported for atttype %d", atttype); cdfSetVar(ncvars, ncvarid, TRUE);
*/
cdfSetVar(ncvars, ncvarid, TRUE);
}
} }
else if ( strcmp(attname, "bounds") == 0 && atttype == NC_CHAR ) else if ( strcmp(attname, "bounds") == 0 && atttype == NC_CHAR )
{ {
...@@ -4457,8 +4451,8 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, ...@@ -4457,8 +4451,8 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
cdfSetVar(ncvars, ncvarid, TRUE); cdfSetVar(ncvars, ncvarid, TRUE);
} }
*/ */
else if ( strcmp(attname, "associate") == 0 || else if ( (strcmp(attname, "associate") == 0 || strcmp(attname, "coordinates") == 0) &&
strcmp(attname, "coordinates") == 0 ) atttype == NC_CHAR )
{ {
int status; int status;
char *pstring, *varname = NULL; char *pstring, *varname = NULL;
...@@ -4529,29 +4523,23 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, ...@@ -4529,29 +4523,23 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
ncdims[ncvars[ncvarid].dimids[0]].dimtype = Z_AXIS; ncdims[ncvars[ncvarid].dimids[0]].dimtype = Z_AXIS;
} }
} }
else if ( strcmp(attname, "_FillValue") == 0 || else if ( (strcmp(attname, "_FillValue") == 0 || strcmp(attname, "missing_value") == 0) &&
strcmp(attname, "missing_value") == 0 ) atttype != NC_CHAR )
{ {
if ( atttype != NC_CHAR ) cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].missval);
{ ncvars[ncvarid].defmiss = TRUE;
cdfGetAttDouble(fileID, ncvarid, attname, 1, &ncvars[ncvarid].missval); /* cdfSetVar(ncvars, ncvarid, TRUE); */
ncvars[ncvarid].defmiss = TRUE;
/* cdfSetVar(ncvars, ncvarid, TRUE); */
}
} }
else if ( strcmp(attname, "cdi") == 0 ) else if ( strcmp(attname, "cdi") == 0 && atttype == NC_CHAR )
{ {
if ( atttype == NC_CHAR ) cdfGetAttText(fileID, ncvarid, attname, attstringlen-1, attstring);
{ strtolower(attstring);
cdfGetAttText(fileID, ncvarid, attname, attstringlen-1, attstring);
strtolower(attstring);
if ( memcmp(attstring, "ignore", 6) == 0 ) if ( memcmp(attstring, "ignore", 6) == 0 )
{ {
ncvars[ncvarid].ignore = TRUE; ncvars[ncvarid].ignore = TRUE;
cdfSetVar(ncvars, ncvarid, FALSE); cdfSetVar(ncvars, ncvarid, FALSE);
} }
}
} }
else if ( strcmp(attname, "axis") == 0 && atttype == NC_CHAR ) else if ( strcmp(attname, "axis") == 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