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

Re: 20020808: NetCDF Question



>To: address@hidden
>From: address@hidden
>Subject: NetCDF Question
>Organization: Institute of Ocean Science
>Keywords: 200208082013.g78KD5K01526

Hi James,

> I am trying to determine the maximum number of dimensions that can be used
> when defining a variable.  I couldn't find it listed anywhere in the
> manual... which would be useful.

In the netcdf.h include file, the following definitions set the
maximums:

  /*
   * These maximums are enforced by the interface, to facilitate writing
   * applications and utilities.  However, nothing is statically allocated to
   * these sizes internally.
   */
  #define NC_MAX_DIMS     512      /* max dimensions per file */
  #define NC_MAX_ATTRS    4096     /* max global or per variable attributes */
  #define NC_MAX_VARS     4096     /* max variables per file */
  #define NC_MAX_NAME     128      /* max length of a name */
  #define NC_MAX_VAR_DIMS NC_MAX_DIMS /* max per variable dimensions */

and there is something similar in the Fortran include file
netcdf.inc.  In either case the maximum is 512, but if you need to
increase, this, you can just use a larger number in the include file
and recompile from source.  However any files that use more than the
maximum as distributed may not be readable by applications developed
using the smaller definition.

The NetCDF User's Guide does mention this in the second paragraph of
the introduction to the Dimensions chapter, though the C and Fortran
guides from 1997 have a lower limit from an earlier version of netCDF:

  There is a suggested limit (100) to the number of dimensions that
  can be defined in a single netCDF dataset. The limit is the value of
  the predefined macro NC_MAX_DIMS. The purpose of the limit is to
  make writing generic applications simpler. They need only provide an
  array of NC_MAX_DIMS dimensions to handle any netCDF dataset. The
  implementation of the netCDF library does not enforce this advisory
  maximum, so it is possible to use more dimensions, if necessary, but
  netCDF utilities that assume the advisory maximums may not be able
  to handle the resulting netCDF datasets.

--Russ

_____________________________________________________________________

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