3 #include <ncException.h> 11 void ncCheck(
int retCode,
const char* file,
int line){
12 if (retCode==NC_NOERR)
16 if (NC_ISSYSERR(retCode)){
17 msg = std::strerror(retCode);
18 msg = msg ? msg :
"Unknown system error";
20 msg = nc_strerror(retCode);
24 case NC_EBADID :
throw NcBadId(msg,file,line);
25 case NC_ENFILE :
throw NcNFile(msg,file,line);
26 case NC_EEXIST :
throw NcExist(msg,file,line);
32 case NC_EMAXDIMS :
throw NcMaxDims(msg,file,line);
33 case NC_ENAMEINUSE :
throw NcNameInUse(msg,file,line);
34 case NC_ENOTATT :
throw NcNotAtt(msg,file,line);
35 case NC_EMAXATTS :
throw NcMaxAtts(msg,file,line);
36 case NC_EBADTYPE :
throw NcBadType(msg,file,line);
37 case NC_EBADDIM :
throw NcBadDim(msg,file,line);
38 case NC_EUNLIMPOS :
throw NcUnlimPos(msg,file,line);
39 case NC_EMAXVARS :
throw NcMaxVars(msg,file,line);
40 case NC_ENOTVAR :
throw NcNotVar(msg,file,line);
41 case NC_EGLOBAL :
throw NcGlobal(msg,file,line);
42 case NC_ENOTNC :
throw NcNotNCF(msg,file,line);
43 case NC_ESTS :
throw NcSts(msg,file,line);
44 case NC_EMAXNAME :
throw NcMaxName(msg,file,line);
45 case NC_EUNLIMIT :
throw NcUnlimit(msg,file,line);
46 case NC_ENORECVARS :
throw NcNoRecVars(msg,file,line);
47 case NC_ECHAR :
throw NcChar(msg,file,line);
48 case NC_EEDGE :
throw NcEdge(msg,file,line);
49 case NC_ESTRIDE :
throw NcStride(msg,file,line);
50 case NC_EBADNAME :
throw NcBadName(msg,file,line);
51 case NC_ERANGE :
throw NcRange(msg,file,line);
52 case NC_ENOMEM :
throw NcNoMem(msg,file,line);
53 case NC_EVARSIZE :
throw NcVarSize(msg,file,line);
54 case NC_EDIMSIZE :
throw NcDimSize(msg,file,line);
55 case NC_ETRUNC :
throw NcTrunc(msg,file,line);
58 case NC_EHDFERR :
throw NcHdfErr(msg,file,line);
59 case NC_ECANTREAD :
throw NcCantRead(msg,file,line);
60 case NC_ECANTWRITE :
throw NcCantWrite(msg,file,line);
62 case NC_EFILEMETA :
throw NcFileMeta(msg,file,line);
63 case NC_EDIMMETA :
throw NcDimMeta(msg,file,line);
64 case NC_EATTMETA :
throw NcAttMeta(msg,file,line);
65 case NC_EVARMETA :
throw NcVarMeta(msg,file,line);
67 case NC_EATTEXISTS :
throw NcAttExists(msg,file,line);
68 case NC_ENOTNC4 :
throw NcNotNc4(msg,file,line);
69 case NC_ESTRICTNC3 :
throw NcStrictNc3(msg,file,line);
71 case NC_EBADTYPID :
throw NcBadTypeId(msg,file,line);
75 case NC_ENOGRP :
throw NcEnoGrp(msg,file,line);
76 case NC_ELATEDEF :
throw NcElateDef(msg,file,line);
85 int status = nc_redef(ncid);
86 if (status != NC_EINDEFINE)
ncCheck(status, __FILE__, __LINE__);
91 int status = nc_enddef(ncid);
92 if (status != NC_ENOTINDEFINE)
ncCheck(status, __FILE__, __LINE__);
Thrown if NC_MAX_DIMS is exceeded.
Class represents a netCDF atomic Char type.
Thrown if NC_UNLIMITED size is already in use.
Thrown if attempting netcdf-4 operation on strict nc3 netcdf-4 file.
Thrown if cannot return a netCDF group.
Thrown if, having set NC_NOCLOBBER, the specified dataset already exists.
Thrown if invalid dimension size.
Thrown if operation not allowed in data mode.
Thrown if one or more variable sizes violate format constraints.
Thrown if not a netCDF file.
Thrown if the action is prohibited on the NC_GLOBAL varid.
Thrown if in FORTRAN, string is too short.
Thrown if attempting netcdf-4 operation on netcdf-3 file.
Thrown if not a valid netCDF data type.
Thrown if string match to name is in use.
Thrown if NC_MAX_VARS is exceeded.
Thrown if attribute is not found.
Thrown if the specified netCDF ID does not refer to an open netCDF dataset.
Thrown if not a netCDF id.
Thrown if an error was reported by the HDF5 layer.
Thrown if too many netcdf files are open.
Thrown if edge+start exceeds dimension bound.
Thrown if memory allocation (malloc) failure.
Thrown if operation not allowed in defined mode.
Base object is thrown if a netCDF exception is encountered.
Thrown if illegal stride.
void ncCheckDataMode(int ncid)
Function checks if the file (group) is in data mode.
Thrown if NC_MAX_NAME is exceeded.
void ncCheck(int retCode, const char *file, int line)
Function checks error code and if necessary throws an exception.
Index exceeds dimension bound.
Thrown if Nc_MAX_ATTRS is exceeded.
Thrown if an operation to set the chunking, endianness, fill of a NcVar object is issued after a call...
void ncCheckDefineMode(int ncid)
Function checks if the file (group) is in define mode.
Thrown if attribute exists.
Thrown if math result not representable.
Thrown if file likely truncated or possibly corrupted.
Thrown if Nc_UNLIMITED is in the wrong index.
Thrown if nc_rec op when there are no record vars.
Thrown if invalid argument.
Thrown if attribute or variable name contains illegal characters.
Thrown if variable is not found.
Thrown if an invalid dimension id or name.