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

Return to the Main Unidata NetCDF page.
Generated on Sat Apr 6 2019 08:19:00 for NetCDF. NetCDF is a Unidata library.