This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: Russ Rew <address@hidden> >From: Paul Wessel <address@hidden> >Subject: netcdf 3 and GMT >Organization: University of Hawaii >Keywords: 199710022207.QAA22322 netCDF 3 Paul, > >Yes, the netCDF-3 interface tries to prevent reading data as text that > >was written as numbers, so unless the external type of the "title" > >attribute is NC_CHAR, you will get this error message. > > Great, that was it. The old code that made the database had NC_BYTE. > rewriting the database with NC_CHAR fixed it. > > THe only inconvenience I have now is that there are no #defines for NC_INT > etc in netcdf.h, only a typedef enumeration. However, all the examples use > NC_INT > and NC_SHORT etc. I had to put in #define NC_INT 4 to make things compile. > I must be missing something . I don't understand this. The enum declaration in netcdf.h defines NC_INT as 4: /* * The netcdf external data types */ typedef enum { NC_BYTE = 1, /* signed 1 byte integer */ NC_CHAR = 2, /* ISO/ASCII character */ NC_SHORT = 3, /* signed 2 byte integer */ NC_INT = 4, /* signed 4 byte integer */ NC_FLOAT = 5, /* single precision floating point number */ NC_DOUBLE = 6 /* double precision floating point number */ } nc_type; which is a better way to define it than using #define (because it can be type-checked by the compiler), but you shouldn't need to #define NC_INT in addition to this. All the nc_test code uses these types and doesn't require any #defines. Maybe the assumption that you need to #define these is due to a misleading compiler message. Can you send us a small example that doesn't seem to work with just the enumerated typedef above that including netcdf.h defines? --Russ