nc_openΒΆ
nc_open opens an existing data file.
-
ncid = nc_open(ssFileName)
-
ncid = nc_open(ssFileName, nOpenMode)
Return Value
If the function succeeds, the return value is the handle of the netCDF file. If the function fails, the return value is -1.
Parameters
-
ssFileName
ssFileName is the complete file name.
-
nOpenMode
nOpenMode is:
Value Meaning NC_WRITE Opens the file for writing. NC_NOWRITE Opens the file read-only. Falls nOpenMode nicht angegeben wird, wird
NC_WRITE
verwendet.
Comment
R2012.1 New reference Counter: If a file ssFileName is opened multiple times in one process without invoking nc_close each call of nc_open will return the identical ncid. The parameter nOpenMode will be ignored if the file is already open. nc_open only returns the identical ncid if the file name ssFileName is exactly the same for all invokations.
If a process is trying to open an NC file that is already open by another process
with write mode NC_WRITE
it can only be opened in NC_NOWRITE
mode.
Write protected NC files can only be opened with NC_NOWRITE
.
Example
ncid = nc_open("d:\\dat\\test.nc", NC_NOWRITE);
if (ncid == -1) {
error();
}
...
nc_close(ncid);
History
Version | Description |
---|---|
R2012.1 (5.40.1) | Reference counter added: see comment. |
R2012 (5.40.0) | Call with only ssFileName. |
See also
id-1781578