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.
> From: Harry Edmon <address@hidden> > Subject: netcdf 2.4.3 problem under Solaris 2.5.1 (SunOS 5.5.1) > Organization: University of Washington > Keywords: 199611011851.AA26718 netCDF 2.4.3 > > I have a netcdf file with the following header: > > netcdf ALSY_1990 { > dimensions: > dimx_ROBS = 39 ; > dimy_ROBS = 27 ; > dimz_ROBS = 1 ; > time = UNLIMITED ; // (365 currently) > variables: > float time(time) ; > float ROBS(time, dimz_ROBS, dimy_ROBS, dimx_ROBS) ; > ROBS:xmin = -5.f ; > ROBS:xmax = 4.5f ; > ROBS:xstag = 0.f ; > ROBS:ymin = -15.f ; > ROBS:ymax = -8.5f ; > ROBS:ystag = 0.f ; > ROBS:zmin = 1050.f ; > ROBS:zmax = 0.f ; > ROBS:zstag = -0.5f ; > ROBS:missing_data = -1.f ; > > // global attributes: > :domxmin = -5.f ; > :domxmax = 4.5f ; > :domymin = -15.f ; > :domymax = -8.5f ; > :domzmin = 1050.f ; > :domzmax = 0.f ; > :constants_file_name = "emkstd.cst " ; > } > > > I run the following program: > > #include <netcdf.h> > > main() > { > int id, i; > float *junk, *malloc(); > long start[4] = {0,0,0,0}, length[4] = {365,1,27,39}; > > id = ncopen("/home/disk/twister/widmann/eth/data/ALSY_1990", NC_NOWRITE); > junk = malloc(sizeof(float)*27*39*365); > i = ncvarget(id, 1, start, length, junk); > printf("%d\n", i); > } > > > The ncvarget call returned -1, but ncerr is not set. Why? From my digging into > the code, it appears that the last call to xdr_vector on the last time within > ncvarget is returning false. > > The file can be found in ftp.atmos.washington.edu:/harry/ALSY_1990 Harry: I have not been able to reproduce this problem. I'm SunOS 5.5, compiled with '-g' (not the default '-pic -O'). I tried files with 0 records, and 365 records and 364 records, using fill and NO_FILL on the create. (I don't see the file in your ftp area). In each of these cases I got either '0' or "ncvarget: ROBS: Invalid Coordinates" as appropriate when running your test. One of the reasons we abandoned the xdr library in netcdf-3 was that we are able to more precisely identify errors at the OS level and differentiate these from conversion problems. If you still have the file around, I'll look at it. -glenn