[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 950628: bug in ncdump?



>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