Commit 302f55fd authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

check complex numbers

parent eddddf0f
...@@ -361,15 +361,19 @@ int cdfInqDatatype(int xtype) ...@@ -361,15 +361,19 @@ int cdfInqDatatype(int xtype)
#if defined (HAVE_LIBNETCDF) #if defined (HAVE_LIBNETCDF)
int cdfDefDatatype(int datatype) int cdfDefDatatype(int datatype)
{ {
static char func[] = "cdfDefDatatype";
int xtype; int xtype;
if ( datatype == DATATYPE_INT8 ) xtype = NC_BYTE; if ( datatype == DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
else if ( datatype == DATATYPE_UINT8 ) xtype = NC_SHORT; Error(func, "CDI/netCDF library does not support complex numbers!");
else if ( datatype == DATATYPE_INT16 ) xtype = NC_SHORT;
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_UINT16 ) xtype = NC_INT;
else if ( datatype == DATATYPE_INT32 ) xtype = NC_INT; else if ( datatype == DATATYPE_INT32 ) xtype = NC_INT;
else if ( datatype == DATATYPE_UINT32 ) xtype = NC_INT; else if ( datatype == DATATYPE_UINT32 ) xtype = NC_INT;
else if ( datatype == DATATYPE_FLT64 ) xtype = NC_DOUBLE; else if ( datatype == DATATYPE_FLT64 ) xtype = NC_DOUBLE;
else xtype = NC_FLOAT; else xtype = NC_FLOAT;
return (xtype); return (xtype);
......
...@@ -16,8 +16,12 @@ ...@@ -16,8 +16,12 @@
int grbBitsPerValue(int datatype) int grbBitsPerValue(int datatype)
{ {
static char func[] = "grbBitsPerValue";
int bitsPerValue = 16; int bitsPerValue = 16;
if ( datatype == DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
Error(func, "CDI/GRIB library does not support complex numbers!");
if ( datatype != CDI_UNDEFID ) if ( datatype != CDI_UNDEFID )
{ {
if ( datatype > 0 && datatype <= 32 ) if ( datatype > 0 && datatype <= 32 )
......
...@@ -47,8 +47,12 @@ int iegInqDatatype(int prec) ...@@ -47,8 +47,12 @@ int iegInqDatatype(int prec)
int iegDefDatatype(int datatype) int iegDefDatatype(int datatype)
{ {
static char func[] = "iegDefDatatype";
int prec; int prec;
if ( datatype == DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
Error(func, "CDI/IEG library does not support complex numbers!");
if ( datatype != DATATYPE_FLT32 && datatype != DATATYPE_FLT64 ) if ( datatype != DATATYPE_FLT32 && datatype != DATATYPE_FLT64 )
datatype = DATATYPE_FLT32; datatype = DATATYPE_FLT32;
......
...@@ -45,8 +45,12 @@ int srvInqDatatype(int prec) ...@@ -45,8 +45,12 @@ int srvInqDatatype(int prec)
int srvDefDatatype(int datatype) int srvDefDatatype(int datatype)
{ {
static char func[] = "srvDefDatatype";
int prec; int prec;
if ( datatype == DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
Error(func, "CDI/SERVICE library does not support complex numbers!");
if ( datatype != DATATYPE_FLT32 && datatype != DATATYPE_FLT64 ) if ( datatype != DATATYPE_FLT32 && datatype != DATATYPE_FLT64 )
datatype = DATATYPE_FLT32; datatype = DATATYPE_FLT32;
......
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