3.9 Create a New Group: NF90_DEF_GRP
Create a group. Its location id is returned in new_ncid.
Usage
function nf90_def_grp(parent_ncid, name, new_ncid)
integer, intent(in) :: parent_ncid
character (len = *), intent(in) :: name
integer, intent(out) :: new_ncid
integer :: nf90_def_grp
PARENT_NCID- The group id of the parent group.
NAME- The name of the new group.
NEW_NCID- The ncid of the new group will be placed there.
Errors
NF90_NOERR- No error.
NF90_EBADID- Bad group id.
NF90_ENAMEINUSE- That name is in use. Group names must be unique within a group.
NF90_EMAXNAME- Name exceed max length NF90_MAX_NAME.
NF90_EBADNAME- Name contains illegal characters.
NF90_ENOTNC4- Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4
operations can only be performed on files defined with a create mode
which includes flag HDF5. (see NF90_OPEN).
NF90_ESTRICTNC3- This file was created with the strict netcdf-3 flag, therefore
netcdf-4 operations are not allowed. (see NF90_OPEN).
NF90_EHDFERR- An error was reported by the HDF5 layer.
NF90_EPERM- Attempt to write to a read-only file.
NF90_ENOTINDEFINE- Not in define mode.
Example
C Create the netCDF file.
retval = nf90_create(file_name, NF90_NETCDF4, ncid)
if (retval .ne. nf90_noerr) call handle_err(retval)
C Create a group and a subgroup.
retval = nf90_def_grp(ncid, group_name, grpid)
if (retval .ne. nf90_noerr) call handle_err(retval)
retval = nf90_def_grp(grpid, sub_group_name, sub_grpid)
if (retval .ne. nf90_noerr) call handle_err(retval)