Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: Dimensions Introduction, Up: Dimensions



4.2 NF90_DEF_DIM

The function NF90_DEF_DIM adds a new dimension to an open netCDF dataset in define mode. It returns (as an argument) a dimension ID, given the netCDF ID, the dimension name, and the dimension length. At most one unlimited length dimension, called the record dimension, may be defined for each netCDF dataset.

Usage

      function nf90_def_dim(ncid, name, len, dimid)
        integer,             intent( in) :: ncid
        character (len = *), intent( in) :: name
        integer,             intent( in) :: len
        integer,             intent(out) :: dimid
        integer                          :: nf90_def_dim
ncid
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
name
Dimension name. Must begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore ('_'). Case is significant.
len
Length of dimension; that is, number of values for this dimension as an index to variables that use it. This should be either a positive integer or the predefined constant NF90_UNLIMITED.
dimid
Returned dimension ID.

Errors

NF90_DEF_DIM returns the value NF90_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using NF90_DEF_DIM to create a dimension named lat of length 18 and a unlimited dimension named rec in a new netCDF dataset named foo.nc:

      use netcdf
      implicit none
      integer :: ncid, status, LatDimID, RecordDimID
      ...
      status = nf90_create("foo.nc", nf90_noclobber, ncid)
      if (status /= nf90_noerr) call handle_err(status)
      ...
      status = nf90_def_dim(ncid, "Lat", 18, LatDimID)
      if (status /= nf90_noerr) call handle_err(status)
      status = nf90_def_dim(ncid, "Record", nf90_unlimited, RecordDimID)
      if (status /= nf90_noerr) call handle_err(status)
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690