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

cdfOpenFile: create netCDF4 files without NC_CLASSIC_MODEL

parent c10135a3
2010-10-05 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfOpenFile: switch off checking of netCDF4 format
* cdfOpenFile: create netCDF4 files without NC_CLASSIC_MODEL
* cdfOpenFile: switch off checking of netCDF4 format (read)
2010-09-27 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -133,7 +133,7 @@ int cdfOpenFile(const char *filename, const char *mode, int version)
if ( version == 2 ) writemode = NC_CLOBBER | NC_64BIT_OFFSET;
#endif
#if defined (NC_NETCDF4)
if ( version == 4 ) writemode = NC_CLOBBER | NC_NETCDF4 | NC_CLASSIC_MODEL;
if ( version == 4 ) writemode = NC_CLOBBER | NC_NETCDF4 /*| NC_CLASSIC_MODEL*/;
#endif
cdf_create(filename, writemode, &ncid);
cdfComment(ncid);
......
......@@ -363,14 +363,22 @@ void cdfGetAttText(int fileID, int ncvarid, char *attname, int attlen, char *att
static
int cdfInqDatatype(int xtype)
{
int datatype;
int datatype = -1;
if ( xtype == NC_BYTE ) datatype = DATATYPE_INT8;
/* else if ( xtype == NC_CHAR ) datatype = DATATYPE_UINT8; */
else if ( xtype == NC_SHORT ) datatype = DATATYPE_INT16;
else if ( xtype == NC_INT ) datatype = DATATYPE_INT32;
else if ( xtype == NC_FLOAT ) datatype = DATATYPE_FLT32;
else if ( xtype == NC_DOUBLE ) datatype = DATATYPE_FLT64;
else datatype = DATATYPE_FLT32;
#if defined (NC_NETCDF4)
else if ( xtype == NC_LONG ) datatype = DATATYPE_INT32;
else if ( xtype == NC_UBYTE ) datatype = DATATYPE_UINT8;
else if ( xtype == NC_USHORT ) datatype = DATATYPE_UINT16;
else if ( xtype == NC_UINT ) datatype = DATATYPE_UINT32;
else if ( xtype == NC_INT64 ) datatype = DATATYPE_FLT64;
else if ( xtype == NC_UINT64 ) datatype = DATATYPE_FLT64;
#endif
return (datatype);
}
......@@ -387,11 +395,17 @@ int cdfDefDatatype(int datatype)
Error(func, "CDI/netCDF library does not support complex numbers!");
if ( datatype == DATATYPE_INT8 ) xtype = NC_BYTE;
else if ( datatype == DATATYPE_UINT8 ) xtype = NC_SHORT;
else if ( datatype == DATATYPE_INT16 ) xtype = NC_SHORT;
else if ( datatype == DATATYPE_UINT16 ) xtype = NC_INT;
else if ( datatype == DATATYPE_INT32 ) xtype = NC_INT;
#if defined (NC_NETCDF4)
else if ( datatype == DATATYPE_UINT8 ) xtype = NC_UBYTE;
else if ( datatype == DATATYPE_UINT16 ) xtype = NC_USHORT;
else if ( datatype == DATATYPE_UINT32 ) xtype = NC_UINT;
#else
else if ( datatype == DATATYPE_UINT8 ) xtype = NC_SHORT;
else if ( datatype == DATATYPE_UINT16 ) xtype = NC_INT;
else if ( datatype == DATATYPE_UINT32 ) xtype = NC_INT;
#endif
else if ( datatype == DATATYPE_FLT64 ) xtype = NC_DOUBLE;
else xtype = NC_FLOAT;
......@@ -4934,6 +4948,7 @@ int cdfInqContents(int streamID)
{
ncvars[ncvarid].isvar = 0;
Warning(func, "Variable %s has unknown type, skipped!", ncvars[ncvarid].name);
continue;
}
if ( ncvars[ncvarid].ndims > 4 )
......@@ -4941,6 +4956,14 @@ int cdfInqContents(int streamID)
ncvars[ncvarid].isvar = 0;
Warning(func, "%d dimensional variables unsupported. Skip variable %s",
ncvars[ncvarid].ndims, ncvars[ncvarid].name);
continue;
}
if ( cdfInqDatatype(ncvars[ncvarid].xtype) == -1 )
{
ncvars[ncvarid].isvar = 0;
Warning(func, "Variable %s has an unsupported data type, skipped!", ncvars[ncvarid].name);
continue;
}
if ( ncvars[ncvarid].xtype == 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