3 #include "ncException.h" 26 cerr << e.what() << endl;
33 ncCheck(nc_close(myId),__FILE__,__LINE__);
48 open(filePath, fMode);
60 ncCheck(nc_open(filePath.c_str(), NC_WRITE, &myId),__FILE__,__LINE__);
63 ncCheck(nc_open(filePath.c_str(), NC_NOWRITE, &myId),__FILE__,__LINE__);
66 ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
69 ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_CLOBBER, &myId),__FILE__,__LINE__);
81 open(filePath, fMode, fFormat);
96 format = NC_64BIT_OFFSET;
102 format = NC_NETCDF4 | NC_CLASSIC_MODEL;
108 ncCheck(nc_open(filePath.c_str(), format | NC_WRITE, &myId),__FILE__,__LINE__);
111 ncCheck(nc_open(filePath.c_str(), format | NC_NOWRITE, &myId),__FILE__,__LINE__);
114 ncCheck(nc_create(filePath.c_str(), format | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
117 ncCheck(nc_create(filePath.c_str(), format | NC_CLOBBER, &myId),__FILE__,__LINE__);
127 ncCheck(nc_sync(myId),__FILE__,__LINE__);
132 ncCheck(nc_enddef(myId),__FILE__,__LINE__);
netCDF-4/HDF5 format, classic data model
File exists, open for writing.
bool nullObject
assignment operator
void open(const std::string &filePath, FileMode fMode)
Opens a netCDF file.
64-bit offset format, classic data model
void enddef()
Leave define mode, used for classic model.
NcFile()
Constructor generates a null object.
Class represents a netCDF group.
Create new file, fail if already exists.
Classic format, classic data model.
void sync()
Synchronize an open netcdf dataset to disk.
void close()
Close a file before destructor call.
Base object is thrown if a netCDF exception is encountered.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
(default) netCDF-4/HDF5 format, enhanced data model
File exists, open read-only.
Create new file, even if already exists.