Previous topic

nc_copy

Next topic

NC_CreateMeanCycleFile

This Page

nc_createΒΆ

nc_create creates a new netCDF file.

ncid = nc_create(ssFileName, nCreateMode)

Return Value

If the function succeeds, the return value is the handle of the newly created netCDF file. If the function fails, the return value is -1.

Parameters

ssFileName

ssFileName is the complete file name.

nCreateMode

nCreateMode is NC_CLOBBER or NC_NOCLOBBER.

Value Meaning
NC_CLOBBER If the file already exists, a new file will be created, erasing the old file’s contents.
NC_NOCLOBBER If the file already exists, nc_create returns -1.

The following attributes can be specified:

NC_FORMAT_CLASSIC 0x0 creates a standard netCDF data file.
NC_FORMAT_PC 0x10000 The byte order of the Intel 80x86 will be used. The created files are not compatible to the netCDF file format. The advantage of this flag is that reading and writing is much faster.
NC_FORMAT_UP 0x20000 (Default) UniPlot data file will be created.

If the UniPlot data file format is used (NC_FORMAT_UP) the following attributes can be specified:

NC_COMPRESSION 0x40000 A improved data compression is used. Reading and writing is slower, but the files are approx. 30 per cent smaller.
NC_REPACKING 0x80000 If attributes or channels are removed, the file will automatically shrink. If this flag is not set the free space will be used to new attributes and channels.

Example

ncid = nc_create("test.nc2");
ncid2 = nc_create("test2.nc2", NC_CLOBBER | NC_FORMAT_UP);

id-1641987