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.
> Organization: NCAR/HAO > Keywords: 199401311740.AA26141 Hi Ben, > Sorry if this is a FAQ: in the netCDF User's Guide, v1.10 > (Dec 1990, I should probably get a newer one), the example > on p.68 (NCVDEF) defines RHDIMS (vdims) as TIMDIM, LATDIM, > LONDIM in that order. But on p.80 (NCVPT), where the hyperslab > is written, COUNT is defined in the opposite order from RHDIMS > (LONS,LATS,TIMES). If I do this in my (fortran) code, I get an > "Invalid edge length" message from ncvarput. I think that example was in error and was corrected in the User's Guide some time ago. The example now reads: Here is an example using NCVDEF to create a variable named rh of type long with three dimensions, time, lat, and lon in a new netCDF file named foo.nc: INCLUDE 'netcdf.inc' ... INTEGER NCID, RCODE INTEGER LATDIM, LONDIM, TIMDIM ! dimension IDs INTEGER RHID ! variable ID INTEGER RHDIMS(3) ! variable shape ... NCID = NCCRE ('foo.nc', NC_CLOBBER, RCODE) ... ! define dimensions LATDIM = NCDDEF(NCID, 'lat', 5, RCODE) LONDIM = NCDDEF(NCID, 'lon', 10, RCODE) TIMDIM = NCDDEF(NCID, 'time', NCUNLIM, RCODE) ... ! define variable RHDIMS(1) = LONDIM RHDIMS(2) = LATDIM RHDIMS(3) = TIMDIM RHID = NCVDEF (NCID, 'rh', NCDOUBLE, 3, RHDIMS, RCODE) __________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden P.O. Box 3000 (303)497-8645 Boulder, Colorado 80307-3000