NetCDF  4.4.1.1
 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 
15 /* Tell the user the version of netCDF. */
16 static const char nc_libvers[] = PACKAGE_VERSION " of "__DATE__" "__TIME__" $";
17 
27 const char *
28 nc_inq_libvers(void)
29 {
30  return nc_libvers;
31 }
32 
88 const char *nc_strerror(int ncerr1)
89 {
90  /* System error? */
91  if(NC_ISSYSERR(ncerr1))
92  {
93  const char *cp = (const char *) strerror(ncerr1);
94  if(cp == NULL)
95  return "Unknown Error";
96  return cp;
97  }
98 
99  /* If we're here, this is a netcdf error code. */
100  switch(ncerr1)
101  {
102  case NC_NOERR:
103  return "No error";
104  case NC_EBADID:
105  return "NetCDF: Not a valid ID";
106  case NC_ENFILE:
107  return "NetCDF: Too many files open";
108  case NC_EEXIST:
109  return "NetCDF: File exists && NC_NOCLOBBER";
110  case NC_EINVAL:
111  return "NetCDF: Invalid argument";
112  case NC_EPERM:
113  return "NetCDF: Write to read only";
114  case NC_ENOTINDEFINE:
115  return "NetCDF: Operation not allowed in data mode";
116  case NC_EINDEFINE:
117  return "NetCDF: Operation not allowed in define mode";
118  case NC_EINVALCOORDS:
119  return "NetCDF: Index exceeds dimension bound";
120  case NC_EMAXDIMS:
121  return "NetCDF: NC_MAX_DIMS exceeded";
122  case NC_ENAMEINUSE:
123  return "NetCDF: String match to name in use";
124  case NC_ENOTATT:
125  return "NetCDF: Attribute not found";
126  case NC_EMAXATTS:
127  return "NetCDF: NC_MAX_ATTRS exceeded";
128  case NC_EBADTYPE:
129  return "NetCDF: Not a valid data type or _FillValue type mismatch";
130  case NC_EBADDIM:
131  return "NetCDF: Invalid dimension ID or name";
132  case NC_EUNLIMPOS:
133  return "NetCDF: NC_UNLIMITED in the wrong index";
134  case NC_EMAXVARS:
135  return "NetCDF: NC_MAX_VARS exceeded";
136  case NC_ENOTVAR:
137  return "NetCDF: Variable not found";
138  case NC_EGLOBAL:
139  return "NetCDF: Action prohibited on NC_GLOBAL varid";
140  case NC_ENOTNC:
141  return "NetCDF: Unknown file format";
142  case NC_ESTS:
143  return "NetCDF: In Fortran, string too short";
144  case NC_EMAXNAME:
145  return "NetCDF: NC_MAX_NAME exceeded";
146  case NC_EUNLIMIT:
147  return "NetCDF: NC_UNLIMITED size already in use";
148  case NC_ENORECVARS:
149  return "NetCDF: nc_rec op when there are no record vars";
150  case NC_ECHAR:
151  return "NetCDF: Attempt to convert between text & numbers";
152  case NC_EEDGE:
153  return "NetCDF: Start+count exceeds dimension bound";
154  case NC_ESTRIDE:
155  return "NetCDF: Illegal stride";
156  case NC_EBADNAME:
157  return "NetCDF: Name contains illegal characters";
158  case NC_ERANGE:
159  return "NetCDF: Numeric conversion not representable";
160  case NC_ENOMEM:
161  return "NetCDF: Memory allocation (malloc) failure";
162  case NC_EVARSIZE:
163  return "NetCDF: One or more variable sizes violate format constraints";
164  case NC_EDIMSIZE:
165  return "NetCDF: Invalid dimension size";
166  case NC_ETRUNC:
167  return "NetCDF: File likely truncated or possibly corrupted";
168  case NC_EAXISTYPE:
169  return "NetCDF: Illegal axis type";
170  case NC_EDAP:
171  return "NetCDF: DAP failure";
172  case NC_ECURL:
173  return "NetCDF: libcurl failure";
174  case NC_EIO:
175  return "NetCDF: I/O failure";
176  case NC_ENODATA:
177  return "NetCDF: Variable has no data in DAP request";
178  case NC_EDAPSVC:
179  return "NetCDF: DAP server error";
180  case NC_EDAS:
181  return "NetCDF: Malformed or inaccessible DAP DAS";
182  case NC_EDDS:
183  return "NetCDF: Malformed or inaccessible DAP DDS";
184  case NC_EDATADDS:
185  return "NetCDF: Malformed or inaccessible DAP DATADDS";
186  case NC_EDAPURL:
187  return "NetCDF: Malformed URL";
188  case NC_EDAPCONSTRAINT:
189  return "NetCDF: Malformed or unexpected Constraint";
190  case NC_ETRANSLATION:
191  return "NetCDF: Untranslatable construct";
192  case NC_EACCESS:
193  return "NetCDF: Access failure";
194  case NC_EAUTH:
195  return "NetCDF: Authorization failure";
196  case NC_ENOTFOUND:
197  return "NetCDF: file not found";
198  case NC_ECANTEXTEND:
199  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.";
200  case NC_ECANTREMOVE:
201  return "NetCDF: cannot delete file";
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 alread 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: Probem 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  default:
262 #ifdef USE_PNETCDF
263  /* The behavior of ncmpi_strerror here is to return
264  NULL, not a string. This causes problems in (at least)
265  the fortran interface. */
266  return (ncmpi_strerror(ncerr1) ?
267  ncmpi_strerror(ncerr1) :
268  "Unknown Error");
269 #else
270  return "Unknown Error";
271 #endif
272  }
273 }
274 
#define NC_ENOMEM
Memory allocation (malloc) failure.
Definition: netcdf.h:395
#define NC_ENOTNC4
Attempting netcdf-4 operation on netcdf-3 file.
Definition: netcdf.h:436
#define NC_ECANTWRITE
Can't write.
Definition: netcdf.h:428
#define NC_ENOTNC3
Attempting netcdf-3 operation on netcdf-4 file.
Definition: netcdf.h:440
#define NC_ECANTCREATE
Can't create.
Definition: netcdf.h:429
#define NC_ENFILE
Too many netcdfs open.
Definition: netcdf.h:323
#define NC_ESTS
In Fortran, string too short.
Definition: netcdf.h:372
#define NC_EUNLIMIT
NC_UNLIMITED size already in use.
Definition: netcdf.h:374
#define NC_EMAPTYPE
Mapped access for atomic types only.
Definition: netcdf.h:448
#define NC_EDIMSCALE
Problem with HDF5 dimscales.
Definition: netcdf.h:451
#define NC_ERANGE
Math result not representable.
Definition: netcdf.h:394
#define NC_EMAXATTS
NC_MAX_ATTRS exceeded.
Definition: netcdf.h:356
#define NC_EHDFERR
Error at HDF5 layer.
Definition: netcdf.h:426
#define NC_EINVALCOORDS
Index exceeds dimension bound.
Definition: netcdf.h:347
#define NC_EMAXVARS
NC_MAX_VARS exceeded.
Definition: netcdf.h:364
#define NC_ELATEFILL
Attempt to define fill value when data already exists.
Definition: netcdf.h:449
#define NC_ENOTINDEFINE
Operation not allowed in data mode.
Definition: netcdf.h:331
#define NC_ECANTEXTEND
Attempt to extend dataset during ind.
Definition: netcdf.h:457
#define NC_EATTEXISTS
Attribute already exists.
Definition: netcdf.h:435
#define NC_EAXISTYPE
Unknown axis type.
Definition: netcdf.h:399
#define NC_EBADCLASS
Bad class.
Definition: netcdf.h:447
#define NC_EMAXDIMS
NC_MAX_DIMS exceeded.
Definition: netcdf.h:352
#define NC_EBADDIM
Invalid dimension id or name.
Definition: netcdf.h:358
#define NC_EINDEFINE
Operation not allowed in define mode.
Definition: netcdf.h:340
#define NC_EDIMSIZE
Invalid dimension size.
Definition: netcdf.h:397
#define NC_EBADFIELD
Bad field ID.
Definition: netcdf.h:446
#define NC_ENOTNC
Not a netcdf file.
Definition: netcdf.h:371
#define NC_EIO
Generic IO error.
Definition: netcdf.h:404
#define NC_ENOTBUILT
Attempt to use feature that was not turned on when netCDF was built.
Definition: netcdf.h:455
#define NC_ENAMEINUSE
String match to name in use.
Definition: netcdf.h:354
#define NC_EACCESS
Access Failure.
Definition: netcdf.h:413
#define NC_ECURL
Generic libcurl error.
Definition: netcdf.h:403
#define NC_ENOGRP
No group found.
Definition: netcdf.h:452
#define NC_ETRANSLATION
Untranslatable construct.
Definition: netcdf.h:412
#define NC_EDAPURL
Malformed DAP URL.
Definition: netcdf.h:410
#define NC_EDAPSVC
DAP server error.
Definition: netcdf.h:406
#define NC_EATTMETA
Problem with attribute metadata.
Definition: netcdf.h:432
#define NC_EDDS
Malformed or inaccessible DDS.
Definition: netcdf.h:408
#define NC_EDISKLESS
Error in using diskless access.
Definition: netcdf.h:456
#define NC_ENOCOMPOUND
Not a compound type.
Definition: netcdf.h:434
#define NC_EFILEMETA
Problem with file metadata.
Definition: netcdf.h:430
#define NC_ETYPDEFINED
Type has already been defined and may not be edited.
Definition: netcdf.h:445
#define NC_EGLOBAL
Action prohibited on NC_GLOBAL varid.
Definition: netcdf.h:370
#define NC_ETRUNC
File likely truncated or possibly corrupted.
Definition: netcdf.h:398
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:357
#define NC_EBADNAME
Attribute or variable name contains illegal characters.
Definition: netcdf.h:387
#define NC_EEDGE
Start+count exceeds dimension bound.
Definition: netcdf.h:385
#define NC_EDIMMETA
Problem with dimension metadata.
Definition: netcdf.h:431
#define NC_ENODATA
Attempt to access variable with no data.
Definition: netcdf.h:405
#define NC_ESTRIDE
Illegal stride.
Definition: netcdf.h:386
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:325
#define NC_ESTRICTNC3
Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
Definition: netcdf.h:439
#define NC_EBADGRPID
Bad group ID.
Definition: netcdf.h:443
#define NC_ECANTREMOVE
Can't remove file.
Definition: netcdf.h:418
#define NC_EBADTYPID
Bad type ID.
Definition: netcdf.h:444
#define NC_EUNLIMPOS
NC_UNLIMITED in the wrong index.
Definition: netcdf.h:359
#define NC_ISSYSERR(err)
The netcdf version 3 functions all return integer error status.
Definition: netcdf.h:313
#define NC_EPARINIT
Error initializing for parallel access.
Definition: netcdf.h:442
#define NC_EEXIST
netcdf file exists && NC_NOCLOBBER
Definition: netcdf.h:324
#define NC_EDAP
Generic DAP error.
Definition: netcdf.h:402
#define NC_ENORECVARS
nc_rec op when there are no record vars
Definition: netcdf.h:375
#define NC_EBADID
Not a netcdf id.
Definition: netcdf.h:322
#define NC_ENOPAR
Parallel operation on file opened for non-parallel access.
Definition: netcdf.h:441
#define NC_EVARSIZE
One or more variable sizes violate format constraints.
Definition: netcdf.h:396
#define NC_EVARMETA
Problem with variable metadata.
Definition: netcdf.h:433
#define NC_ESTORAGE
Can't specify both contiguous and chunking.
Definition: netcdf.h:453
#define NC_EAUTH
Authorization Failure.
Definition: netcdf.h:414
#define NC_ENOTVAR
Variable not found.
Definition: netcdf.h:369
#define NC_ECANTREAD
Can't read.
Definition: netcdf.h:427
#define NC_EMAXNAME
NC_MAX_NAME exceeded.
Definition: netcdf.h:373
#define NC_EPERM
Write to read only.
Definition: netcdf.h:326
#define NC_EDAS
Malformed or inaccessible DAS.
Definition: netcdf.h:407
#define NC_NOERR
No Error.
Definition: netcdf.h:315
#define NC_EDAPCONSTRAINT
Malformed DAP Constraint.
Definition: netcdf.h:411
#define NC_ECHAR
Attempt to convert between text & numbers.
Definition: netcdf.h:376
#define NC_ENOTFOUND
No such file.
Definition: netcdf.h:417
const char * nc_strerror(int ncerr1)
Given an error number, return an error message.
Definition: derror.c:88
#define NC_EDATADDS
Malformed or inaccessible DATADDS.
Definition: netcdf.h:409
#define NC_ELATEDEF
Attempt to define var properties, like deflate, after enddef.
Definition: netcdf.h:450
#define NC_ENOTATT
Attribute not found.
Definition: netcdf.h:355
#define NC_EBADCHUNK
Bad chunksize.
Definition: netcdf.h:454

Return to the Main Unidata NetCDF page.
Generated on Fri Dec 16 2016 12:39:53 for NetCDF. NetCDF is a Unidata library.