File: netcdf.h.in

package info (click to toggle)
libhdf4 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 29,892 kB
  • sloc: ansic: 128,688; sh: 14,969; fortran: 12,444; java: 5,864; xml: 1,305; makefile: 900; yacc: 678; pascal: 418; perl: 360; javascript: 203; lex: 163; csh: 41
file content (523 lines) | stat: -rw-r--r-- 15,060 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
/* Generated automatically from netcdf.h.in by configure. */
/*
 *    Copyright 1993, University Corporation for Atmospheric Research
 *
 *  Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose without fee is hereby granted, provided
 * that the above copyright notice appear in all copies, that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of UCAR/Unidata not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  UCAR makes no
 * representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.  It is
 * provided with no support and without obligation on the part of UCAR
 * Unidata, to assist in its use, correction, modification, or enhancement.
 *
 */

#ifndef _NETCDF_
#define _NETCDF_

#include <inttypes.h>

#include "H4api_adpt.h"

/*
 * The definitions ncvoid and MAX_NC_OPEN, may need to be set
 * properly for your installation.
 */

/*
 * Argument type in user functions (deprecated, backward compatibility)
 */
#ifndef UD_NO_VOID
#define ncvoid    void
#else
/* system doesn't have void type */
#define ncvoid    char
#endif

/*
 * The following macro is provided for backward compatibility only.  If you
 * are a new user of netCDF, then you may safely ignore it.  If, however,
 * you have an existing archive of netCDF files that use default
 * floating-point fill values, then you should know that the definition of
 * the default floating-point fill values changed with version 2.3 of the
 * netCDF package.  Prior to this release, the default floating-point fill
 * values were not very portable:  their correct behavior depended not only
 * upon the particular platform, but also upon the compilation
 * environment.  This led to the definition of new, default floating-point
 * fill values that are portable across all platforms and compilation
 * environments.  If you wish, however, to obtain the old, non-portable
 * floating-point fill values, then the following macro should have a true
 * value PRIOR TO BUILDING THE netCDF LIBRARY.
 *
 * Implementation details are contained in the section below on fill values.
 */
#define NC_OLD_FILLVALUES    0

/*
 *     Fill values
 * These values are stuffed into newly allocated space as appropriate.
 * The hope is that one might use these to notice that a particular datum
 * has not been set.
 */

#define FILL_BYTE    ((char)-127)        /* Largest Negative value */
#define FILL_CHAR    ((char)0)
#define FILL_SHORT    ((short)-32767)
#define FILL_LONG    ((long)-2147483647)

#if !NC_OLD_FILLVALUES

#   define FILL_FLOAT     9.9692099683868690e+36F /* near 15 * 2^119 */
#   define FILL_DOUBLE    9.9692099683868690e+36

#else    /* NC_OLD_FILLVALUES below */

/*
 * This section is provided for backward compatibility only.  Using
 * XDR infinities for floating-point fill values has caused more problems
 * than it has solved.  We encourage you to define your own data-specific
 * fill values rather than use default ones (see `_FillValue' below).
 * If, however, you *must* use default fill values, then you should use
 * the above fill values rather than the ones in this section.
 */

/*
 * XDR_F_INFINITY is a float value whose EXTERNAL (xdr)
 * representation is ieee floating infinity.
 * XDR_D_INFINITY is a double value whose EXTERNAL (xdr)
 * representation is ieee double floating point infinity.
 * These are used as default fill values below.
 *
 * This section shows three techniques for setting these:
 *  Direct assignment (vax, cray) - works for non IEEE machines
 *        Doesn't work when IEEE machines don't allow
 *      float or double constants whose values are infinity.
 *  Use of a union (preferred portable method) - should work on
 *      any ANSI compiler with IEEE floating point representations,
 *      modulo byte order and sizeof() considerations.
 *  Use of pointer puns - may work with many older compilers
 *      which don't allow initialization of unions.
 *      Often doesn't work with compilers which have strict
 *      alignment rules.
 */

    /* Direct assignment. All cases should be mutually exclusive */

