NetCDF  4.9.2
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: undefined 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 
const char * nc_inq_libvers(void)
Return the library version.
Definition: derror.c:27
const char * nc_strerror(int ncerr1)
Given an error number, return an error message.
Definition: derror.c:87
#define NC_EDAPURL
Malformed DAP URL.
Definition: netcdf.h:465
#define NC_ENOTINDEFINE
Operation not allowed in data mode.
Definition: netcdf.h:384
#define NC_ELATEDEF
Attempt to define var properties, like deflate, after enddef.
Definition: netcdf.h:503
#define NC_EVARSIZE
One or more variable sizes violate format constraints.
Definition: netcdf.h:449
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:429
#define NC_EDISKLESS
Error in using diskless access.
Definition: netcdf.h:509
#define NC_ERCFILE
RC file failure.
Definition: netcdf.h:514
#define NC_ENULLPAD
Header Bytes not Null-Byte padded.
Definition: netcdf.h:515
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:410
#define NC_EDDS
Malformed or inaccessible DDS.
Definition: netcdf.h:461
#define NC_EBADFIELD
Bad field ID.
Definition: netcdf.h:499
#define NC_ETYPDEFINED
Type has already been defined and may not be edited.
Definition: netcdf.h:498
#define NC_EUNLIMPOS
NC_UNLIMITED in the wrong index.
Definition: netcdf.h:412
#define NC_EDAS
Malformed or inaccessible DAS.
Definition: netcdf.h:460
#define NC_EFILTER
Filter operation failed.
Definition: netcdf.h:513
#define NC_EBADGRPID
Bad group ID.
Definition: netcdf.h:496
#define NC_ENOCOMPOUND
Not a compound type.
Definition: netcdf.h:489
#define NC_EATTEXISTS
Attribute already exists.
Definition: netcdf.h:490
#define NC_ENOTNC3
Attempting netcdf-3 operation on netcdf-4 file.
Definition: netcdf.h:493
#define NC_ENOOBJECT
Some object not found.
Definition: netcdf.h:522
#define NC_EPERM
Write to read only.
Definition: netcdf.h:379
#define NC_EDIMSCALE
Problem with HDF5 dimscales.
Definition: netcdf.h:504
#define NC_ENOTNC
Not a netcdf file.
Definition: netcdf.h:424
#define NC_EPLUGIN
Unclassified failure in accessing a dynamically loaded plugin>
Definition: netcdf.h:523
#define NC_ENOGRP
No group found.
Definition: netcdf.h:505
#define NC_ENODATA
Attempt to access variable with no data.
Definition: netcdf.h:458
#define NC_EDAPCONSTRAINT
Malformed DAP Constraint.
Definition: netcdf.h:466
#define NC_ENAMEINUSE
String match to name in use.
Definition: netcdf.h:407
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:438
#define NC_ENOTNC4
Attempting netcdf-4 operation on netcdf-3 file.
Definition: netcdf.h:491
#define NC_EEMPTY
Attempt to read empty NCZarr map key.
Definition: netcdf.h:520
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:448
#define NC_EINMEMORY
In-memory file error.
Definition: netcdf.h:516
#define NC_EDIMSIZE
Invalid dimension size.
Definition: netcdf.h:450
#define NC_ES3
Generic S3 error.
Definition: netcdf.h:519
#define NC_EDAP
Generic DAP error.
Definition: netcdf.h:455
#define NC_EINTERNAL
NetCDF Library Internal Error.
Definition: netcdf.h:474
#define NC_EAXISTYPE
Unknown axis type.
Definition: netcdf.h:452
#define NC_EINDEFINE
Operation not allowed in define mode.
Definition: netcdf.h:393
#define NC_EPNETCDF
Error at PnetCDF layer.
Definition: netcdf.h:475
#define NC_ENORECVARS
nc_rec op when there are no record vars
Definition: netcdf.h:428
#define NC_ENFILE
Too many netcdfs open.
Definition: netcdf.h:376
#define NC_EOBJECT
Some object exists when it should not.
Definition: netcdf.h:521
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:400
#define NC_ECANTREAD
Can't read.
Definition: netcdf.h:482
#define NC_ESTRICTNC3
Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
Definition: netcdf.h:492
#define NC_ESTS
In Fortran, string too short.
Definition: netcdf.h:425
#define NC_ESTORAGE
Can't specify both contiguous and chunking.
Definition: netcdf.h:506
#define NC_EPARINIT
Error initializing for parallel access.
Definition: netcdf.h:495
#define NC_EATTMETA
Problem with attribute metadata.
Definition: netcdf.h:487
#define NC_EHDFERR
Error at HDF5 layer.
Definition: netcdf.h:481
#define NC_ETRANSLATION
Untranslatable construct.
Definition: netcdf.h:467
#define NC_EMAXNAME
NC_MAX_NAME exceeded.
Definition: netcdf.h:426
#define NC_ENOTATT
Attribute not found.
Definition: netcdf.h:408
#define NC_ISSYSERR(err)
The netcdf version 3 functions all return integer error status.
Definition: netcdf.h:366
#define NC_EMAXDIMS
NC_MAX_DIMS exceeded.
Definition: netcdf.h:405
#define NC_EFILEMETA
Problem with file metadata.
Definition: netcdf.h:485
#define NC_ENOTFOUND
No such file.
Definition: netcdf.h:472
#define NC_ENCZARR
Error at NCZarr layer.
Definition: netcdf.h:518
#define NC_ENOTVAR
Variable not found.
Definition: netcdf.h:422
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:378
#define NC_NOERR
No Error.
Definition: netcdf.h:368
#define NC_EMPI
MPI operation failed.
Definition: netcdf.h:511
#define NC_EDATADDS
Malformed or inaccessible DATADDS.
Definition: netcdf.h:463
#define NC_EBADCLASS
Bad class.
Definition: netcdf.h:500
#define NC_ETRUNC
File likely truncated or possibly corrupted.
Definition: netcdf.h:451
#define NC_EDIMMETA
Problem with dimension metadata.
Definition: netcdf.h:486
#define NC_ECURL
Generic libcurl error.
Definition: netcdf.h:456
#define NC_EMAXVARS
NC_MAX_VARS exceeded.
Definition: netcdf.h:417
#define NC_EMAXATTS
NC_MAX_ATTRS exceeded - not enforced after 4.5.0.
Definition: netcdf.h:409
#define NC_ECANTEXTEND
Attempt to extend dataset during ind.
Definition: netcdf.h:510
#define NC_ECANTREMOVE
Can't remove file.
Definition: netcdf.h:473
#define NC_ENOPAR
Parallel operation on file opened for non-parallel access.
Definition: netcdf.h:494
#define NC_EIO
Generic IO error.
Definition: netcdf.h:457
#define NC_ENOTBUILT
Attempt to use feature that was not turned on when netCDF was built.
Definition: netcdf.h:508
#define NC_EBADNAME
Attribute or variable name contains illegal characters.
Definition: netcdf.h:440
#define NC_EBADCHUNK
Bad chunksize.
Definition: netcdf.h:507
#define NC_EEXIST
netcdf file exists && NC_NOCLOBBER
Definition: netcdf.h:377
#define NC_EAUTH
Authorization Failure.
Definition: netcdf.h:469
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:501
#define NC_EBADID
Not a netcdf id.
Definition: netcdf.h:375
#define NC_EGLOBAL
Action prohibited on NC_GLOBAL varid.
Definition: netcdf.h:423
#define NC_ENOFILTER
Filter not defined on variable.
Definition: netcdf.h:517
#define NC_EUNLIMIT
NC_UNLIMITED size already in use.
Definition: netcdf.h:427
#define NC_ECANTCREATE
Can't create.
Definition: netcdf.h:484
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:439
#define NC_EACCESS
Access Failure.
Definition: netcdf.h:468
#define NC_EBADTYPID
Bad type ID.
Definition: netcdf.h:497
#define NC_EDAPSVC
DAP server error.
Definition: netcdf.h:459
#define NC_EVARMETA
Problem with variable metadata.
Definition: netcdf.h:488
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:447
#define NC_EBADDIM
Invalid dimension id or name.
Definition: netcdf.h:411
#define NC_ECANTWRITE
Can't write.
Definition: netcdf.h:483
#define NC_ELATEFILL
Attempt to define fill value when data already exists.
Definition: netcdf.h:502