[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #XBL-623715]: NetCDF Error -57
- Subject: [netCDF #XBL-623715]: NetCDF Error -57
- Date: Wed, 12 Mar 2008 16:09:52 -0600
Hi Lee,
The error code -57 is associated with the error message
Start+count exceeds dimension bound
and probably means there is something wrong with the start or count
vectors that are supplied as arguments to nf90_get_var. It has
nothing to do with the amount of space allocated to receive the data,
because the netCDF library has no way of determining how much space
you have allocated. It just assumes there is enough space.
The error message means that if you add start(i)-1 and count(i), the
result exceeds the length of the ith dimension of the variable, where
the first dimension of the variable is associated with start(1) and
count(1). So, for example, if you have a netCDF variable for which
the CDL declaration from ncdump is
dimensions:
lat = 20;
lon = 30;
variables:
float var(lat,lon); // lon varies fastest, CDL uses row-major
The corresponding Fortran declaration for reading 3 latitide bands
will be something like
real varslice(30, 3)
and to read latitude bands 18, 19, and 20 you could use something like
integer start(2), count(2)
count = (/ 30, 3 /)
start = (/ 1, 18 /)
nf90_get_var(ncid, varid, varslice, start = start, &
count = count)
This would get an error like you are getting if start(1)-1 + count(1)
is greater than 30 or if start(2)-1 + count(2) is greater than 20.
Complete examples of writing and reading 4D slices are in:
http://www.unidata.ucar.edu/software/netcdf/examples/programs/pres_temp_4D_wr.f90
http://www.unidata.ucar.edu/software/netcdf/examples/programs/pres_temp_4D_rd.f90
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: XBL-623715
Department: Support netCDF
Priority: Normal
Status: Closed