#ifdef notdef /* you might want to try these, on an IEEE machine */
#define XDR_D_INFINITY    1.797693134862315900e+308
#define XDR_F_INFINITY    3.40282357e+38
#endif

#ifdef __STDC__
    /* Use of a union, assumes IEEE representation and 1 byte unsigned char */

#ifndef    XDR_D_INFINITY
#define USE_D_UNION
     union xdr_d_union {unsigned char bb[8]; double dd;} ;
     extern union xdr_d_union xdr_d_infs ;  /* instantiated in array.c */
#define XDR_D_INFINITY    (xdr_d_infs.dd)
#endif /* !XDR_D_INFINITY */

#ifndef    XDR_F_INFINITY
#define USE_F_UNION
     union xdr_f_union {unsigned char bb[4]; float ff;} ;
     extern union xdr_f_union xdr_f_infs ;  /* instantiated in array.c */
#define  XDR_F_INFINITY    (xdr_f_infs.ff)
#endif /* !XDR_F_INFINITY */


#else /* __STDC__ */
    /* Use of a pointer pun, assumes IEEE representation, 4 byte long */

#ifndef    XDR_D_INFINITY
#define USE_D_LONG_PUN
     extern long xdr_d_infinity[] ;  /* instantiated in array.c */
#define XDR_D_INFINITY *(double *)xdr_d_infinity
#endif /* !XDR_D_INFINITY */

#ifndef    XDR_F_INFINITY
#define USE_F_LONG_PUN
     extern long xdr_f_infinity ;  /* instantiated in array.c */
#define XDR_F_INFINITY *((float *)&xdr_f_infinity)
#endif /* !XDR_F_INFINITY */

#endif /* __STDC__ */

/* End of INFINITY           section */

#define FILL_FLOAT    XDR_F_INFINITY    /* IEEE Infinity */
#define FILL_DOUBLE    XDR_D_INFINITY

#endif    /* NC_OLD_FILLVALUES above */


/*
 *  masks for the struct NC flags field; passed in as 'mode' arg to
 * nccreate and ncopen.
 *
 */
#define NC_RDWR  1        /* read/write, 0 => readonly */
#define NC_CREAT 2        /* in create phase, cleared by ncendef */
#define NC_EXCL  4        /* on create, don't destroy existing file */
#define NC_INDEF 8        /* in define mode, cleared by ncendef */
#define NC_NSYNC 0x10    /* synchronise numrecs on change */
#define NC_HSYNC 0x20    /* synchronise whole header on change */
#define NC_NDIRTY 0x40    /* numrecs has changed */
#define NC_HDIRTY 0x80  /* header info has changed */
#define NC_NOFILL 0x100    /* Don't fill vars on endef and increase of record */
#define NC_LINK 0x8000    /* isa link */

#define NC_FILL 0    /* argument to ncsetfill to clear NC_NOFILL */

/*
 * 'mode' arguments for nccreate and ncopen
 */
#define NC_NOWRITE   0
#define NC_WRITE     NC_RDWR
#define NC_CLOBBER   (NC_INDEF | NC_CREAT | NC_RDWR)
#define NC_NOCLOBBER (NC_INDEF | NC_EXCL | NC_CREAT | NC_RDWR)

/*
 * 'size' argument to ncdimdef for an unlimited dimension
 */
#define NC_UNLIMITED 0L

/*
 * attribute id to put/get a global attribute
 */
#define NC_GLOBAL -1

#ifndef HDF
/*
 * This can be as large as the maximum number of stdio streams
 * you can have open on your system.
 */
#define MAX_NC_OPEN 32

/*
 * These maximums are enforced by the interface, to facilitate writing
 * applications and utilities.  However, nothing is statically allocated to
 * these sizes internally.
 */
#define MAX_NC_DIMS 5000     /* max dimensions per file */
#define MAX_NC_ATTRS 3000     /* max global or per variable attributes */
#define MAX_NC_VARS 5000     /* max variables per file */
#define MAX_NC_NAME 256         /* max length of a name */
#define MAX_VAR_DIMS 32          /* max per variable dimensions */

