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.
>To: address@hidden
>From: address@hidden
>Subject: Re: 20011226: CCM3 to MM5 (fwd)
>Organization: UCAR
>Keywords:
Hi Cindy,
> Thanks for that help you send the user. We normally suggest that
> they only get a netCDF reader (you do not know a good one I can suggest
> to them???), and then put the data into a simple file format we developed,
> which is easier than going to GRIB data, since (if I understand correct)
> you might also have some data losses in the process. What is you comment
> on this??
For C, ncdump is an example of a generic netCDF reader, but
unfortunately much of the code in ncdump.c is concerned with
formatting the output to print a text representation of a netCDF file.
One of these days, I should implement an option for ncgen that will
generate code to read a netCDF file rather than just write it.
For Fortran, such a program generator exists in GENNET.F:
Barry Schwartz's program to generate a Fortran program to read a
netCDF file. It opens a specified netCDF file and generates the
necessary Fortran code to declare the corresponding Fortran
dimensions and variables and read all the data into the Fortran
variables.
ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/gennet.f
In the NetCDF Users Guides, section 4.2 "Reading a netCDF Dataset with
Known Names" and section 4.3 "Reading a netCDF Dataset with Unknown
Names" contains skeleton code for writing netCDF readers.
For data that can be represented as horizontal 2D numeric arrays, you
need not have data loss in converting to GRIB, since it can represent
floating-point quantities in full precision. However you would lose
information in character-string attributes and the ability to
represent higher-dimension arrays, vertical slices, etc.
--Russ