The function NF90_ENDDEF takes an open netCDF dataset out of define mode. The changes made to the netCDF dataset while it was in define mode are checked and committed to disk if no problems occurred. Non-record variables may be initialized to a "fill value" as well (see NF90_SET_FILL). The netCDF dataset is then placed in data mode, so variable data can be read or written.
This call may involve copying data under some circumstances. For a more extensive discussion See File Structure and Performance.
function nf90_enddef(ncid, h_minfree, v_align, v_minfree, r_align) integer, intent( in) :: ncid integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align integer :: nf90_enddef
ncid
The following arguments allow additional performance tuning. Note: these arguments expose internals of the netcdf version 1 file format, and may not be available in future netcdf implementations.
The current netcdf file format has three sections: the "header" section, the data section for fixed size variables, and the data section for variables which have an unlimited dimension (record variables). The header begins at the beginning of the file. The index (offset) of the beginning of the other two sections is contained in the header. Typically, there is no space between the sections. This causes copying overhead to accrue if one wishes to change the size of the sections, as may happen when changing the names of things, text attribute values, adding attributes or adding variables. Also, for buffered i/o, there may be advantages to aligning sections in certain ways.
h_minfree
v_minfree
v_align
r_align
NF90_ENDDEF returns the value NF90_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
Here is an example using NF90_ENDDEF to finish the definitions of a new netCDF dataset named foo.nc and put it into data mode:
use netcdf implicit none integer :: ncid, status ... status = nf90_create("foo.nc", nf90_noclobber, ncid) if (status /= nf90_noerr) call handle_err(status) ... ! create dimensions, variables, attributes status = nf90_enddef(ncid) if (status /= nf90_noerr) call handle_err(status)