[netcdfgroup] reading variable dimension using fortran 90

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



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: