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

Re: 970121: maximum number of dimensions 32 exceeded



>To: address@hidden
>From: "R. Bauer" <address@hidden>
>Subject: maximum number of dimensions 32 exceeded 
>Organization: Forschungszentrum Juelich Gmbh (KFA)
>Keywords: 199701200938.CAA19830

Hi,

> who is the person which idea it was to restrict the number of possible
> dimensions and why.
> 
> I like to have more than 32 dimensions.

I don't remember who's idea it was, but here's what the User's Guide
says about it:

    There is a suggested limit (100) to the number of dimensions that
    can be defined in a single netCDF file. The limit is the value of
    the predefined macro MAX_NC_DIMS (MAXNCDIM for FORTRAN). The purpose
    of the limit is to make writing generic applications simpler. They
    need only provide an array of MAX_NC_DIMS dimensions to handle any
    netCDF file. The implementation of the netCDF library does not
    enforce this advisory maximum, so it is possible to use more
    dimensions, if necessary; just don't expect generic applications or
    netCDF utilities to be able to handle the resulting netCDF files.

To use more dimensions, you would need to change the definition of the
following macro in netcdf.h:

  #define MAX_NC_DIMS 100                /* max dimensions per file */

or the analogous parameter definition in the netcdf.inc file for the
FORTRAN interface.

Since FORTRAN didn't have an equivalent of C's malloc() or C++'s new to
allocate arrays dynamically, writing an application such as "ncdump" in
FORTRAN would be difficult without some upper limit on the number of
dimensions in a netCDF file.  This limit was imposed on users of the C
interface as well, since FORTRAN programs may read files created by C
programs.

The limit was 32 in versions of netCDF before 2.4, but was raised to 100
with version 2.4; at the same time other such limits were raised as
well.  Here's what the 2.4 release notes said about the limits:

    This release increases advisory limits for the maximum number of
    dimensions, variables, and attributes in a netCDF file, to
    accommodate users who found the old limits constraining.  These
    limits are still advisory, to make applications easier to write when
    dynamic memory allocation would be awkward or impractical (e.g. in
    Fortran applications).  The maximum number of dimensions per netCDF
    file has been increased from 32 to 100.  The maximum number of
    variables per netCDF file has been increased from 512 to 2000.  The
    maximum number of attributes per variable has been increased from
    512 to 2000.

When all netCDF FORTRAN users have converted their programs to FORTRAN
90 (which does permit dynamic array allocation) and there are no one
uses the FORTRAN77 interface, it may be possible to remove these
limits. 

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu