[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #RSG-568287]: values of count for NF90_Get_Var/NF90_Put_Var

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.


  • Subject: [netCDF #RSG-568287]: values of count for NF90_Get_Var/NF90_Put_Var
  • Date: Wed, 10 Nov 2010 09:24:10 -0700

Hi Hailin,

> I read the doc page of NF90_GET_VAR, which link is as below, and found
> that the values of count in the sample code are confusing.
> 
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90/NF90_005fGET_005fVAR.html
> 
> The following is the sample code in the page.
> 
> use netcdf
> implicit none
> integer            :: ncId, rhVarId, status
> integer, parameter :: numLons = 10, numLats = 5, numTimes = 3
> real, dimension(numLons, numLats, numTimes) &
> :: rhValues
> ...
> status = nf90_open("foo.nc", nf90_NoWrite, ncid)
> if(status /= nf90_NoErr) call handle_err(status)
> ...
> status = nf90_inq_varid(ncid, "rh", rhVarId)
> if(status /= nf90_NoErr) call handle_err(status)
> !Read the values at the last time by passing an array section
> status = nf90_get_var(ncid, rhVarId, rhValues(:, :, 3), &
> start = (/ 1, 1, numTimes /),     &
> count = (/ numLats, numLons, 1 /))
> if(status /= nf90_NoErr) call handle_err(status)
> 
> 
> In the code hilighted above, the values of count should be (/numLons,
> numLats, 1/) to conform to declaration of the array.

Thanks for reporting the problem and the fix. I've updated the 
documentation in the latest snapshot, so it should be corrected
in the next beta release.

--Russ


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: RSG-568287
Department: Support netCDF
Priority: Normal
Status: Closed