[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20050308: comments about netCDF web documentation
- Subject: Re: 20050308: comments about netCDF web documentation
- Date: Tue, 08 Mar 2005 17:01:33 -0700
>Institution: Virginia Tech
>Package Version: Digital Visual Fortran (now Compaq) 6.6
>Operating System: Windows XP
>Hardware Information: No problems
Hi David,
>Inquiry: I am new to this Unidata cocept. I downloaded data (VMAP2 daily
>surface data from ORNL- i.e. sradTCLMxxD3i.nc) and a dll, but I was under the
>impression that I would be able to find some fortran code to read these data.
>Have I missed something? Probably.
Although the netCDF Fortran Users Guide includes example code
fragments for every netCDF function call, complete self-contained
example programs are sometimes more useful. A program general enough
to read an arbitrary netCDF file (any dimensions, variables, and
attributes) is relatively complex, so doesn't make a good example to
learn from.
There are some relatively good primers available such as "A first time
primer for reading netCDF files":
http://www.nodc.noaa.gov/woce_V2/disk10/html/ncprimer.htm
I've just whipped up a small Fortran example for reading data from a
simple netCDF file that looks like this (using "CDL" to show the
names, types, and shapes of variables, their attributes, and values):
http://www.unidata.ucar.edu/packages/netcdf/examples/read1.cdl
The Fortran-90 program looks like this:
http://www.unidata.ucar.edu/packages/netcdf/examples/read1.f90
The corresponding netCDF file to read is:
http://www.unidata.ucar.edu/packages/netcdf/examples/read1.nc
You can generate netCDF example programs that write files using the
"ncgen" utility and CDL files. For example, invoking
ncgen -f read1.cdl
will generate, on stdout, a Fortran-77 program that creates the
read1.nc file above. Similarly, "ncgen -c" generates a C program and
"ncgen -b" generates a binary netCDF file corresponding to a specified
CDL file.
I hope this helps get you started. It's my intention to eventually
make available complete examples for the netCDF interfaces for C, C++,
Java, Fortran-77, Fortran-90, Python, Ruby, Perl, to supplement the
documentation for all these interfaces, but not much is done yet.
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu/staff/russ