/*
 * Added feature.
 * If you wish a variable to use a different value than the above
 * defaults, create an attribute with the same type as the variable
 * and the following reserved name. The value you give the attribute
 * will be used as the fill value for that variable.
 */
#define _FillValue    "_FillValue"

#else /* HDF */

#include "hlimits.h"  /* Hard coded constants for HDF library */

#endif /* HDF */

/* This type used to be defined as an enum, but the C standard is a bit
 * vague as to which integer type you actually get to represent your enum
 * and passing that through a pointer caused failures on MacOS.
 */
typedef int nc_type ;
#define    NC_UNSPECIFIED 0 /* private */
#define    NC_BYTE 1
#define    NC_CHAR 2
#define    NC_SHORT 3
#define    NC_LONG 4
#define    NC_FLOAT 5
#define    NC_DOUBLE 6
    /* private */
#define    NC_BITFIELD 7
#define    NC_STRING 8
#define    NC_IARRAY 9
#define    NC_DIMENSION 10
#define    NC_VARIABLE 11
#define    NC_ATTRIBUTE 12

/*
 * C data types corresponding to netCDF data types:
 */
/* Don't use these or the C++ interface gets confused
typedef char  ncchar;
typedef char  ncbyte;
typedef short ncshort;
typedef float ncfloat;
typedef double        ncdouble;
*/

/*
 * Variables/attributes of type NC_LONG should use the C type 'nclong',
 * which should map to a 32-bit integer.
 */
typedef int32_t nclong;


/*
 * Global netcdf error status variable
 *  Initialized in error.c
 */
#define    NC_NOERR    0    /* No Error */
#define    NC_EBADID    1    /* Not a netcdf id */
#define    NC_ENFILE    2    /* Too many netcdfs open */
#define    NC_EEXIST    3    /* netcdf file exists && NC_NOCLOBBER */
#define    NC_EINVAL    4    /* Invalid Argument */
#define    NC_EPERM    5    /* Write to read only */
#define    NC_ENOTINDEFINE    6    /* Operation not allowed in data mode */
#define    NC_EINDEFINE    7    /* Operation not allowed in define mode */
#define    NC_EINVALCOORDS    8    /* Coordinates out of Domain */
#define    NC_EMAXDIMS    9    /* MAX_NC_DIMS exceeded */
#define    NC_ENAMEINUSE    10    /* String match to name in use */
#define NC_ENOTATT    11    /* Attribute not found */
#define    NC_EMAXATTS    12    /* MAX_NC_ATTRS exceeded */
#define NC_EBADTYPE    13    /* Not a netcdf data type */
#define NC_EBADDIM    14    /* Invalid dimension id */
#define NC_EUNLIMPOS    15    /* NC_UNLIMITED in the wrong index */
#define    NC_EMAXVARS    16    /* MAX_NC_VARS exceeded */
#define NC_ENOTVAR    17    /* Variable not found */
#define NC_EGLOBAL    18    /* Action prohibited on NC_GLOBAL varid */
#define NC_ENOTNC    19    /* Not a netcdf file */
#define NC_ESTS         20      /* In Fortran, string too short */
#define NC_EMAXNAME     21      /* MAX_NC_NAME exceeded */
#define NC_ENTOOL       NC_EMAXNAME   /* Backward compatibility */
#define NC_EUNLIMIT     22      /* NC_UNLIMITED size already in use */

#define    NC_EXDR        32    /* */
#define    NC_SYSERR    -1

#include "hdf2netcdf.h"
HDFLIBAPI int ncerr ;

/*
 * Global options variable. Used to determine behavior of error handler.
 *  Initialized in lerror.c
 */
#define    NC_FATAL    1
#define    NC_VERBOSE    2

HDFLIBAPI int ncopts ;    /* default is (NC_FATAL | NC_VERBOSE) */

