2.7 NF90_REDEF
The function NF90_REDEF puts an open netCDF dataset into define mode, so
dimensions, variables, and attributes can be added or renamed and
attributes can be deleted.
Usage
function nf90_redef(ncid)
integer, intent( in) :: ncid
integer :: nf90_redef
ncid- netCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.
Errors
NF90_REDEF returns the value NF90_NOERR if no errors occurred. Otherwise,
the returned status indicates an error. Possible causes of errors
include:
- The specified netCDF dataset is already in define mode.
- The specified netCDF dataset was opened for read-only.
- The specified netCDF ID does not refer to an open netCDF dataset.
Example
Here is an example using NF90_REDEF to open an existing netCDF dataset
named foo.nc and put it into define mode:
use netcdf
implicit none
integer :: ncid, status
...
status = nf90_open("foo.nc", nf90_write, ncid) ! Open dataset
if (status /= nf90_noerr) call handle_err(status)
...
status = nf90_redef(ncid) ! Put the file in define mode
if (status /= nf90_noerr) call handle_err(status)