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.
Mark, > Thank you very much for your response to Dennis' question. Our > scientist (Greg) in charge of the NetCDF programming for this took > a look at metar.cdl and thinks this structure will suit our needs > well. By chance do you have access to a snipet of fortran code that > produces this structure? > > Thanks > > Mark > > http://my.unidata.ucar.edu/content/software/netcdf/examples/metar.cdl No, but one way you can get most of the boilerplate code needed is to generate it with the ncgen tool, as follows: ncgen -f metar.cdl > metar.f and metar.f will do approximately what you want. I just tried this, and it seems to overflow something in ncgen and cause an error, although the resulting 785 line metar.f has most of the code you need. I'll see if I can fix the bug this reveals. You can get it to work if you first generate a canonicalized CDL file that doesn't have all the station location data in it, like this: ncgen -o metarx.nc metar.cdl # generate the netCDF file metarx.nc ncdump -c metarx.nc > metarx.cdl # just coordinate variables in CDL ncgen -f metarx.cdl > metarx.f # generate the fortran and the resulting 1327 line Fortran program is complete. --Russ