#ifdef __cplusplus
extern "C" {
#endif

HDFLIBAPI int nccreate    (
    const char*    path,
    int        cmode
);
HDFLIBAPI int ncopen    (
    const char*    path,
    int        mode
);
HDFLIBAPI int ncredef    (
    int        cdfid
);
HDFLIBAPI int ncendef    (
    int        cdfid
);
HDFLIBAPI int ncclose    (
    int        cdfid
);
HDFLIBAPI int ncinquire    (
    int        cdfid,
    int*    ndims,
    int*    nvars,
    int*    natts,
    int*    recdim
);
HDFLIBAPI int ncsync    (
    int        cdfid
);
HDFLIBAPI int ncabort    (
    int        cdfid
);
HDFLIBAPI int ncnobuf    (
    int        cdfid
);
HDFLIBAPI int ncdimdef    (
    int        cdfid,
    const char*    name,
    long    length
);
HDFLIBAPI int ncdimid    (
    int        cdfid,
    const char*    name
);
HDFLIBAPI int ncdiminq    (
    int        cdfid,
    int        dimid,
    char*    name,
    long*    length
);
HDFLIBAPI int ncdimrename    (
    int        cdfid,
    int        dimid,
    const char*    name
);
HDFLIBAPI int ncvardef    (
    int        cdfid,
    const char*    name,
    nc_type    datatype,
    int        ndims,
    const int*    dim
);
HDFLIBAPI int ncvarid    (
    int        cdfid,
    const char*    name
);
HDFLIBAPI int ncvarinq    (
    int        cdfid,
    int        varid,
    char*    name,
    nc_type*    datatype,
    int*    ndims,
    int*    dim,
    int*    natts
);
HDFLIBAPI int ncvarput1    (
    int        cdfid,
    int        varid,
    const long*    coords,
    const void*    value
);
HDFLIBAPI int ncvarget1    (
    int        cdfid,
    int        varid,
    const long*    coords,
    void*    value
);
HDFLIBAPI int ncvarput    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    void*    value
);
HDFLIBAPI int ncvarget    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    void*    value
);
HDFLIBAPI int ncvarputs    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    const long*    stride,
    void*    values
);
HDFLIBAPI int ncvargets    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    const long*    stride,
    void*    values
);
HDFLIBAPI int ncvarputg    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    const long*    stride,
    const long*    imap,
    void* values
);
HDFLIBAPI int ncvargetg    (
    int        cdfid,
    int        varid,
    const long*    start,
    const long*    count,
    const long*    stride,
    const long*    imap,
    void*    values
);
HDFLIBAPI int ncvarrename    (
    int        cdfid,
    int        varid,
    const char*    name
);
HDFLIBAPI int ncattput    (
    int        cdfid,
    int        varid,
    const char*    name,
    nc_type    datatype,
    int        len,
    const void*    value
);
HDFLIBAPI int ncattinq    (
    int        cdfid,
    int        varid,
    const char*    name,
    nc_type*    datatype,
    int*    len
);
HDFLIBAPI int ncattget    (
    int        cdfid,
    int        varid,
    const char*    name,
    void*    value
);
HDFLIBAPI int ncattcopy    (
    int        incdf,
    int        invar,
    const char*    name,
    int        outcdf,
    int        outvar
);
HDFLIBAPI int ncattname    (
    int        cdfid,
    int        varid,
    int        attnum,
    char*    name
);
HDFLIBAPI int ncattrename    (
    int        cdfid,
    int        varid,
    const char*    name,
    const char*    newname
);
HDFLIBAPI int ncattdel    (
    int        cdfid,
    int        varid,
    const char*    name
);
HDFLIBAPI int nctypelen    (
    nc_type    datatype
);
HDFLIBAPI int ncsetfill    (
    int        cdfid,
    int        fillmode
);
HDFLIBAPI int ncrecinq        (
    int        cdfid,
    int*    nrecvars,
    int*    recvarids,
    long*    recsizes
);
HDFLIBAPI int ncrecget        (
    int        cdfid,
    long    recnum,
    void**    datap
);
HDFLIBAPI int ncrecput        (
    int        cdfid,
    long    recnum,
    void* * datap
);
#ifdef __cplusplus
}
#endif

#endif /* _NETCDF_ */