NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Sudheer,If the names of the dimensions are always the same, then use nf90_inq_dimid followed by nf90_inquire_dimension to get the length of each dimension. See the example on this page:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90/NF90_005fINQUIRE_005fDIMENSION.htmlIf all the dimensions have coordinate variables, then the following subroutine will get several dimension lengths in one call:
http://www.esrl.noaa.gov/psd/people/dave.allured/data/f90/lib/getnc_dims.f90If the dimension names change between Netcdf files, then the problem is more complicated. We can address that if neither of the above works for you.
--Dave A. NOAA/PSD/CIRES On 6/10/2010 7:55 AM, Sudheer Joseph wrote:
Dear Users, I have been coding a program to read multiple netcdf files having different time dimensions. I want to know if there is a way to read netcdf varibale with out defining the dimension as parameter. with in fortran 90 program. normally we need to define like below ! timesteps of data. integer, parameter :: NDIMS = 3, NRECS =1 integer, parameter :: NTIM=1464, NLATS = 94, NLONS = 192 allocate(pres_in(NLONS, NLATS, NTIM))count = (/ NLONS, NLATS,NTIM/) start = (/ 1, 1, 1/) ! Read the surface pressure and temperature data from the file, one ! record at a time. call check( nf90_get_var(ncid, pres_varid, pres_in, start = start,count = count) ) In my case ntim may be different for different files. I wanted to use the reading part as a subroutine where ntim is provided as a variable and passed to subroutine but if I declare ntim as varible then netcdf gives an error. If any one have a solution please help. I am not looking for solutions like replacing the parameter statement using shell script and re compiling it etc. with best regards, Sudheer _______________________________________________ netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdfgroup
archives: