MISR Toolkit  1.5.1
hdf4_netcdf.h
Go to the documentation of this file.
1 /* Generated automatically from netcdf.h.in by configure. */
2 /*
3  * Copyright 1993, University Corporation for Atmospheric Research
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation for any purpose without fee is hereby granted, provided
7  * that the above copyright notice appear in all copies, that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of UCAR/Unidata not be used in
10  * advertising or publicity pertaining to distribution of the software
11  * without specific, written prior permission. UCAR makes no
12  * representations about the suitability of this software for any purpose.
13  * It is provided "as is" without express or implied warranty. It is
14  * provided with no support and without obligation on the part of UCAR
15  * Unidata, to assist in its use, correction, modification, or enhancement.
16  *
17  */
18 /* "$Id$" */
19 
20 #ifndef _NETCDF_
21 #define _NETCDF_
22 
23 #include "H4api_adpt.h"
24 
25 /*
26  * The definitions ncvoid, USE_ENUM, and MAX_NC_OPEN, may need to be set
27  * properly for your installation.
28  */
29 
30 /*
31  * Argument type in user functions (deprecated, backward compatibility)
32  */
33 #ifndef UD_NO_VOID
34 #define ncvoid void
35 #else
36 /* system doesn't have void type */
37 #define ncvoid char
38 #endif
39 
40 
41 /*
42  * If xdr_enum works properly on your system, you can define
43  * USE_ENUM so that nc_type is an enum.
44  * Otherwise, delete this definition so that the nc_type is
45  * an int and the valid values are #defined.
46  */
47 #ifndef __APPLE__
48 /* xdr_enum does not work properly for Mac Lion using the Apple GCC compiler
49 i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
50  */
51 /* Do not use it for all Macs for now. See ticket HDFFR-1318. */
52 /* So define USE_ENUM only if this is not an APPLE. */
53 #define USE_ENUM
54 #endif
55 
56 
57 /*
58  * The following macro is provided for backward compatibility only. If you
59  * are a new user of netCDF, then you may safely ignore it. If, however,
60  * you have an existing archive of netCDF files that use default
61  * floating-point fill values, then you should know that the definition of
62  * the default floating-point fill values changed with version 2.3 of the
63  * netCDF package. Prior to this release, the default floating-point fill
64  * values were not very portable: their correct behavior depended not only
65  * upon the particular platform, but also upon the compilation
66  * environment. This led to the definition of new, default floating-point
67  * fill values that are portable across all platforms and compilation
68  * environments. If you wish, however, to obtain the old, non-portable
69  * floating-point fill values, then the following macro should have a true
70  * value PRIOR TO BUILDING THE netCDF LIBRARY.
71  *
72  * Implementation details are contained in the section below on fill values.
73  */
74 #define NC_OLD_FILLVALUES 0
75 
76 /*
77  * Fill values
78  * These values are stuffed into newly allocated space as appropriate.
79  * The hope is that one might use these to notice that a particular datum
80  * has not been set.
81  */
82 
83 #define FILL_BYTE ((char)-127) /* Largest Negative value */
84 #define FILL_CHAR ((char)0)
85 #define FILL_SHORT ((short)-32767)
86 #define FILL_LONG ((long)-2147483647)
87 
88 #if !NC_OLD_FILLVALUES
89 
90 # define FILL_FLOAT 9.9692099683868690e+36 /* near 15 * 2^119 */
91 # define FILL_DOUBLE 9.9692099683868690e+36
92 
93 #else /* NC_OLD_FILLVALUES below */
94 
95 /*
96  * This section is provided for backward compatibility only. Using
97  * XDR infinities for floating-point fill values has caused more problems
98  * than it has solved. We encourage you to define your own data-specific
99  * fill values rather than use default ones (see `_FillValue' below).
100  * If, however, you *must* use default fill values, then you should use
101  * the above fill values rather than the ones in this section.
102  */
103 
104 /*
105  * XDR_F_INFINITY is a float value whose EXTERNAL (xdr)
106  * represention is ieee floating infinity.
107  * XDR_D_INFINITY is a double value whose EXTERNAL (xdr)
108  * represention is ieee double floating point infinity.
109  * These are used as default fill values below.
110  *
111  * This section shows three techniques for setting these:
112  * Direct assignment (vax, cray) - works for non IEEE machines
113  * Doesn't work when IEEE machines don't allow
114  * float or double constants whose values are infinity.
115  * Use of a union (preferred portable method) - should work on
116  * any ANSI compiler with IEEE floating point representations,
117  * modulo byte order and sizeof() considerations.
118  * Use of pointer puns - may work with many older compilers
119  * which don't allow intialization of unions.
120  * Often doesn't work with compilers which have strict
121  * alignment rules.
122  */
123 
124  /* Direct assignment. All cases should be mutually exclusive */
125 
126 #ifdef notdef /* you might want to try these, on an IEEE machine */
127 #define XDR_D_INFINITY 1.797693134862315900e+308
128 #define XDR_F_INFINITY 3.40282357e+38
129 #endif
130 
131 #ifdef __STDC__
132  /* Use of a union, assumes IEEE representation and 1 byte unsigned char */
133 
134 #ifndef XDR_D_INFINITY
135 #define USE_D_UNION
136  union xdr_d_union {unsigned char bb[8]; double dd;} ;
137  extern union xdr_d_union xdr_d_infs ; /* instantiated in array.c */
138 #define XDR_D_INFINITY (xdr_d_infs.dd)
139 #endif /* !XDR_D_INFINITY */
140 
141 #ifndef XDR_F_INFINITY
142 #define USE_F_UNION
143  union xdr_f_union {unsigned char bb[4]; float ff;} ;
144  extern union xdr_f_union xdr_f_infs ; /* instantiated in array.c */
145 #define XDR_F_INFINITY (xdr_f_infs.ff)
146 #endif /* !XDR_F_INFINITY */
147 
148 
149 #else /* __STDC__ */
150  /* Use of a pointer pun, assumes IEEE representation, 4 byte long */
151 
152 #ifndef XDR_D_INFINITY
153 #define USE_D_LONG_PUN
154  extern long xdr_d_infinity[] ; /* instantiated in array.c */
155 #define XDR_D_INFINITY *(double *)xdr_d_infinity
156 #endif /* !XDR_D_INFINITY */
157 
158 #ifndef XDR_F_INFINITY
159 #define USE_F_LONG_PUN
160  extern long xdr_f_infinity ; /* instantiated in array.c */
161 #define XDR_F_INFINITY *((float *)&xdr_f_infinity)
162 #endif /* !XDR_F_INFINITY */
163 
164 #endif /* __STDC__ */
165 
166 /* End of INFINITY section */
167 
168 #define FILL_FLOAT XDR_F_INFINITY /* IEEE Infinity */
169 #define FILL_DOUBLE XDR_D_INFINITY
170 
171 #endif /* NC_OLD_FILLVALUES above */
172 
173 
174 /*
175  * masks for the struct NC flags field; passed in as 'mode' arg to
176  * nccreate and ncopen.
177  *
178  */
179 #define NC_RDWR 1 /* read/write, 0 => readonly */
180 #define NC_CREAT 2 /* in create phase, cleared by ncendef */
181 #define NC_EXCL 4 /* on create, don't destroy existing file */
182 #define NC_INDEF 8 /* in define mode, cleared by ncendef */
183 #define NC_NSYNC 0x10 /* synchronise numrecs on change */
184 #define NC_HSYNC 0x20 /* synchronise whole header on change */
185 #define NC_NDIRTY 0x40 /* numrecs has changed */
186 #define NC_HDIRTY 0x80 /* header info has changed */
187 #define NC_NOFILL 0x100 /* Don't fill vars on endef and increase of record */
188 #define NC_LINK 0x8000 /* isa link */
189 
190 #define NC_FILL 0 /* argument to ncsetfill to clear NC_NOFILL */
191 
192 /*
193  * 'mode' arguments for nccreate and ncopen
194  */
195 #define NC_NOWRITE 0
196 #define NC_WRITE NC_RDWR
197 #define NC_CLOBBER (NC_INDEF | NC_CREAT | NC_RDWR)
198 #define NC_NOCLOBBER (NC_INDEF | NC_EXCL | NC_CREAT | NC_RDWR)
199 
200 /*
201  * 'size' argument to ncdimdef for an unlimited dimension
202  */
203 #define NC_UNLIMITED 0L
204 
205 /*
206  * attribute id to put/get a global attribute
207  */
208 #define NC_GLOBAL -1
209 
210 #ifndef HDF
211 /*
212  * This can be as large as the maximum number of stdio streams
213  * you can have open on your system.
214  */
215 #define MAX_NC_OPEN 32
216 
217 /*
218  * These maximums are enforced by the interface, to facilitate writing
219  * applications and utilities. However, nothing is statically allocated to
220  * these sizes internally.
221  */
222 #define MAX_NC_DIMS 5000 /* max dimensions per file */
223 #define MAX_NC_ATTRS 3000 /* max global or per variable attributes */
224 #define MAX_NC_VARS 5000 /* max variables per file */
225 #define MAX_NC_NAME 256 /* max length of a name */
226 #define MAX_VAR_DIMS 32 /* max per variable dimensions */
227 
228 /*
229  * Added feature.
230  * If you wish a variable to use a different value than the above
231  * defaults, create an attribute with the same type as the variable
232  * and the following reserved name. The value you give the attribute
233  * will be used as the fill value for that variable.
234  */
235 #define _FillValue "_FillValue"
236 
237 #else /* HDF */
238 
239 #include "hlimits.h" /* Hard coded constants for HDF library */
240 
241 #endif /* HDF */
242 
243 #ifdef USE_ENUM
244 /*
245  * The netcdf data types
246  */
247 typedef enum {
248  NC_UNSPECIFIED, /* private */
255  /* private */
262 } nc_type ;
263 #else
264 typedef int nc_type ;
265 #define NC_UNSPECIFIED 0 /* private */
266 #define NC_BYTE 1
267 #define NC_CHAR 2
268 #define NC_SHORT 3
269 #define NC_LONG 4
270 #define NC_FLOAT 5
271 #define NC_DOUBLE 6
272  /* private */
273 #define NC_BITFIELD 7
274 #define NC_STRING 8
275 #define NC_IARRAY 9
276 #define NC_DIMENSION 10
277 #define NC_VARIABLE 11
278 #define NC_ATTRIBUTE 12
279 #endif
280 
281 
282 /*
283  * C data types corresponding to netCDF data types:
284  */
285 /* Don't use these or the C++ interface gets confused
286 typedef char ncchar;
287 typedef char ncbyte;
288 typedef short ncshort;
289 typedef float ncfloat;
290 typedef double ncdouble;
291 */
292 
293 /*
294  * Variables/attributes of type NC_LONG should use the C type 'nclong'
295  */
296 #if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
297 /*
298  * LP64 (also known as 4/8/8) denotes long and pointer as 64 bit types.
299  * http://www.unix.org/version2/whatsnew/lp64_wp.html
300  */
301 typedef int nclong;
302 #else
303 typedef long nclong; /* default, compatible type */
304 #endif
305 
306 
307 /*
308  * Global netcdf error status variable
309  * Initialized in error.c
310  */
311 #define NC_NOERR 0 /* No Error */
312 #define NC_EBADID 1 /* Not a netcdf id */
313 #define NC_ENFILE 2 /* Too many netcdfs open */
314 #define NC_EEXIST 3 /* netcdf file exists && NC_NOCLOBBER */
315 #define NC_EINVAL 4 /* Invalid Argument */
316 #define NC_EPERM 5 /* Write to read only */
317 #define NC_ENOTINDEFINE 6 /* Operation not allowed in data mode */
318 #define NC_EINDEFINE 7 /* Operation not allowed in define mode */
319 #define NC_EINVALCOORDS 8 /* Coordinates out of Domain */
320 #define NC_EMAXDIMS 9 /* MAX_NC_DIMS exceeded */
321 #define NC_ENAMEINUSE 10 /* String match to name in use */
322 #define NC_ENOTATT 11 /* Attribute not found */
323 #define NC_EMAXATTS 12 /* MAX_NC_ATTRS exceeded */
324 #define NC_EBADTYPE 13 /* Not a netcdf data type */
325 #define NC_EBADDIM 14 /* Invalid dimension id */
326 #define NC_EUNLIMPOS 15 /* NC_UNLIMITED in the wrong index */
327 #define NC_EMAXVARS 16 /* MAX_NC_VARS exceeded */
328 #define NC_ENOTVAR 17 /* Variable not found */
329 #define NC_EGLOBAL 18 /* Action prohibited on NC_GLOBAL varid */
330 #define NC_ENOTNC 19 /* Not a netcdf file */
331 #define NC_ESTS 20 /* In Fortran, string too short */
332 #define NC_EMAXNAME 21 /* MAX_NC_NAME exceeded */
333 #define NC_ENTOOL NC_EMAXNAME /* Backward compatibility */
334 #define NC_EUNLIMIT 22 /* NC_UNLIMITED size already in use */
335 
336 #define NC_EXDR 32 /* */
337 #define NC_SYSERR -1
338 
339 #include "hdf2netcdf.h"
341 
342 /*
343  * Global options variable. Used to determine behavior of error handler.
344  * Initialized in lerror.c
345  */
346 #define NC_FATAL 1
347 #define NC_VERBOSE 2
348 
349 HDFLIBAPI int ncopts ; /* default is (NC_FATAL | NC_VERBOSE) */
350 
351 #ifndef HAVE_PROTOTYPES
352 # if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus) || defined(c_plusplus)
353 # define HAVE_PROTOTYPES
354 # endif
355 #endif
356 
357 #undef PROTO
358 #ifdef HAVE_PROTOTYPES
359 # define PROTO(x) x
360 #else
361 # define PROTO(x) ()
362 #endif
363 
364 
365 #ifdef __cplusplus
366 extern "C" {
367 #endif
368 
370  const char* path,
371  int cmode
372 ));
373 HDFLIBAPI int ncopen PROTO((
374  const char* path,
375  int mode
376 ));
377 HDFLIBAPI int ncredef PROTO((
378  int cdfid
379 ));
380 HDFLIBAPI int ncendef PROTO((
381  int cdfid
382 ));
383 HDFLIBAPI int ncclose PROTO((
384  int cdfid
385 ));
387  int cdfid,
388  int* ndims,
389  int* nvars,
390  int* natts,
391  int* recdim
392 ));
393 HDFLIBAPI int ncsync PROTO((
394  int cdfid
395 ));
396 HDFLIBAPI int ncabort PROTO((
397  int cdfid
398 ));
399 HDFLIBAPI int ncnobuf PROTO((
400  int cdfid
401 ));
403  int cdfid,
404  const char* name,
405  long length
406 ));
407 HDFLIBAPI int ncdimid PROTO((
408  int cdfid,
409  const char* name
410 ));
412  int cdfid,
413  int dimid,
414  char* name,
415  long* length
416 ));
418  int cdfid,
419  int dimid,
420  const char* name
421 ));
423  int cdfid,
424  const char* name,
425  nc_type datatype,
426  int ndims,
427  const int* dim
428 ));
429 HDFLIBAPI int ncvarid PROTO((
430  int cdfid,
431  const char* name
432 ));
434  int cdfid,
435  int varid,
436  char* name,
437  nc_type* datatype,
438  int* ndims,
439  int* dim,
440  int* natts
441 ));
443  int cdfid,
444  int varid,
445  const long* coords,
446  const void* value
447 ));
449  int cdfid,
450  int varid,
451  const long* coords,
452  void* value
453 ));
455  int cdfid,
456  int varid,
457  const long* start,
458  const long* count,
459  void* value
460 ));
462  int cdfid,
463  int varid,
464  const long* start,
465  const long* count,
466  void* value
467 ));
469  int cdfid,
470  int varid,
471  const long* start,
472  const long* count,
473  const long* stride,
474  void* values
475 ));
477  int cdfid,
478  int varid,
479  const long* start,
480  const long* count,
481  const long* stride,
482  void* values
483 ));
485  int cdfid,
486  int varid,
487  const long* start,
488  const long* count,
489  const long* stride,
490  const long* imap,
491  void* values
492 ));
494  int cdfid,
495  int varid,
496  const long* start,
497  const long* count,
498  const long* stride,
499  const long* imap,
500  void* values
501 ));
503  int cdfid,
504  int varid,
505  const char* name
506 ));
508  int cdfid,
509  int varid,
510  const char* name,
511  nc_type datatype,
512  int len,
513  const void* value
514 ));
516  int cdfid,
517  int varid,
518  const char* name,
519  nc_type* datatype,
520  int* len
521 ));
523  int cdfid,
524  int varid,
525  const char* name,
526  void* value
527 ));
529  int incdf,
530  int invar,
531  const char* name,
532  int outcdf,
533  int outvar
534 ));
536  int cdfid,
537  int varid,
538  int attnum,
539  char* name
540 ));
542  int cdfid,
543  int varid,
544  const char* name,
545  const char* newname
546 ));
548  int cdfid,
549  int varid,
550  const char* name
551 ));
553  nc_type datatype
554 ));
556  int cdfid,
557  int fillmode
558 ));
560  int cdfid,
561  int* nrecvars,
562  int* recvarids,
563  long* recsizes
564 ));
566  int cdfid,
567  long recnum,
568  void** datap
569 ));
571  int cdfid,
572  long recnum,
573  void* * datap
574 ));
575 #ifdef __cplusplus
576 }
577 #endif
578 
579 #endif /* _NETCDF_ */
EXTERNL int ncdimid(int ncid, const char *name)
HDFFCLIBAPI intf intf intf * count
EXTERNL int ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out)
HDFFCLIBAPI intf * len
EXTERNL int ncrecinq(int ncid, int *nrecvarsp, int *recvaridsp, long *recsizesp)
EXTERNL int ncopen(const char *path, int mode)
nc_type
Definition: netcdf.h:253
EXTERNL int ncdiminq(int ncid, int dimid, char *name, long *lenp)
HDFLIBAPI int ncerr
Definition: hdf4_netcdf.h:340
HDFFCLIBAPI _fcd _fcd intf intf * datatype
EXTERNL int ncdimrename(int ncid, int dimid, const char *name)
EXTERNL int ncrecget(int ncid, long recnum, void **datap)
EXTERNL int nccreate(const char *path, int cmode)
nc_type
Definition: hdf4_netcdf.h:247
EXTERNL int ncsync(int ncid)
EXTERNL int ncvarrename(int ncid, int varid, const char *name)
#define PROTO(x)
Definition: hdf4_netcdf.h:361
HDFLIBAPI int ncopts
Definition: hdf4_netcdf.h:349
EXTERNL int ncsetfill(int ncid, int fillmode)
EXTERNL int ncredef(int ncid)
#define ncnobuf
Definition: hdf2netcdf.h:71
EXTERNL int ncvargets(int ncid, int varid, const long *startp, const long *countp, const long *stridep, void *ip)
EXTERNL int ncattinq(int ncid, int varid, const char *name, nc_type *xtypep, int *lenp)
EXTERNL int ncattdel(int ncid, int varid, const char *name)
EXTERNL int ncendef(int ncid)
EXTERNL int ncvargetg(int ncid, int varid, const long *startp, const long *countp, const long *stridep, const long *imapp, void *ip)
EXTERNL int ncvarputg(int ncid, int varid, const long *startp, const long *countp, const long *stridep, const long *imapp, const void *op)
EXTERNL int ncinquire(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimp)
EXTERNL int ncvarput1(int ncid, int varid, const long *indexp, const void *op)
HDFFCLIBAPI _fcd name
long nclong
Definition: hdf4_netcdf.h:303
HDFFCLIBAPI intf _fcd intf intf intf * values
EXTERNL int ncclose(int ncid)
EXTERNL int ncdimdef(int ncid, const char *name, long len)
EXTERNL int ncattname(int ncid, int varid, int attnum, char *name)
EXTERNL int ncvarputs(int ncid, int varid, const long *startp, const long *countp, const long *stridep, const void *op)
EXTERNL int ncvarput(int ncid, int varid, const long *startp, const long *countp, const void *op)
EXTERNL int ncattget(int ncid, int varid, const char *name, void *ip)
EXTERNL int ncrecput(int ncid, long recnum, void *const *datap)
HDFFCLIBAPI intf intf start[]
EXTERNL int ncvarget(int ncid, int varid, const long *startp, const long *countp, void *ip)
HDFFCLIBAPI intf stride[]
EXTERNL int ncattrename(int ncid, int varid, const char *name, const char *newname)
#define HDFLIBAPI
Definition: H4api_adpt.h:195
EXTERNL int ncattput(int ncid, int varid, const char *name, nc_type xtype, int len, const void *op)
EXTERNL int ncvarget1(int ncid, int varid, const long *indexp, void *ip)
EXTERNL int ncvardef(int ncid, const char *name, nc_type xtype, int ndims, const int *dimidsp)
EXTERNL int ncvarid(int ncid, const char *name)
EXTERNL int ncabort(int ncid)
EXTERNL int ncvarinq(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp)
EXTERNL int nctypelen(nc_type datatype)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53