NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

subscript ranges

Is there some existing practice that I could consider adopting for
specifying the lower and upper subscript limits of a dimension?

netCDF says all subscript ranges are 1:n for Fortran, 0:n-1 for C.
However, several languages allow one to declare, e.g. Dow_Jones(1982:1987).
--------------------
I have been using attributes, e.g. for field Ex declared "real ex(0:50,0:90)":

...
dimensions:
        xg = 51, yg = 91;       // logically, (0:50), (0:90)
...
variables:
        float Ex(yg, xg) ;      // subscript order per C, not fortran.
                Ex:dims = 0, 50, 0, 90 ;  // indicates (0:50,0:90)
...

If I could put an attribute on dimension xg, I could use add_offset, say.
--------------------
Anyway, we are soon to adopt some convention in new software that will be
used by other people.  This seems a good time to ask what convention other
people have cobbled together for this functionality.
----------------------------------------------------------------------
        Bruce Langdon  L-472                   langdon@xxxxxxxx
        Physics Department                     Fax: (510) 423-9969
        Lawrence Livermore National Laboratory langdon@xxxxxxxxxxxx
        Livermore, CA 94550                 (510) 422-5444


  • 1993 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: