[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #AQT-176214]: UNLIMITED dimension for F90/95
- Subject: [netCDF #AQT-176214]: UNLIMITED dimension for F90/95
- Date: Wed, 13 Feb 2008 14:40:15 -0700
John,
You can find out the actual dimension length in the netCDF file from your
program
by calling the appropriate netCDF functions to get the length of the
dimension.
If the dimension is named "gates", you can first call
status = nf90_inq_dimid(ncid, "gates", GatesDimID)
if (status /= nf90_noerr) ! handle error
to get the dimension id, then use that in a call to
status = nf90_inquire_dimension(ncid, GatesDimID, len = nGates)
Now you need to declare an array dimensioned (nGates, 64). One way is like
real, dimension(:, :, :), allocatable :: I_in
...
allocate(I_in(nGates, 64))
Another way to do this without using allocate is by calling a
subroutine with the array sizes as arguments, and inside the
subroutine you can use the arguments for array dimensions of arrays
local to that subroutine. If you also pass the name of the array as
an argument, then you can also declare the size of the array with
inside that subroutine, for example
real I_in(MaxGates * 64)
...
call read_I_in(I_in, nGates)
...
subroutine read_I_in(arg1, arg2)
real arg1(arg2, *)
...
! read data into array arg1
...
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: AQT-176214
Department: Support netCDF
Priority: Normal
Status: Closed