NCDF_CREATE

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The NCDF_CREATE function creates a new netCDF file.

Syntax

Result = NCDF_CREATE( Filename [, /CLOBBER | , /NOCLOBBER] )

Return Value

If successful, the netCDF ID for the file is returned. The newly-created netCDF file is automatically placed into define mode. If you do not have write permission to create the specified Filename, NCDF_CREATE returns an error message instead of a netCDF file ID.

Arguments

Filename

A scalar string containing the name of the file to be created

Keywords

CLOBBER

Set this keyword to erase the existing file (if the file already exists) before creating the new version.

NOCLOBBER

Set this keyword to create a new netCDF file only if the specified file does not already exist. This is the default.

Examples

; Open a new NetCDF File and destroy test.nc if it already exists: 
id = NCDF_CREATE('test.nc',/CLOBBER) 
 
id2 = NCDF_CREATE('test.nc', /NOCLOBBER) 

This attempt to create a new version of the file test.nc produces the following error because the NOCLOBBER keyword was set:

nccreate: filename "test.nc": File exists 
% NCDF_CREATE: Operation failed 
% Execution halted at $MAIN$   (NCDF_CREATE). 

Version History

Pre 4.0

Introduced

See Also

NCDF_CLOSE, NCDF_CONTROL, NCDF_OPEN