4.5 NF_RENAME_DIM
The function NF_RENAME_DIM renames an existing dimension in a netCDF
dataset open for writing. If the new name is longer than the old name,
the netCDF dataset must be in define mode. You cannot rename a
dimension to have the same name as another dimension.
Usage
INTEGER FUNCTION NF_RENAME_DIM (INTEGER NCID, INTEGER DIMID,
CHARACTER*(*) NAME)
NCID- NetCDF ID, from a previous call to NF_OPEN or NF_CREATE.
DIMID- Dimension ID, from a previous call to NF_INQ_DIMID or NF_DEF_DIM.
NAME- New dimension name.
Errors
NF_RENAME_DIM returns the value NF_NOERR if no errors
occurred. Otherwise, the returned status indicates an error. Possible
causes of errors include:
- The new name is the name of another dimension.
- The dimension ID is invalid for the specified netCDF dataset.
- The specified netCDF ID does not refer to an open netCDF dataset.
- The new name is longer than the old name and the netCDF dataset is not
in define mode.
Example
Here is an example using NF_RENAME_DIM to rename the dimension lat to
latitude in an existing netCDF dataset named foo.nc:
INCLUDE 'netcdf.inc'
...
INTEGER STATUS, NCID, LATID
...
STATUS = NF_OPEN('foo.nc', NF_WRITE, NCID)
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
...
! put in define mode to rename dimension
STATUS = NF_REDEF(NCID)
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
STATUS = NF_INQ_DIMID(NCID, 'lat', LATID)
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
STATUS = NF_RENAME_DIM(NCID, LATID, 'latitude')
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
! leave define mode
STATUS = NF_ENDDEF(NCID)
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)