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.
Willa, > I appreciate it very much if anyone can offer me a clue about what > would cause the problem with netcdf-2.4.2 described below. > > I changed all "long" to "nclong" in my programs and recompiled them > with netcdf-2.4.2. All programs failed on ncvarget() function > with this error: (I have tested both on Solaris and DEC/OSF1) > > ncvarget: xxx: Invalid Coordinates > > where xxx is variable name. I have checked input arguments "nclong start" > and "nclong count" which all contain right values. Besides, all > these programs are working with old netcdf library. You should not change all occurrences of "long" to "nclong", only in declarations that declare types for *data* associated with the NC_LONG netCDF external data type (32-bit integer). In particular, the C prototype for ncvarget is: extern int ncvarget(int ncid, int varid, const long* start, const long* count, void* value) so the types of the "start" and "count" variables should be "long*", not "nclong*". The latter should result in a compile error, and won't work correctly on platforms where the "nclong" typedef is different from "long". Only the declaration for variables corresponding to the "value" argument in the ncvarget/put and ncattget/put functions needs to be changed from "long" to "nclong". Or, as the release notes say: This means that C/C++ programs on platforms with sizeof(long) > sizeof(int) (e.g. the DEC Alpha) will have to be recompiled and must use nclong as the variable type corresponding to NC_LONG data. All programs that use NC_LONG data should also use the nclong data type to declare such data for portability. The requirement that NC_LONG data be declared with the "nclong" typedef was first introduced in netCDF version 2.3.2, although programs that use "long" instead still work on platforms where sizeof(long) == sizeof(int). This is explained more fully in the Users Guide in the section "Language Types Corresponding to NetCDF Data Types", available on-line at http://www.unidata.ucar.edu/packages/netcdf/guide_9.html#SEC56 Please let me know if this needs further clarification. --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu