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.
>From: Jeremy Kepner <address@hidden> >Organization: Princeton >Keywords: 199506280316.AA05383 netCDF ncdump Hi Jeremy, > There is a small error in ncdump when reading the file > generated by the enclosed fortran program. ncdump produces > > netcdf test { > dimensions: > X = 20 ; > Y = 10 ; > Z = 5 ; > > variables: > float array(Z, Y, X) ; > > > when the correct notation should be array(X,Y,Z). No, ncdump is correct in this case, because the CDL language that ncdump emits uses the convention that the last index varies fastest. NetCDF files can be produced by Fortran, C, C++, or perl programs or by the ncgen utility, but the data file that is produced must be language-neutral. Similarly, the CDL language that provides a text-representation of the netCDF data is independent of the language used to create the file. We had to choose a convention for dimension order in CDL, and Fortran's somewhat unconventional convention lost out in this case. The netCDF Users Guide mentions this: In FORTRAN, the dimensions are reversed from the CDL declaration with the first dimension varying fastest and the record dimension as the last dimension of a record variable. Thus a FORTRAN declaration for the corresponding variable that holds all times and levels is PARAMETER (LATS=5, LONS=10, LEVELS=4, TIMES=3) ... REAL TEMP(LONS, LATS, LEVELS, TIMES) --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu