NetCDF  4.8.1
derror.c
Go to the documentation of this file.
1 
10 #include "config.h"
11 #include "ncdispatch.h"
12 #ifdef USE_PNETCDF
13 #include <pnetcdf.h> /* for ncmpi_strerror() */
14 #endif
15 
18 static const char nc_libvers[] = PACKAGE_VERSION " of "__DATE__" "__TIME__" $";
19 
26 const char *
28 {
29  return nc_libvers;
30 }
31 
87 const char *nc_strerror(int ncerr1)
88 {
89  /* System error? */
90  if(NC_ISSYSERR(ncerr1))
91  {
92  const char *cp = (const char *) strerror(ncerr1);
93  if(cp == NULL)
94  return "Unknown Error";
95  return cp;
96  }
97 
98  /* If we're here, this is a netcdf error code. */
99  switch(ncerr1)
100  {
101  case NC_NOERR:
102  return "No error";
103  case NC_EBADID:
104  return "NetCDF: Not a valid ID";
105  case NC_ENFILE:
106  return "NetCDF: Too many files open";
107  case NC_EEXIST:
108  return "NetCDF: File exists && NC_NOCLOBBER";
109  case NC_EINVAL:
110  return "NetCDF: Invalid argument";
111  case NC_EPERM:
112  return "NetCDF: Write to read only";
113  case NC_ENOTINDEFINE:
114  return "NetCDF: Operation not allowed in data mode";
115  case NC_EINDEFINE:
116  return "NetCDF: Operation not allowed in define mode";
117  case NC_EINVALCOORDS:
118  return "NetCDF: Index exceeds dimension bound";
119  case NC_EMAXDIMS:
120  return "NetCDF: NC_MAX_DIMS exceeded"; /* not enforced after 4.5.0 */
121  case NC_ENAMEINUSE:
122  return "NetCDF: String match to name in use";
123  case NC_ENOTATT:
124  return "NetCDF: Attribute not found";
125  case NC_EMAXATTS:
126  return "NetCDF: NC_MAX_ATTRS exceeded"; /* not enforced after 4.5.0 */
127  case NC_EBADTYPE:
128  return "NetCDF: Not a valid data type or _FillValue type mismatch";
129  case NC_EBADDIM:
130  return "NetCDF: Invalid dimension ID or name";
131  case NC_EUNLIMPOS:
132  return "NetCDF: NC_UNLIMITED in the wrong index";
133  case NC_EMAXVARS: return "NetCDF: NC_MAX_VARS exceeded"; /* not enforced after 4.5.0 */
134  case NC_ENOTVAR:
135  return "NetCDF: Variable not found";
136  case NC_EGLOBAL:
137  return "NetCDF: Action prohibited on NC_GLOBAL varid";
138  case NC_ENOTNC:
139  return "NetCDF: Unknown file format";
140  case NC_ESTS:
141  return "NetCDF: In Fortran, string too short";
142  case NC_EMAXNAME:
143  return "NetCDF: NC_MAX_NAME exceeded";
144  case NC_EUNLIMIT:
145  return "NetCDF: NC_UNLIMITED size already in use";
146  case NC_ENORECVARS:
147  return "NetCDF: nc_rec op when there are no record vars";
148  case NC_ECHAR:
149  return "NetCDF: Attempt to convert between text & numbers";
150  case NC_EEDGE:
151  return "NetCDF: Start+count exceeds dimension bound";
152  case NC_ESTRIDE:
153  return "NetCDF: Illegal stride";
154  case NC_EBADNAME:
155  return "NetCDF: Name contains illegal characters";
156  case NC_ERANGE:
157  return "NetCDF: Numeric conversion not representable";
158  case NC_ENOMEM:
159  return "NetCDF: Memory allocation (malloc) failure";
160  case NC_EVARSIZE:
161  return "NetCDF: One or more variable sizes violate format constraints";
162  case NC_EDIMSIZE:
163  return "NetCDF: Invalid dimension size";
164  case NC_ETRUNC:
165  return "NetCDF: File likely truncated or possibly corrupted";
166  case NC_EAXISTYPE:
167  return "NetCDF: Illegal axis type";
168  case NC_EDAP:
169  return "NetCDF: DAP failure";
170  case NC_ECURL:
171  return "NetCDF: libcurl failure";
172  case NC_EIO:
173  return "NetCDF: I/O failure";
174  case NC_ENODATA:
175  return "NetCDF: Variable has no data";
176  case NC_EDAPSVC:
177  return "NetCDF: DAP server error";
178  case NC_EDAS:
179  return "NetCDF: Malformed or inaccessible DAP DAS";
180  case NC_EDDS:
181  return "NetCDF: Malformed or inaccessible DAP2 DDS or DAP4 DMR response";
182  case NC_EDATADDS:
183  return "NetCDF: Malformed or inaccessible DAP2 DATADDS or DAP4 DAP response";
184  case NC_EDAPURL:
185  return "NetCDF: Malformed URL";
186  case NC_EDAPCONSTRAINT:
187  return "NetCDF: Malformed or unexpected Constraint";
188  case NC_ETRANSLATION:
189  return "NetCDF: Untranslatable construct";
190  case NC_EACCESS:
191  return "NetCDF: Access failure";
192  case NC_EAUTH:
193  return "NetCDF: Authorization failure";
194  case NC_ENOTFOUND:
195  return "NetCDF: file not found";
196  case NC_ECANTREMOVE:
197  return "NetCDF: cannot delete file";
198  case NC_EINTERNAL:
199  return "NetCDF: internal library error; Please contact Unidata support";
200  case NC_EPNETCDF:
201  return "NetCDF: PnetCDF error";
202  case NC_EHDFERR:
203  return "NetCDF: HDF error";
204  case NC_ECANTREAD:
205  return "NetCDF: Can't read file";
206  case NC_ECANTWRITE:
207  return "NetCDF: Can't write file";
208  case NC_ECANTCREATE:
209  return "NetCDF: Can't create file";
210  case NC_EFILEMETA:
211  return "NetCDF: Can't add HDF5 file metadata";
212  case NC_EDIMMETA:
213  return "NetCDF: Can't define dimensional metadata";
214  case NC_EATTMETA:
215  return "NetCDF: Can't open HDF5 attribute";
216  case NC_EVARMETA:
217  return "NetCDF: Problem with variable metadata.";
218  case NC_ENOCOMPOUND:
219  return "NetCDF: Can't create HDF5 compound type";
220  case NC_EATTEXISTS:
221  return "NetCDF: Attempt to create attribute that already exists";
222  case NC_ENOTNC4:
223  return "NetCDF: Attempting netcdf-4 operation on netcdf-3 file";
224  case NC_ESTRICTNC3:
225  return "NetCDF: Attempting netcdf-4 operation on strict nc3 netcdf-4 file";
226  case NC_ENOTNC3:
227  return "NetCDF: Attempting netcdf-3 operation on netcdf-4 file";
228  case NC_ENOPAR:
229  return "NetCDF: Parallel operation on file opened for non-parallel access";
230  case NC_EPARINIT:
231  return "NetCDF: Error initializing for parallel access";
232  case NC_EBADGRPID:
233  return "NetCDF: Bad group ID";
234  case NC_EBADTYPID:
235  return "NetCDF: Bad type ID";
236  case NC_ETYPDEFINED:
237  return "NetCDF: Type has already been defined and may not be edited";
238  case NC_EBADFIELD:
239  return "NetCDF: Bad field ID";
240  case NC_EBADCLASS:
241  return "NetCDF: Bad class";
242  case NC_EMAPTYPE:
243  return "NetCDF: Mapped access for atomic types only";
244  case NC_ELATEFILL:
245  return "NetCDF: Attempt to define fill value when data already exists.";
246  case NC_ELATEDEF:
247  return "NetCDF: Attempt to define var properties, like deflate, after enddef.";
248  case NC_EDIMSCALE:
249  return "NetCDF: Problem with HDF5 dimscales.";
250  case NC_ENOGRP:
251  return "NetCDF: No group found.";
252  case NC_ESTORAGE:
253  return "NetCDF: Cannot specify both contiguous and chunking.";
254  case NC_EBADCHUNK:
255  return "NetCDF: Bad chunk sizes.";
256  case NC_ENOTBUILT:
257  return "NetCDF: Attempt to use feature that was not turned on "
258  "when netCDF was built.";
259  case NC_EDISKLESS:
260  return "NetCDF: Error in using diskless access";
261  case NC_EFILTER:
262  return "NetCDF: Filter error: bad id or parameters or duplicate filter";
263  case NC_ENOFILTER:
264  return "NetCDF: Filter error: unimplemented filter encountered";
265  case NC_ECANTEXTEND:
266  return "NetCDF: Attempt to extend dataset during NC_INDEPENDENT I/O operation. Use nc_var_par_access to set mode NC_COLLECTIVE before extending variable.";
267  case NC_EMPI: return "NetCDF: MPI operation failed.";
268  case NC_ERCFILE:
269  return "NetCDF: RC File Failure.";
270  case NC_ENULLPAD:
271  return "NetCDF: File fails strict Null-Byte Header check.";
272  case NC_EINMEMORY:
273  return "NetCDF: In-memory File operation failed.";
274  case NC_ENCZARR:
275  return "NetCDF: NCZarr error";
276  case NC_ES3:
277  return "NetCDF: AWS S3 error";
278  case NC_EEMPTY:
279  return "NetCDF: Attempt to read empty NCZarr map key";
280  case NC_EOBJECT:
281  return "NetCDF: Some object exists when it should not";
282  case NC_ENOOBJECT:
283  return "NetCDF: Some object not found";
284  case NC_EPLUGIN:
285  return "NetCDF: Unclassified failure in accessing a dynamically loaded plugin";
286  default:
287 #ifdef USE_PNETCDF
288  /* The behavior of ncmpi_strerror here is to return
289  NULL, not a string. This causes problems in (at least)
290  the fortran interface. */
291  return (ncmpi_strerror(ncerr1) ?
292  ncmpi_strerror(ncerr1) :
293  "Unknown Error");
294 #else
295  return "Unknown Error";
296 #endif
297  }
298 }
299 
NC_NOERR
#define NC_NOERR
No Error.
Definition: netcdf.h:333
NC_EINVAL
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:343
NC_EDAPCONSTRAINT
#define NC_EDAPCONSTRAINT
Malformed DAP Constraint.
Definition: netcdf.h:431
NC_EBADFIELD
#define NC_EBADFIELD
Bad field ID.
Definition: netcdf.h:464
NC_EGLOBAL
#define NC_EGLOBAL
Action prohibited on NC_GLOBAL varid.
Definition: netcdf.h:388
NC_ETYPDEFINED
#define NC_ETYPDEFINED
Type has already been defined and may not be edited.
Definition: netcdf.h:463
NC_ENOGRP
#define NC_ENOGRP
No group found.
Definition: netcdf.h:470
NC_EUNLIMPOS
#define NC_EUNLIMPOS
NC_UNLIMITED in the wrong index.
Definition: netcdf.h:377
NC_ESTORAGE
#define NC_ESTORAGE
Can't specify both contiguous and chunking.
Definition: netcdf.h:471
NC_EACCESS
#define NC_EACCESS
Access Failure.
Definition: netcdf.h:433
NC_EBADTYPID
#define NC_EBADTYPID
Bad type ID.
Definition: netcdf.h:462
NC_ECURL
#define NC_ECURL
Generic libcurl error.
Definition: netcdf.h:421
NC_EEDGE
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:403
NC_EDATADDS
#define NC_EDATADDS
Malformed or inaccessible DATADDS.
Definition: netcdf.h:428
NC_ENOFILTER
#define NC_ENOFILTER
Filter not defined on variable.
Definition: netcdf.h:482
NC_ENODATA
#define NC_ENODATA
Attempt to access variable with no data.
Definition: netcdf.h:423
NC_EPARINIT
#define NC_EPARINIT
Error initializing for parallel access.
Definition: netcdf.h:460
NC_ESTS
#define NC_ESTS
In Fortran, string too short.
Definition: netcdf.h:390
NC_ENAMEINUSE
#define NC_ENAMEINUSE
String match to name in use.
Definition: netcdf.h:372
NC_EFILTER
#define NC_EFILTER
Filter operation failed.
Definition: netcdf.h:478
NC_EDAPSVC
#define NC_EDAPSVC
DAP server error.
Definition: netcdf.h:424
NC_EPLUGIN
#define NC_EPLUGIN
Unclassified failure in accessing a dynamically loaded plugin>
Definition: netcdf.h:488
NC_ENOTNC4
#define NC_ENOTNC4
Attempting netcdf-4 operation on netcdf-3 file.
Definition: netcdf.h:456
NC_EMPI
#define NC_EMPI
MPI operation failed.
Definition: netcdf.h:476
NC_ECANTWRITE
#define NC_ECANTWRITE
Can't write.
Definition: netcdf.h:448
NC_ES3
#define NC_ES3
Generic S3 error.
Definition: netcdf.h:484
NC_ENOTFOUND
#define NC_ENOTFOUND
No such file.
Definition: netcdf.h:437
NC_EHDFERR
#define NC_EHDFERR
Error at HDF5 layer.
Definition: netcdf.h:446
NC_EPNETCDF
#define NC_EPNETCDF
Error at PnetCDF layer.
Definition: netcdf.h:440
NC_ENOPAR
#define NC_ENOPAR
Parallel operation on file opened for non-parallel access.
Definition: netcdf.h:459
NC_EMAPTYPE
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:466
NC_EDIMSCALE
#define NC_EDIMSCALE
Problem with HDF5 dimscales.
Definition: netcdf.h:469
NC_ERANGE
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:412
NC_EMAXNAME
#define NC_EMAXNAME
NC_MAX_NAME exceeded.
Definition: netcdf.h:391
NC_EINMEMORY
#define NC_EINMEMORY
In-memory file error.
Definition: netcdf.h:481
NC_ENULLPAD
#define NC_ENULLPAD
Header Bytes not Null-Byte padded.
Definition: netcdf.h:480
NC_EEMPTY
#define NC_EEMPTY
Attempt to read empty NCZarr map key.
Definition: netcdf.h:485
NC_ESTRICTNC3
#define NC_ESTRICTNC3
Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
Definition: netcdf.h:457
NC_ENOTNC3
#define NC_ENOTNC3
Attempting netcdf-3 operation on netcdf-4 file.
Definition: netcdf.h:458
NC_ECANTEXTEND
#define NC_ECANTEXTEND
Attempt to extend dataset during ind.
Definition: netcdf.h:475
NC_ENORECVARS
#define NC_ENORECVARS
nc_rec op when there are no record vars
Definition: netcdf.h:393
NC_EBADCHUNK
#define NC_EBADCHUNK
Bad chunksize.
Definition: netcdf.h:472
NC_EATTEXISTS
#define NC_EATTEXISTS
Attribute already exists.
Definition: netcdf.h:455
nc_inq_libvers
const char * nc_inq_libvers(void)
Return the library version.
Definition: derror.c:27
NC_EPERM
#define NC_EPERM
Write to read only.
Definition: netcdf.h:344
NC_EDAS
#define NC_EDAS
Malformed or inaccessible DAS.
Definition: netcdf.h:425
NC_ENOTATT
#define NC_ENOTATT
Attribute not found.
Definition: netcdf.h:373
NC_EVARMETA
#define NC_EVARMETA
Problem with variable metadata.
Definition: netcdf.h:453
NC_EEXIST
#define NC_EEXIST
netcdf file exists && NC_NOCLOBBER
Definition: netcdf.h:342
NC_ECANTREAD
#define NC_ECANTREAD
Can't read.
Definition: netcdf.h:447
NC_EVARSIZE
#define NC_EVARSIZE
One or more variable sizes violate format constraints.
Definition: netcdf.h:414
NC_EDAPURL
#define NC_EDAPURL
Malformed DAP URL.
Definition: netcdf.h:430
NC_ENCZARR
#define NC_ENCZARR
Error at NCZarr layer.
Definition: netcdf.h:483
NC_EDISKLESS
#define NC_EDISKLESS
Error in using diskless access.
Definition: netcdf.h:474
NC_EIO
#define NC_EIO
Generic IO error.
Definition: netcdf.h:422
NC_ENOTBUILT
#define NC_ENOTBUILT
Attempt to use feature that was not turned on when netCDF was built.
Definition: netcdf.h:473
NC_ELATEDEF
#define NC_ELATEDEF
Attempt to define var properties, like deflate, after enddef.
Definition: netcdf.h:468
NC_EBADTYPE
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:375
NC_EMAXVARS
#define NC_EMAXVARS
NC_MAX_VARS exceeded.
Definition: netcdf.h:382
NC_ENFILE
#define NC_ENFILE
Too many netcdfs open.
Definition: netcdf.h:341
NC_ECHAR
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:394
NC_EINDEFINE
#define NC_EINDEFINE
Operation not allowed in define mode.
Definition: netcdf.h:358
NC_ENOCOMPOUND
#define NC_ENOCOMPOUND
Not a compound type.
Definition: netcdf.h:454
NC_ENOTNC
#define NC_ENOTNC
Not a netcdf file.
Definition: netcdf.h:389
NC_EINVALCOORDS
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:365
NC_EAXISTYPE
#define NC_EAXISTYPE
Unknown axis type.
Definition: netcdf.h:417
NC_ENOMEM
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:413
NC_ECANTREMOVE
#define NC_ECANTREMOVE
Can't remove file.
Definition: netcdf.h:438
NC_EATTMETA
#define NC_EATTMETA
Problem with attribute metadata.
Definition: netcdf.h:452
NC_EDIMMETA
#define NC_EDIMMETA
Problem with dimension metadata.
Definition: netcdf.h:451
nc_strerror
const char * nc_strerror(int ncerr1)
Given an error number, return an error message.
Definition: derror.c:87
NC_ELATEFILL
#define NC_ELATEFILL
Attempt to define fill value when data already exists.
Definition: netcdf.h:467
NC_EDDS
#define NC_EDDS
Malformed or inaccessible DDS.
Definition: netcdf.h:426
NC_EINTERNAL
#define NC_EINTERNAL
NetCDF Library Internal Error.
Definition: netcdf.h:439
NC_ENOTINDEFINE
#define NC_ENOTINDEFINE
Operation not allowed in data mode.
Definition: netcdf.h:349
NC_EDIMSIZE
#define NC_EDIMSIZE
Invalid dimension size.
Definition: netcdf.h:415
NC_EMAXATTS
#define NC_EMAXATTS
NC_MAX_ATTRS exceeded - not enforced after 4.5.0.
Definition: netcdf.h:374
NC_EBADGRPID
#define NC_EBADGRPID
Bad group ID.
Definition: netcdf.h:461
NC_EUNLIMIT
#define NC_EUNLIMIT
NC_UNLIMITED size already in use.
Definition: netcdf.h:392
NC_EBADCLASS
#define NC_EBADCLASS
Bad class.
Definition: netcdf.h:465
NC_EMAXDIMS
#define NC_EMAXDIMS
NC_MAX_DIMS exceeded.
Definition: netcdf.h:370
NC_ECANTCREATE
#define NC_ECANTCREATE
Can't create.
Definition: netcdf.h:449
NC_ESTRIDE
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:404
NC_ISSYSERR
#define NC_ISSYSERR(err)
The netcdf version 3 functions all return integer error status.
Definition: netcdf.h:331
NC_EBADID
#define NC_EBADID
Not a netcdf id.
Definition: netcdf.h:340
NC_EBADDIM
#define NC_EBADDIM
Invalid dimension id or name.
Definition: netcdf.h:376
NC_ENOOBJECT
#define NC_ENOOBJECT
Some object not found.
Definition: netcdf.h:487
NC_EFILEMETA
#define NC_EFILEMETA
Problem with file metadata.
Definition: netcdf.h:450
NC_EAUTH
#define NC_EAUTH
Authorization Failure.
Definition: netcdf.h:434
NC_ETRUNC
#define NC_ETRUNC
File likely truncated or possibly corrupted.
Definition: netcdf.h:416
NC_ERCFILE
#define NC_ERCFILE
RC file failure.
Definition: netcdf.h:479
NC_EOBJECT
#define NC_EOBJECT
Some object exists when it should not.
Definition: netcdf.h:486
NC_EDAP
#define NC_EDAP
Generic DAP error.
Definition: netcdf.h:420
NC_ENOTVAR
#define NC_ENOTVAR
Variable not found.
Definition: netcdf.h:387
NC_ETRANSLATION
#define NC_ETRANSLATION
Untranslatable construct.
Definition: netcdf.h:432
NC_EBADNAME
#define NC_EBADNAME
Attribute or variable name contains illegal characters.
Definition: netcdf.h:405