source: anuga_core/install/winxp/NetCDFWinInstaller/include/netcdf.h @ 7310

Last change on this file since 7310 was 7310, checked in by rwilson, 15 years ago

Added the NetCDF Windows installer.

  • Property svn:executable set to *
File size: 53.8 KB
Line 
1/*
2 * Copyright 1993-2006 University Corporation for Atmospheric Research/Unidata
3 *
4 * Portions of this software were developed by the Unidata Program at the
5 * University Corporation for Atmospheric Research.
6 *
7 * Access and use of this software shall impose the following obligations
8 * and understandings on the user. The user is granted the right, without
9 * any fee or cost, to use, copy, modify, alter, enhance and distribute
10 * this software, and any derivative works thereof, and its supporting
11 * documentation for any purpose whatsoever, provided that this entire
12 * notice appears in all copies of the software, derivative works and
13 * supporting documentation.  Further, UCAR requests that the user credit
14 * UCAR/Unidata in any publications that result from the use of this
15 * software or in any product that includes this software. The names UCAR
16 * and/or Unidata, however, may not be used in any advertising or publicity
17 * to endorse or promote any products or commercial entity unless specific
18 * written permission is obtained from UCAR/Unidata. The user also
19 * understands that UCAR/Unidata is not obligated to provide the user with
20 * any support, consulting, training or assistance of any kind with regard
21 * to the use, operation and performance of this software nor to provide
22 * the user with any updates, revisions, new versions or "bug fixes."
23 *
24 * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
28 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
29 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
30 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
31 * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
32 */
33/* "$Id: netcdf_base.h,v 1.28 2009/02/26 02:55:05 dmh Exp $" */
34
35#ifndef _NETCDF_
36#define _NETCDF_
37
38#include <stddef.h> /* size_t, ptrdiff_t */
39#include <errno.h>  /* netcdf functions sometimes return system errors */
40/* These defs added by netCDF configure because parallel HDF5 is not present. */
41#define MPI_Comm int
42#define MPI_Info int
43#define MPI_COMM_WORLD 0
44#define MPI_INFO_NULL 0
45
46typedef int nc_type;
47
48#if defined(__cplusplus)
49extern "C" {
50#endif
51
52/*
53 *  The netcdf external data types
54 */
55#define NC_NAT          0       /* NAT = 'Not A Type' (c.f. NaN) */
56#define NC_BYTE         1       /* signed 1 byte integer */
57#define NC_CHAR         2       /* ISO/ASCII character */
58#define NC_SHORT        3       /* signed 2 byte integer */
59#define NC_INT          4       /* signed 4 byte integer */
60#define NC_LONG         NC_INT  /* deprecated, but required for backward compatibility. */
61#define NC_FLOAT        5       /* single precision floating point number */
62#define NC_DOUBLE       6       /* double precision floating point number */
63#define NC_UBYTE        7       /* unsigned 1 byte int */
64#define NC_USHORT       8       /* unsigned 2-byte int */
65#define NC_UINT         9       /* unsigned 4-byte int */
66#define NC_INT64        10      /* signed 8-byte int */
67#define NC_UINT64       11      /* unsigned 8-byte int */
68#define NC_STRING       12      /* string */
69
70/* The folloing are use internally in support of user-defines
71 * types. They are also the class returned by nc_inq_user_type. */
72#define NC_VLEN         13      /* used internally for vlen types */
73#define NC_OPAQUE       14      /* used internally for opaque types */
74#define NC_ENUM         15      /* used internally for enum types */
75#define NC_COMPOUND     16      /* used internally for compound types */
76
77/*
78 *      Default fill values, used unless _FillValue attribute is set.
79 * These values are stuffed into newly allocated space as appropriate.
80 * The hope is that one might use these to notice that a particular datum
81 * has not been set.
82 */
83#define NC_FILL_BYTE    ((signed char)-127)
84#define NC_FILL_CHAR    ((char)0)
85#define NC_FILL_SHORT   ((short)-32767)
86#define NC_FILL_INT     (-2147483647L)
87#define NC_FILL_FLOAT   (9.9692099683868690e+36f) /* near 15 * 2^119 */
88#define NC_FILL_DOUBLE  (9.9692099683868690e+36)
89#define NC_FILL_UBYTE   (255)
90#define NC_FILL_USHORT  (65535)
91#define NC_FILL_UINT    (4294967295U)
92#define NC_FILL_INT64   ((long long)-9223372036854775806LL)
93#define NC_FILL_UINT64  ((unsigned long long)18446744073709551614ULL)
94#define NC_FILL_STRING  ""
95
96/* These represent the max and min values that can be stored in a
97 * netCDF file for their associated types. Recall that a C compiler
98 * may define int to be any length it wants, but a NC_INT is *always*
99 * a 4 byte signed int. On a platform with has 64 bit ints, there will
100 * be many ints which are outside the range supported by NC_INT. But
101 * since NC_INT is an external format, it has to mean the same thing
102 * everywhere. */
103#define NC_MAX_BYTE 127
104#define NC_MIN_BYTE (-NC_MAX_BYTE-1)
105#define NC_MAX_CHAR 255
106#define NC_MAX_SHORT 32767
107#define NC_MIN_SHORT (-NC_MAX_SHORT - 1)
108#define NC_MAX_INT 2147483647
109#define NC_MIN_INT (-NC_MAX_INT - 1)
110#define NC_MAX_FLOAT 3.402823466e+38f
111#define NC_MIN_FLOAT (-NC_MAX_FLOAT)
112#define NC_MAX_DOUBLE 1.7976931348623157e+308
113#define NC_MIN_DOUBLE (-NC_MAX_DOUBLE)
114#define NC_MAX_UBYTE NC_MAX_CHAR
115#define NC_MAX_USHORT 65535U
116#define NC_MAX_UINT 4294967295U
117#define NC_MAX_INT64 (9223372036854775807LL)
118#define NC_MIN_INT64 (-9223372036854775807LL-1)
119#define NC_MAX_UINT64 (18446744073709551615ULL)
120#define X_INT64_MAX     (9223372036854775807LL)
121#define X_INT64_MIN     (-X_INT64_MAX - 1)
122#define X_UINT64_MAX    (18446744073709551615ULL)
123
124/* These are limits for default chunksizes. (2^16 and 2^20). */
125#define NC_LEN_TOO_BIG 65536
126#define NC_LEN_WAY_TOO_BIG 1048576
127
128/*
129 * The above values are defaults.  If you wish a variable to use a
130 * different value than the above defaults, create an attribute with
131 * the same type as the variable and the following reserved name. The
132 * value you give the attribute will be used as the fill value for
133 * that variable.
134 */
135#define _FillValue      "_FillValue"
136#define NC_FILL         0       /* argument to ncsetfill to clear NC_NOFILL */
137#define NC_NOFILL       0x100   /* Don't fill data section an records */
138
139/*
140 * Use these 'mode' flags for nc_open.
141 */
142#define NC_NOWRITE      0       /* default is read only */
143#define NC_WRITE        0x0001  /* read & write */
144
145/*
146 * Use these 'mode' flags for nc_create.
147 */
148#define NC_CLOBBER      0
149#define NC_NOCLOBBER    0x0004  /* Don't destroy existing file on create */
150#define NC_64BIT_OFFSET 0x0200  /* Use large (64-bit) file offsets */
151#define NC_NETCDF4      0x1000  /* Use netCDF-4/HDF5 format */
152#define NC_CLASSIC_MODEL 0x0100 /* Enforce classic model when used with NC_NETCDF4. */
153
154/*
155 * Use these 'mode' flags for both nc_create and nc_open.
156 */
157#define NC_SHARE       0x0800   /* Share updates, limit cacheing */
158#define NC_MPIIO       0x2000
159#define NC_MPIPOSIX    0x4000
160
161/* The following flag currently is ignored, but use in
162 * nc_open() or nc_create() may someday support use of advisory
163 * locking to prevent multiple writers from clobbering a file
164 */
165#define NC_LOCK         0x0400  /* Use locking if available */
166
167/*
168 * Starting with version 3.6, there are different format netCDF
169 * files. 4.0 introduces the third one. These defines are only for
170 * the nc_set_default_format function.
171 */
172#define NC_FORMAT_CLASSIC (1)
173#define NC_FORMAT_64BIT   (2)
174#define NC_FORMAT_NETCDF4 (3)
175#define NC_FORMAT_NETCDF4_CLASSIC  (4) /* create netcdf-4 files, with NC_CLASSIC_MODEL. */
176
177/*
178 * Let nc__create() or nc__open() figure out
179 * as suitable chunk size.
180 */
181#define NC_SIZEHINT_DEFAULT 0
182
183/*
184 * In nc__enddef(), align to the chunk size.
185 */
186#define NC_ALIGN_CHUNK ((size_t)(-1))
187
188/*
189 * 'size' argument to ncdimdef for an unlimited dimension
190 */
191#define NC_UNLIMITED 0L
192
193/*
194 * attribute id to put/get a global attribute
195 */
196#define NC_GLOBAL -1
197
198/*
199 * These maximums are enforced by the interface, to facilitate writing
200 * applications and utilities.  However, nothing is statically allocated to
201 * these sizes internally.
202 */
203#define NC_MAX_DIMS     1024     /* max dimensions per file */
204#define NC_MAX_ATTRS    8192     /* max global or per variable attributes */
205#define NC_MAX_VARS     8192     /* max variables per file */
206#define NC_MAX_NAME     256      /* max length of a name */
207#define NC_MAX_VAR_DIMS NC_MAX_DIMS /* max per variable dimensions */
208
209/* In HDF5 files you can set the endianness of variables with
210 * nc_def_var_endian(). These defines are used there. */   
211#define NC_ENDIAN_NATIVE 0
212#define NC_ENDIAN_LITTLE 1
213#define NC_ENDIAN_BIG    2
214
215/* In HDF5 files you can set storage for each variable to be either
216 * contiguous or chunked, with nc_def_var_chunking().  These defines
217 * are used there. */
218#define NC_CHUNKED    0
219#define NC_CONTIGUOUS 1
220
221/* In HDF5 files you can set check-summing for each variable.
222 * Currently the only checksum available is Fletcher-32, which can be
223 * set with the function nc_def_var_fletcher32.  These defines are used
224 * there. */
225#define NC_NOCHECKSUM 0
226#define NC_FLETCHER32 1
227
228/* In HDF5 files you can specify that a shuffle filter should be used
229 * on each chunk of a variable to improve compression for that
230 * variable.  This per-variable shuffle property can be set with the
231 * function nc_def_var_deflate.  These defines are used there. */
232#define NC_NOSHUFFLE 0
233#define NC_SHUFFLE   1
234
235/*
236 * The netcdf version 3 functions all return integer error status.
237 * These are the possible values, in addition to certain
238 * values from the system errno.h.
239 */
240
241#define NC_ISSYSERR(err)        ((err) > 0)
242
243#define NC_NOERR        0       /* No Error */
244
245#define NC2_ERR         (-1)    /* Returned for all errors in the v2 API. */
246#define NC_EBADID       (-33)   /* Not a netcdf id */
247#define NC_ENFILE       (-34)   /* Too many netcdfs open */
248#define NC_EEXIST       (-35)   /* netcdf file exists && NC_NOCLOBBER */
249#define NC_EINVAL       (-36)   /* Invalid Argument */
250#define NC_EPERM        (-37)   /* Write to read only */
251#define NC_ENOTINDEFINE (-38)   /* Operation not allowed in data mode */
252#define NC_EINDEFINE    (-39)   /* Operation not allowed in define mode */
253#define NC_EINVALCOORDS (-40)   /* Index exceeds dimension bound */
254#define NC_EMAXDIMS     (-41)   /* NC_MAX_DIMS exceeded */
255#define NC_ENAMEINUSE   (-42)   /* String match to name in use */
256#define NC_ENOTATT      (-43)   /* Attribute not found */
257#define NC_EMAXATTS     (-44)   /* NC_MAX_ATTRS exceeded */
258#define NC_EBADTYPE     (-45)   /* Not a netcdf data type */
259#define NC_EBADDIM      (-46)   /* Invalid dimension id or name */
260#define NC_EUNLIMPOS    (-47)   /* NC_UNLIMITED in the wrong index */
261#define NC_EMAXVARS     (-48)   /* NC_MAX_VARS exceeded */
262#define NC_ENOTVAR      (-49)   /* Variable not found */
263#define NC_EGLOBAL      (-50)   /* Action prohibited on NC_GLOBAL varid */
264#define NC_ENOTNC       (-51)   /* Not a netcdf file */
265#define NC_ESTS         (-52)   /* In Fortran, string too short */
266#define NC_EMAXNAME     (-53)   /* NC_MAX_NAME exceeded */
267#define NC_EUNLIMIT     (-54)   /* NC_UNLIMITED size already in use */
268#define NC_ENORECVARS   (-55)   /* nc_rec op when there are no record vars */
269#define NC_ECHAR        (-56)   /* Attempt to convert between text & numbers */
270#define NC_EEDGE        (-57)   /* Start+count exceeds dimension bound */
271#define NC_ESTRIDE      (-58)   /* Illegal stride */
272#define NC_EBADNAME     (-59)   /* Attribute or variable name
273                                         contains illegal characters */
274/* N.B. following must match value in ncx.h */
275#define NC_ERANGE       (-60)   /* Math result not representable */
276#define NC_ENOMEM       (-61)   /* Memory allocation (malloc) failure */
277
278#define NC_EVARSIZE     (-62)   /* One or more variable sizes violate
279                                   format constraints */ 
280#define NC_EDIMSIZE     (-63)   /* Invalid dimension size */
281#define NC_ETRUNC       (-64)   /* File likely truncated or possibly corrupted */
282
283#define NC_EAXISTYPE    (-65)   /* Unknown axis type. */
284
285/* Following errors are added for DAP */
286#define NC_EDAP         (-66)   /* Generic DAP error */
287#define NC_ECURL        (-67)   /* Generic libcurl error */
288#define NC_EIO          (-68)   /* Generic IO error */
289
290/* The following was added in support of netcdf-4. Make all netcdf-4
291   error codes < -100 so that errors can be added to netcdf-3 if
292   needed. */
293#define NC4_FIRST_ERROR  (-100)
294#define NC_EHDFERR       (-101) /* Error at HDF5 layer. */
295#define NC_ECANTREAD     (-102) /* Can't read. */
296#define NC_ECANTWRITE    (-103) /* Can't write. */
297#define NC_ECANTCREATE   (-104) /* Can't create. */
298#define NC_EFILEMETA     (-105) /* Problem with file metadata. */
299#define NC_EDIMMETA      (-106) /* Problem with dimension metadata. */
300#define NC_EATTMETA      (-107) /* Problem with attribute metadata. */
301#define NC_EVARMETA      (-108) /* Problem with variable metadata. */
302#define NC_ENOCOMPOUND   (-109) /* Not a compound type. */
303#define NC_EATTEXISTS    (-110) /* Attribute already exists. */
304#define NC_ENOTNC4       (-111) /* Attempting netcdf-4 operation on netcdf-3 file. */ 
305#define NC_ESTRICTNC3    (-112) /* Attempting netcdf-4 operation on strict nc3 netcdf-4 file. */ 
306#define NC_ENOTNC3       (-113) /* Attempting netcdf-3 operation on netcdf-4 file. */ 
307#define NC_ENOPAR        (-114) /* Parallel operation on file opened for non-parallel access. */ 
308#define NC_EPARINIT      (-115) /* Error initializing for parallel access. */ 
309#define NC_EBADGRPID     (-116) /* Bad group ID. */ 
310#define NC_EBADTYPID     (-117) /* Bad type ID. */ 
311#define NC_ETYPDEFINED   (-118) /* Type has already been defined and may not be edited. */
312#define NC_EBADFIELD     (-119) /* Bad field ID. */ 
313#define NC_EBADCLASS     (-120) /* Bad class. */ 
314#define NC_EMAPTYPE      (-121) /* Mapped access for atomic types only. */ 
315#define NC_ELATEFILL     (-122) /* Attempt to define fill value when data already exists. */
316#define NC_ELATEDEF      (-123) /* Attempt to define var properties, like deflate, after enddef. */
317#define NC_EDIMSCALE     (-124) /* Probem with HDF5 dimscales. */
318#define NC_ENOGRP        (-125) /* No group found. */
319#define NC_ESTORAGE      (-126) /* Can't specify both contiguous and chunking. */
320#define NC_EBADCHUNK     (-127) /* Bad chunksize. */
321#define NC4_LAST_ERROR   (-128)
322
323/*
324 * The Interface
325 */
326
327/* Declaration modifiers for DLL support (MSC et al) */
328
329#if defined(DLL_NETCDF) /* define when library is a DLL */
330#  if defined(DLL_EXPORT) /* define when building the library */
331#   define MSC_EXTRA __declspec(dllexport)
332#  else
333#   define MSC_EXTRA __declspec(dllimport)
334#  endif
335#include <io.h>
336/*#define lseek _lseeki64
337  #define off_t __int64*/
338#else
339#define MSC_EXTRA
340#endif  /* defined(DLL_NETCDF) */
341
342# define EXTERNL extern MSC_EXTRA
343
344#if defined(DLL_NETCDF) /* define when library is a DLL */
345MSC_EXTRA int ncerr;
346MSC_EXTRA int ncopts;
347#endif
348
349EXTERNL const char *
350nc_inq_libvers(void);
351
352EXTERNL const char *
353nc_strerror(int ncerr);
354
355EXTERNL int
356nc__create(const char *path, int cmode, size_t initialsz,
357         size_t *chunksizehintp, int *ncidp);
358
359EXTERNL int
360nc_create(const char *path, int cmode, int *ncidp);
361
362EXTERNL int
363nc__open(const char *path, int mode, 
364        size_t *chunksizehintp, int *ncidp);
365
366EXTERNL int
367nc_open(const char *path, int mode, int *ncidp);
368
369EXTERNL int
370nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
371              int *ncidp);
372
373EXTERNL int
374nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,
375            int *ncidp);
376
377/* Use these with nc_var_par_access(). */
378#define NC_INDEPENDENT 0
379#define NC_COLLECTIVE 1
380
381EXTERNL int
382nc_var_par_access(int ncid, int varid, int par_access);
383
384/* Given an ncid and group name (NULL gets root group), return
385 * locid. */
386EXTERNL int
387nc_inq_ncid(int ncid, char *name, int *grp_ncid);
388
389/* Given a location id, return the number of groups it contains, and
390 * an array of their locids. */
391EXTERNL int
392nc_inq_grps(int ncid, int *numgrps, int *ncids);
393
394/* Given locid, find name of group. (Root group is named "".) */
395EXTERNL int
396nc_inq_grpname(int ncid, char *name);
397
398/* Given ncid, find full name and len of full name. (Root group is
399 * named "/", with length 1.) */
400EXTERNL int
401nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name);
402
403/* Given ncid, find len of full name. */
404EXTERNL int
405nc_inq_grpname_len(int ncid, size_t *lenp);
406
407/* Given an ncid, find the ncid of its parent group. */
408EXTERNL int
409nc_inq_grp_parent(int ncid, int *parent_ncid);
410
411/* Given a name and parent ncid, find group ncid. */
412EXTERNL int
413nc_inq_grp_ncid(int ncid, char *grp_name, int *grp_ncid);
414
415/* Given a full name and ncid, find group ncid. */
416EXTERNL int
417nc_inq_grp_full_ncid(int ncid, char *full_name, int *grp_ncid);
418
419/* Get a list of ids for all the variables in a group. */
420EXTERNL int 
421nc_inq_varids(int ncid, int *nvars, int *varids);
422
423/* Find all dimids for a location. This finds all dimensions in a
424 * group, or any of its parents. */
425EXTERNL int 
426nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents);
427
428/* Find all user-defined types for a location. This finds all
429 * user-defined types in a group. */
430EXTERNL int 
431nc_inq_typeids(int ncid, int *ntypes, int *typeids);
432
433/* Create a group. its ncid is returned in the new_ncid pointer. */
434EXTERNL int
435nc_def_grp(int parent_ncid, char *name, int *new_ncid);
436
437/* Here are functions for dealing with compound types. */
438
439/* Create a compound type. */
440EXTERNL int
441nc_def_compound(int ncid, size_t size, char *name, nc_type *typeidp);
442
443/* Insert a named field into a compound type. */
444EXTERNL int
445nc_insert_compound(int ncid, nc_type xtype, char *name, 
446                   size_t offset, nc_type field_typeid);
447
448/* Insert a named array into a compound type. */
449EXTERNL int
450nc_insert_array_compound(int ncid, nc_type xtype, char *name, 
451                         size_t offset, nc_type field_typeid,
452                         int ndims, int *dim_sizes);
453
454/* Get the name and size of a type. */
455EXTERNL int
456nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size);
457
458/* Get the name, size, and number of fields in a compound type. */
459EXTERNL int
460nc_inq_compound(int ncid, nc_type xtype, char *name, size_t *sizep, 
461                size_t *nfieldsp);
462
463/* Get the name of a compound type. */
464EXTERNL int
465nc_inq_compound_name(int ncid, nc_type xtype, char *name);
466
467/* Get the size of a compound type. */
468EXTERNL int
469nc_inq_compound_size(int ncid, nc_type xtype, size_t *sizep);
470
471/* Get the number of fields in this compound type. */
472EXTERNL int
473nc_inq_compound_nfields(int ncid, nc_type xtype, size_t *nfieldsp);
474
475/* Given the xtype and the fieldid, get all info about it. */
476EXTERNL int
477nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name, 
478                      size_t *offsetp, nc_type *field_typeidp, int *ndimsp, 
479                      int *dim_sizesp);
480
481/* Given the typeid and the fieldid, get the name. */
482EXTERNL int
483nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid, 
484                          char *name);
485
486/* Given the xtype and the name, get the fieldid. */
487EXTERNL int
488nc_inq_compound_fieldindex(int ncid, nc_type xtype, char *name, 
489                           int *fieldidp);
490
491/* Given the xtype and fieldid, get the offset. */
492EXTERNL int
493nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid, 
494                            size_t *offsetp);
495
496/* Given the xtype and the fieldid, get the type of that field. */
497EXTERNL int
498nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid, 
499                          nc_type *field_typeidp);
500
501/* Given the xtype and the fieldid, get the number of dimensions for
502 * that field (scalars are 0). */
503EXTERNL int
504nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid, 
505                           int *ndimsp);
506
507/* Given the xtype and the fieldid, get the sizes of dimensions for
508 * that field. User must have allocated storage for the dim_sizes. */
509EXTERNL int
510nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid, 
511                               int *dim_sizes);
512
513/* This is the type of arrays of vlens. */
514typedef struct {
515    size_t len; /* Length of VL data (in base type units) */
516    void *p;    /* Pointer to VL data */
517} nc_vlen_t;
518
519/* This is used when creating a compound type. It calls a mysterious C
520 * macro which was found carved into one of the blocks of the
521 * Newgrange passage tomb in County Meath, Ireland. This code has been
522 * carbon dated to 3200 B.C.E. */
523#define NC_COMPOUND_OFFSET(S,M)    (offsetof(S,M))
524
525/* Create a variable length type. */
526EXTERNL int
527nc_def_vlen(int ncid, char *name, nc_type base_typeid, nc_type *xtypep);
528
529/* Find out about a vlen. */
530EXTERNL int
531nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, 
532            nc_type *base_nc_typep);
533
534/* When you read VLEN type the library will actually allocate the
535 * storage space for the data. This storage space must be freed, so
536 * pass the pointer back to this function, when you're done with the
537 * data, and it will free the vlen memory. */
538EXTERNL int
539nc_free_vlen(nc_vlen_t *vl);
540
541/* Put or get one element in a vlen array. */
542EXTERNL int
543nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, 
544                    size_t len, void *data);
545
546EXTERNL int
547nc_get_vlen_element(int ncid, int typeid1, void *vlen_element, 
548                    size_t *len, void *data);
549   
550/* When you read the string type the library will allocate the storage
551 * space for the data. This storage space must be freed, so pass the
552 * pointer back to this function, when you're done with the data, and
553 * it will free the string memory. */
554EXTERNL int
555nc_free_string(size_t len, char **data);
556
557/* Find out about a user defined type. */
558EXTERNL int
559nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *size, 
560                 nc_type *base_nc_typep, size_t *nfieldsp, int *classp);
561
562/* Write an attribute of any type. */
563EXTERNL int
564nc_put_att(int ncid, int varid, const char *name, nc_type xtype, 
565           size_t len, const void *op);
566
567/* Read an attribute of any type. */
568EXTERNL int
569nc_get_att(int ncid, int varid, const char *name, void *ip);
570
571/* Enum type. */
572
573/* Create an enum type. Provide a base type and a name. At the moment
574 * only ints are accepted as base types. */
575EXTERNL int
576nc_def_enum(int ncid, nc_type base_typeid, const char *name, 
577            nc_type *typeidp);
578
579/* Insert a named value into an enum type. The value must fit within
580 * the size of the enum type, the name size must be <= NC_MAX_NAME. */
581EXTERNL int
582nc_insert_enum(int ncid, nc_type xtype, const char *name, 
583               const void *value);
584
585/* Get information about an enum type: its name, base type and the
586 * number of members defined. */
587EXTERNL int
588nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, 
589            size_t *base_sizep, size_t *num_membersp);
590
591/* Get information about an enum member: a name and value. Name size
592 * will be <= NC_MAX_NAME. */
593EXTERNL int
594nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, 
595                   void *value);
596
597
598/* Get enum name from enum value. Name size will be <= NC_MAX_NAME. */
599EXTERNL int
600nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier);
601
602/* Opaque type. */
603
604/* Create an opaque type. Provide a size and a name. */
605EXTERNL int
606nc_def_opaque(int ncid, size_t size, char *name, nc_type *xtypep);
607
608/* Get information about an opaque type. */
609EXTERNL int
610nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep);
611
612/* Write entire var of any type. */
613EXTERNL int
614nc_put_var(int ncid, int varid,  const void *op);
615
616/* Read entire var of any type. */
617EXTERNL int
618nc_get_var(int ncid, int varid,  void *ip);
619
620/* Write one value. */
621EXTERNL int
622nc_put_var1(int ncid, int varid,  const size_t *indexp,
623            const void *op);
624
625/* Read one value. */
626EXTERNL int
627nc_get_var1(int ncid, int varid,  const size_t *indexp, void *ip);
628
629/* Write an array of values. */
630EXTERNL int
631nc_put_vara(int ncid, int varid,  const size_t *startp, 
632            const size_t *countp, const void *op);
633
634/* Read an array of values. */
635EXTERNL int
636nc_get_vara(int ncid, int varid,  const size_t *startp, 
637            const size_t *countp, void *ip);
638
639/* Write slices of an array of values. */
640EXTERNL int
641nc_put_vars(int ncid, int varid,  const size_t *startp, 
642            const size_t *countp, const ptrdiff_t *stridep,
643            const void *op);
644
645/* Read slices of an array of values. */
646EXTERNL int
647nc_get_vars(int ncid, int varid,  const size_t *startp, 
648            const size_t *countp, const ptrdiff_t *stridep,
649            void *ip);
650
651/* Write mapped slices of an array of values. */
652EXTERNL int
653nc_put_varm(int ncid, int varid,  const size_t *startp, 
654            const size_t *countp, const ptrdiff_t *stridep,
655            const ptrdiff_t *imapp, const void *op);
656
657/* Read mapped slices of an array of values. */
658EXTERNL int
659nc_get_varm(int ncid, int varid,  const size_t *startp, 
660            const size_t *countp, const ptrdiff_t *stridep,
661            const ptrdiff_t *imapp, void *ip);
662
663/* Extra netcdf-4 stuff. */
664
665/* Set compression settings for a variable. Lower is faster, higher is
666 * better. Must be called after nc_def_var and before nc_enddef. */
667EXTERNL int
668nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, 
669                   int deflate_level);
670
671/* Find out compression settings of a var. */
672EXTERNL int
673nc_inq_var_deflate(int ncid, int varid, int *shufflep, 
674                   int *deflatep, int *deflate_levelp);
675
676/* Set fletcher32 checksum for a var. This must be done after nc_def_var
677   and before nc_enddef. */
678EXTERNL int
679nc_def_var_fletcher32(int ncid, int varid, int fletcher32);
680   
681/* Inquire about fletcher32 checksum for a var. */
682EXTERNL int
683nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p);
684
685/* Define chunking for a variable. This must be done after nc_def_var
686   and before nc_enddef. */
687EXTERNL int
688nc_def_var_chunking(int ncid, int varid, int storage, size_t *chunksizesp);
689
690/* Inq chunking stuff for a var. */
691EXTERNL int
692nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp);
693
694/* Define fill value behavior for a variable. This must be done after
695   nc_def_var and before nc_enddef. */
696EXTERNL int
697nc_def_var_fill(int ncid, int varid, int no_fill, void *fill_value);
698
699/* Inq fill value setting for a var. */
700EXTERNL int
701nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_value);
702
703/* Define the endianness of a variable. */
704EXTERNL int
705nc_def_var_endian(int ncid, int varid, int endian);
706
707/* Learn about the endianness of a variable. */
708EXTERNL int
709nc_inq_var_endian(int ncid, int varid, int *endianp);
710
711/* Set the fill mode (classic or 64-bit offset files only). */
712EXTERNL int
713nc_set_fill(int ncid, int fillmode, int *old_modep);
714
715/* Set the default nc_create format to NC_FORMAT_CLASSIC,
716 * NC_FORMAT_64BIT, NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC. */
717EXTERNL int
718nc_set_default_format(int format, int *old_formatp);
719
720/* Set the cache size, nelems, and preemption policy. */
721EXTERNL int
722nc_set_chunk_cache(size_t size, size_t nelems, float preemption);
723
724/* Get the cache size, nelems, and preemption policy. */
725EXTERNL int
726nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp);
727
728EXTERNL int
729nc_redef(int ncid);
730
731EXTERNL int
732nc__enddef(int ncid, size_t h_minfree, size_t v_align,
733        size_t v_minfree, size_t r_align);
734
735EXTERNL int
736nc_enddef(int ncid);
737
738EXTERNL int
739nc_sync(int ncid);
740
741EXTERNL int
742nc_abort(int ncid);
743
744EXTERNL int
745nc_close(int ncid);
746
747EXTERNL int
748nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);
749
750EXTERNL int 
751nc_inq_ndims(int ncid, int *ndimsp);
752
753EXTERNL int 
754nc_inq_nvars(int ncid, int *nvarsp);
755
756EXTERNL int 
757nc_inq_natts(int ncid, int *nattsp);
758
759EXTERNL int 
760nc_inq_unlimdim(int ncid, int *unlimdimidp);
761
762/* The next function is for NetCDF-4 only */
763EXTERNL int 
764nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp);
765
766/* Added in 3.6.1 to return format of netCDF file. */
767EXTERNL int
768nc_inq_format(int ncid, int *formatp);
769
770/* Begin _dim */
771
772EXTERNL int
773nc_def_dim(int ncid, const char *name, size_t len, int *idp);
774
775EXTERNL int
776nc_inq_dimid(int ncid, const char *name, int *idp);
777
778EXTERNL int
779nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp);
780
781EXTERNL int 
782nc_inq_dimname(int ncid, int dimid, char *name);
783
784EXTERNL int 
785nc_inq_dimlen(int ncid, int dimid, size_t *lenp);
786
787EXTERNL int
788nc_rename_dim(int ncid, int dimid, const char *name);
789
790/* End _dim */
791/* Begin _att */
792
793EXTERNL int
794nc_inq_att(int ncid, int varid, const char *name,
795           nc_type *xtypep, size_t *lenp);
796
797EXTERNL int 
798nc_inq_attid(int ncid, int varid, const char *name, int *idp);
799
800EXTERNL int 
801nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep);
802
803EXTERNL int 
804nc_inq_attlen(int ncid, int varid, const char *name, size_t *lenp);
805
806EXTERNL int
807nc_inq_attname(int ncid, int varid, int attnum, char *name);
808
809EXTERNL int
810nc_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out);
811
812EXTERNL int
813nc_rename_att(int ncid, int varid, const char *name, const char *newname);
814
815EXTERNL int
816nc_del_att(int ncid, int varid, const char *name);
817
818/* End _att */
819/* Begin {put,get}_att */
820
821EXTERNL int
822nc_put_att_text(int ncid, int varid, const char *name,
823                size_t len, const char *op);
824
825EXTERNL int
826nc_get_att_text(int ncid, int varid, const char *name, char *ip);
827
828EXTERNL int
829nc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype,
830                 size_t len, const unsigned char *op);
831
832EXTERNL int
833nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip);
834
835EXTERNL int
836nc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype,
837                 size_t len, const signed char *op);
838
839EXTERNL int
840nc_get_att_schar(int ncid, int varid, const char *name, signed char *ip);
841
842EXTERNL int
843nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype,
844                 size_t len, const short *op);
845
846EXTERNL int
847nc_get_att_short(int ncid, int varid, const char *name, short *ip);
848
849EXTERNL int
850nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
851               size_t len, const int *op);
852
853EXTERNL int
854nc_get_att_int(int ncid, int varid, const char *name, int *ip);
855
856EXTERNL int
857nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype,
858                size_t len, const long *op);
859
860EXTERNL int
861nc_get_att_long(int ncid, int varid, const char *name, long *ip);
862
863EXTERNL int
864nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype,
865                 size_t len, const float *op);
866
867EXTERNL int
868nc_get_att_float(int ncid, int varid, const char *name, float *ip);
869
870EXTERNL int
871nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
872                  size_t len, const double *op);
873
874EXTERNL int
875nc_get_att_double(int ncid, int varid, const char *name, double *ip);
876
877EXTERNL int
878nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype,
879                 size_t len, const unsigned char *op);
880
881EXTERNL int
882nc_get_att_ubyte(int ncid, int varid, const char *name, 
883                 unsigned char *ip);
884
885EXTERNL int
886nc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype,
887                  size_t len, const unsigned short *op);
888
889EXTERNL int
890nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip);
891
892EXTERNL int
893nc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype,
894                size_t len, const unsigned int *op);
895
896EXTERNL int
897nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip);
898
899EXTERNL int
900nc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype,
901                 size_t len, const long long *op);
902
903EXTERNL int
904nc_get_att_longlong(int ncid, int varid, const char *name, long long *ip);
905
906EXTERNL int
907nc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype,
908                     size_t len, const unsigned long long *op);
909
910EXTERNL int
911nc_get_att_ulonglong(int ncid, int varid, const char *name, 
912                     unsigned long long *ip);
913
914EXTERNL int
915nc_put_att_string(int ncid, int varid, const char *name, 
916                  size_t len, const char **op);
917
918EXTERNL int
919nc_get_att_string(int ncid, int varid, const char *name, char **ip);
920
921/* End {put,get}_att */
922/* Begin _var */
923
924EXTERNL int
925nc_def_var(int ncid, const char *name, nc_type xtype, int ndims, 
926           const int *dimidsp, int *varidp);
927
928EXTERNL int
929nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, 
930           int *ndimsp, int *dimidsp, int *nattsp);
931
932EXTERNL int
933nc_inq_varid(int ncid, const char *name, int *varidp);
934
935EXTERNL int 
936nc_inq_varname(int ncid, int varid, char *name);
937
938EXTERNL int 
939nc_inq_vartype(int ncid, int varid, nc_type *xtypep);
940
941EXTERNL int 
942nc_inq_varndims(int ncid, int varid, int *ndimsp);
943
944EXTERNL int 
945nc_inq_vardimid(int ncid, int varid, int *dimidsp);
946
947EXTERNL int 
948nc_inq_varnatts(int ncid, int varid, int *nattsp);
949
950EXTERNL int
951nc_rename_var(int ncid, int varid, const char *name);
952
953EXTERNL int
954nc_copy_var(int ncid_in, int varid, int ncid_out);
955
956#ifndef ncvarcpy
957/* support the old name for now */
958#define ncvarcpy(ncid_in, varid, ncid_out) ncvarcopy((ncid_in), (varid), (ncid_out))
959#endif
960
961/* End _var */
962/* Begin {put,get}_var1 */
963
964EXTERNL int
965nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op);
966
967EXTERNL int
968nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip);
969
970EXTERNL int
971nc_put_var1_uchar(int ncid, int varid, const size_t *indexp,
972                  const unsigned char *op);
973
974EXTERNL int
975nc_get_var1_uchar(int ncid, int varid, const size_t *indexp,
976                  unsigned char *ip);
977
978EXTERNL int
979nc_put_var1_schar(int ncid, int varid, const size_t *indexp,
980                  const signed char *op);
981
982EXTERNL int
983nc_get_var1_schar(int ncid, int varid, const size_t *indexp,
984                  signed char *ip);
985
986EXTERNL int
987nc_put_var1_short(int ncid, int varid, const size_t *indexp,
988                  const short *op);
989
990EXTERNL int
991nc_get_var1_short(int ncid, int varid, const size_t *indexp,
992                  short *ip);
993
994EXTERNL int
995nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op);
996
997EXTERNL int
998nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip);
999
1000EXTERNL int
1001nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op);
1002
1003EXTERNL int
1004nc_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip);
1005
1006EXTERNL int
1007nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op);
1008
1009EXTERNL int
1010nc_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip);
1011
1012EXTERNL int
1013nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op);
1014
1015EXTERNL int
1016nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip);
1017
1018EXTERNL int
1019nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp, 
1020                  const unsigned char *op);
1021
1022EXTERNL int
1023nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp, 
1024                  unsigned char *ip);
1025
1026EXTERNL int
1027nc_put_var1_ushort(int ncid, int varid, const size_t *indexp, 
1028                   const unsigned short *op);
1029
1030EXTERNL int
1031nc_get_var1_ushort(int ncid, int varid, const size_t *indexp, 
1032                   unsigned short *ip);
1033
1034EXTERNL int
1035nc_put_var1_uint(int ncid, int varid, const size_t *indexp, 
1036                 const unsigned int *op);
1037
1038EXTERNL int
1039nc_get_var1_uint(int ncid, int varid, const size_t *indexp, 
1040                 unsigned int *ip);
1041
1042EXTERNL int
1043nc_put_var1_longlong(int ncid, int varid, const size_t *indexp, 
1044                     const long long *op);
1045
1046EXTERNL int
1047nc_get_var1_longlong(int ncid, int varid, const size_t *indexp, 
1048                  long long *ip);
1049
1050EXTERNL int
1051nc_put_var1_ulonglong(int ncid, int varid, const size_t *indexp, 
1052                   const unsigned long long *op);
1053
1054EXTERNL int
1055nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp, 
1056                   unsigned long long *ip);
1057
1058EXTERNL int
1059nc_put_var1_string(int ncid, int varid, const size_t *indexp, 
1060                   const char **op);
1061
1062EXTERNL int
1063nc_get_var1_string(int ncid, int varid, const size_t *indexp, 
1064                   char **ip);
1065
1066/* End {put,get}_var1 */
1067/* Begin {put,get}_vara */
1068
1069EXTERNL int
1070nc_put_vara_text(int ncid, int varid,
1071        const size_t *startp, const size_t *countp, const char *op);
1072
1073EXTERNL int
1074nc_get_vara_text(int ncid, int varid,
1075        const size_t *startp, const size_t *countp, char *ip);
1076
1077EXTERNL int
1078nc_put_vara_uchar(int ncid, int varid,
1079        const size_t *startp, const size_t *countp, const unsigned char *op);
1080
1081EXTERNL int
1082nc_get_vara_uchar(int ncid, int varid, const size_t *startp, 
1083                  const size_t *countp, unsigned char *ip);
1084
1085EXTERNL int
1086nc_put_vara_schar(int ncid, int varid, const size_t *startp, 
1087                  const size_t *countp, const signed char *op);
1088
1089EXTERNL int
1090nc_get_vara_schar(int ncid, int varid, const size_t *startp, 
1091                  const size_t *countp, signed char *ip);
1092
1093EXTERNL int
1094nc_put_vara_short(int ncid, int varid, const size_t *startp, 
1095                  const size_t *countp, const short *op);
1096
1097EXTERNL int
1098nc_get_vara_short(int ncid, int varid, const size_t *startp, 
1099                  const size_t *countp, short *ip);
1100
1101EXTERNL int
1102nc_put_vara_int(int ncid, int varid, const size_t *startp, 
1103                const size_t *countp, const int *op);
1104
1105EXTERNL int
1106nc_get_vara_int(int ncid, int varid, const size_t *startp, 
1107                const size_t *countp, int *ip);
1108
1109EXTERNL int
1110nc_put_vara_long(int ncid, int varid, const size_t *startp, 
1111                 const size_t *countp, const long *op);
1112
1113EXTERNL int
1114nc_get_vara_long(int ncid, int varid,
1115        const size_t *startp, const size_t *countp, long *ip);
1116
1117EXTERNL int
1118nc_put_vara_float(int ncid, int varid,
1119        const size_t *startp, const size_t *countp, const float *op);
1120
1121EXTERNL int
1122nc_get_vara_float(int ncid, int varid,
1123        const size_t *startp, const size_t *countp, float *ip);
1124
1125EXTERNL int
1126nc_put_vara_double(int ncid, int varid, const size_t *startp, 
1127                   const size_t *countp, const double *op);
1128
1129EXTERNL int
1130nc_get_vara_double(int ncid, int varid, const size_t *startp, 
1131                   const size_t *countp, double *ip);
1132
1133EXTERNL int
1134nc_put_vara_ubyte(int ncid, int varid, const size_t *startp, 
1135                  const size_t *countp, const unsigned char *op);
1136
1137EXTERNL int
1138nc_get_vara_ubyte(int ncid, int varid, const size_t *startp, 
1139                  const size_t *countp, unsigned char *ip);
1140
1141EXTERNL int
1142nc_put_vara_ushort(int ncid, int varid, const size_t *startp, 
1143                   const size_t *countp, const unsigned short *op);
1144
1145EXTERNL int
1146nc_get_vara_ushort(int ncid, int varid, const size_t *startp, 
1147                   const size_t *countp, unsigned short *ip);
1148
1149EXTERNL int
1150nc_put_vara_uint(int ncid, int varid, const size_t *startp, 
1151                 const size_t *countp, const unsigned int *op);
1152
1153EXTERNL int
1154nc_get_vara_uint(int ncid, int varid, const size_t *startp, 
1155                 const size_t *countp, unsigned int *ip);
1156
1157EXTERNL int
1158nc_put_vara_longlong(int ncid, int varid, const size_t *startp, 
1159                  const size_t *countp, const long long *op);
1160
1161EXTERNL int
1162nc_get_vara_longlong(int ncid, int varid, const size_t *startp, 
1163                  const size_t *countp, long long *ip);
1164
1165EXTERNL int
1166nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp, 
1167                   const size_t *countp, const unsigned long long *op);
1168
1169EXTERNL int
1170nc_get_vara_ulonglong(int ncid, int varid, const size_t *startp, 
1171                   const size_t *countp, unsigned long long *ip);
1172
1173EXTERNL int
1174nc_put_vara_string(int ncid, int varid, const size_t *startp, 
1175                   const size_t *countp, const char **op);
1176
1177EXTERNL int
1178nc_get_vara_string(int ncid, int varid, const size_t *startp, 
1179                   const size_t *countp, char **ip);
1180
1181/* End {put,get}_vara */
1182/* Begin {put,get}_vars */
1183
1184EXTERNL int
1185nc_put_vars_text(int ncid, int varid,
1186        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1187        const char *op);
1188
1189EXTERNL int
1190nc_get_vars_text(int ncid, int varid,
1191        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1192        char *ip);
1193
1194EXTERNL int
1195nc_put_vars_uchar(int ncid, int varid,
1196        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1197        const unsigned char *op);
1198
1199EXTERNL int
1200nc_get_vars_uchar(int ncid, int varid,
1201        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1202        unsigned char *ip);
1203
1204EXTERNL int
1205nc_put_vars_schar(int ncid, int varid,
1206        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1207        const signed char *op);
1208
1209EXTERNL int
1210nc_get_vars_schar(int ncid, int varid,
1211        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1212        signed char *ip);
1213
1214EXTERNL int
1215nc_put_vars_short(int ncid, int varid,
1216        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1217        const short *op);
1218
1219EXTERNL int
1220nc_get_vars_short(int ncid, int varid, const size_t *startp, 
1221                  const size_t *countp, const ptrdiff_t *stridep,
1222                  short *ip);
1223
1224EXTERNL int
1225nc_put_vars_int(int ncid, int varid,
1226        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1227        const int *op);
1228
1229EXTERNL int
1230nc_get_vars_int(int ncid, int varid,
1231        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1232        int *ip);
1233
1234EXTERNL int
1235nc_put_vars_long(int ncid, int varid,
1236        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1237        const long *op);
1238
1239EXTERNL int
1240nc_get_vars_long(int ncid, int varid,
1241        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1242        long *ip);
1243
1244EXTERNL int
1245nc_put_vars_float(int ncid, int varid,
1246        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1247        const float *op);
1248
1249EXTERNL int
1250nc_get_vars_float(int ncid, int varid,
1251        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1252        float *ip);
1253
1254EXTERNL int
1255nc_put_vars_double(int ncid, int varid,
1256        const size_t *startp, const size_t *countp, const ptrdiff_t *stridep,
1257        const double *op);
1258
1259EXTERNL int
1260nc_get_vars_double(int ncid, int varid, const size_t *startp, 
1261                   const size_t *countp, const ptrdiff_t *stridep,
1262                   double *ip);
1263
1264EXTERNL int
1265nc_put_vars_ubyte(int ncid, int varid, const size_t *startp, 
1266                  const size_t *countp, const ptrdiff_t *stridep, 
1267                  const unsigned char *op);
1268
1269EXTERNL int
1270nc_get_vars_ubyte(int ncid, int varid, const size_t *startp, 
1271                  const size_t *countp, const ptrdiff_t *stridep, 
1272                  unsigned char *ip);
1273
1274EXTERNL int
1275nc_put_vars_ushort(int ncid, int varid, const size_t *startp, 
1276                   const size_t *countp, const ptrdiff_t *stridep, 
1277                   const unsigned short *op);
1278
1279EXTERNL int
1280nc_get_vars_ushort(int ncid, int varid, const size_t *startp, 
1281                   const size_t *countp, const ptrdiff_t *stridep, 
1282                   unsigned short *ip);
1283
1284EXTERNL int
1285nc_put_vars_uint(int ncid, int varid, const size_t *startp, 
1286                 const size_t *countp, const ptrdiff_t *stridep, 
1287                 const unsigned int *op);
1288
1289EXTERNL int
1290nc_get_vars_uint(int ncid, int varid, const size_t *startp, 
1291                 const size_t *countp, const ptrdiff_t *stridep, 
1292                 unsigned int *ip);
1293
1294EXTERNL int
1295nc_put_vars_longlong(int ncid, int varid, const size_t *startp, 
1296                  const size_t *countp, const ptrdiff_t *stridep, 
1297                  const long long *op);
1298
1299EXTERNL int
1300nc_get_vars_longlong(int ncid, int varid, const size_t *startp, 
1301                  const size_t *countp, const ptrdiff_t *stridep, 
1302                  long long *ip);
1303
1304EXTERNL int
1305nc_put_vars_ulonglong(int ncid, int varid, const size_t *startp, 
1306                   const size_t *countp, const ptrdiff_t *stridep, 
1307                   const unsigned long long *op);
1308
1309EXTERNL int
1310nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp, 
1311                   const size_t *countp, const ptrdiff_t *stridep, 
1312                   unsigned long long *ip);
1313
1314EXTERNL int
1315nc_put_vars_string(int ncid, int varid, const size_t *startp, 
1316                   const size_t *countp, const ptrdiff_t *stridep, 
1317                   const char **op);
1318
1319EXTERNL int
1320nc_get_vars_string(int ncid, int varid, const size_t *startp, 
1321                   const size_t *countp, const ptrdiff_t *stridep, 
1322                   char **ip);
1323
1324/* End {put,get}_vars */
1325/* Begin {put,get}_varm */
1326
1327EXTERNL int
1328nc_put_varm_text(int ncid, int varid, const size_t *startp, 
1329                 const size_t *countp, const ptrdiff_t *stridep,
1330                 const ptrdiff_t *imapp, const char *op);
1331
1332EXTERNL int
1333nc_get_varm_text(int ncid, int varid, const size_t *startp, 
1334                 const size_t *countp, const ptrdiff_t *stridep,
1335                 const ptrdiff_t *imapp, char *ip);
1336
1337EXTERNL int
1338nc_put_varm_uchar(int ncid, int varid, const size_t *startp, 
1339                  const size_t *countp, const ptrdiff_t *stridep,
1340                  const ptrdiff_t *imapp, const unsigned char *op);
1341
1342EXTERNL int
1343nc_get_varm_uchar(int ncid, int varid, const size_t *startp, 
1344                  const size_t *countp, const ptrdiff_t *stridep,
1345                  const ptrdiff_t *imapp, unsigned char *ip);
1346
1347EXTERNL int
1348nc_put_varm_schar(int ncid, int varid, const size_t *startp, 
1349                  const size_t *countp, const ptrdiff_t *stridep,
1350                  const ptrdiff_t *imapp, const signed char *op);
1351
1352EXTERNL int
1353nc_get_varm_schar(int ncid, int varid, const size_t *startp, 
1354                  const size_t *countp, const ptrdiff_t *stridep,
1355                  const ptrdiff_t *imapp, signed char *ip);
1356
1357EXTERNL int
1358nc_put_varm_short(int ncid, int varid, const size_t *startp, 
1359                  const size_t *countp, const ptrdiff_t *stridep,
1360                  const ptrdiff_t *imapp, const short *op);
1361
1362EXTERNL int
1363nc_get_varm_short(int ncid, int varid, const size_t *startp, 
1364                  const size_t *countp, const ptrdiff_t *stridep,
1365                  const ptrdiff_t *imapp, short *ip);
1366
1367EXTERNL int
1368nc_put_varm_int(int ncid, int varid, const size_t *startp, 
1369                const size_t *countp, const ptrdiff_t *stridep,
1370                const ptrdiff_t *imapp, const int *op);
1371
1372EXTERNL int
1373nc_get_varm_int(int ncid, int varid, const size_t *startp, 
1374                const size_t *countp, const ptrdiff_t *stridep,
1375                const ptrdiff_t *imapp, int *ip);
1376
1377EXTERNL int
1378nc_put_varm_long(int ncid, int varid, const size_t *startp, 
1379                 const size_t *countp, const ptrdiff_t *stridep,
1380                 const ptrdiff_t *imapp, const long *op);
1381
1382EXTERNL int
1383nc_get_varm_long(int ncid, int varid, const size_t *startp, 
1384                 const size_t *countp, const ptrdiff_t *stridep,
1385                 const ptrdiff_t *imapp, long *ip);
1386
1387EXTERNL int
1388nc_put_varm_float(int ncid, int varid,const size_t *startp, 
1389                  const size_t *countp, const ptrdiff_t *stridep,
1390                  const ptrdiff_t *imapp, const float *op);
1391
1392EXTERNL int
1393nc_get_varm_float(int ncid, int varid,const size_t *startp, 
1394                  const size_t *countp, const ptrdiff_t *stridep,
1395                  const ptrdiff_t *imapp, float *ip);
1396
1397EXTERNL int
1398nc_put_varm_double(int ncid, int varid, const size_t *startp, 
1399                   const size_t *countp, const ptrdiff_t *stridep,
1400                   const ptrdiff_t *imapp, const double *op);
1401
1402EXTERNL int
1403nc_get_varm_double(int ncid, int varid, const size_t *startp, 
1404                   const size_t *countp, const ptrdiff_t *stridep,
1405                   const ptrdiff_t * imapp, double *ip);
1406
1407EXTERNL int
1408nc_put_varm_ubyte(int ncid, int varid, const size_t *startp, 
1409                  const size_t *countp, const ptrdiff_t *stridep, 
1410                  const ptrdiff_t * imapp, const unsigned char *op);
1411
1412EXTERNL int
1413nc_get_varm_ubyte(int ncid, int varid, const size_t *startp, 
1414                  const size_t *countp, const ptrdiff_t *stridep, 
1415                  const ptrdiff_t * imapp, unsigned char *ip);
1416
1417EXTERNL int
1418nc_put_varm_ushort(int ncid, int varid, const size_t *startp, 
1419                   const size_t *countp, const ptrdiff_t *stridep, 
1420                   const ptrdiff_t * imapp, const unsigned short *op);
1421
1422EXTERNL int
1423nc_get_varm_ushort(int ncid, int varid, const size_t *startp, 
1424                   const size_t *countp, const ptrdiff_t *stridep, 
1425                   const ptrdiff_t * imapp, unsigned short *ip);
1426
1427EXTERNL int
1428nc_put_varm_uint(int ncid, int varid, const size_t *startp, 
1429                 const size_t *countp, const ptrdiff_t *stridep, 
1430                 const ptrdiff_t * imapp, const unsigned int *op);
1431
1432EXTERNL int
1433nc_get_varm_uint(int ncid, int varid, const size_t *startp, 
1434                 const size_t *countp, const ptrdiff_t *stridep, 
1435                 const ptrdiff_t * imapp, unsigned int *ip);
1436
1437EXTERNL int
1438nc_put_varm_longlong(int ncid, int varid, const size_t *startp, 
1439                  const size_t *countp, const ptrdiff_t *stridep, 
1440                  const ptrdiff_t * imapp, const long long *op);
1441
1442EXTERNL int
1443nc_get_varm_longlong(int ncid, int varid, const size_t *startp, 
1444                  const size_t *countp, const ptrdiff_t *stridep, 
1445                  const ptrdiff_t * imapp, long long *ip);
1446
1447EXTERNL int
1448nc_put_varm_ulonglong(int ncid, int varid, const size_t *startp, 
1449                   const size_t *countp, const ptrdiff_t *stridep, 
1450                   const ptrdiff_t * imapp, const unsigned long long *op);
1451
1452EXTERNL int
1453nc_get_varm_ulonglong(int ncid, int varid, const size_t *startp, 
1454                   const size_t *countp, const ptrdiff_t *stridep, 
1455                   const ptrdiff_t * imapp, unsigned long long *ip);
1456
1457EXTERNL int
1458nc_put_varm_string(int ncid, int varid, const size_t *startp, 
1459                   const size_t *countp, const ptrdiff_t *stridep, 
1460                   const ptrdiff_t * imapp, const char **op);
1461
1462EXTERNL int
1463nc_get_varm_string(int ncid, int varid, const size_t *startp, 
1464                   const size_t *countp, const ptrdiff_t *stridep, 
1465                   const ptrdiff_t * imapp, char **ip);
1466
1467/* End {put,get}_varm */
1468/* Begin {put,get}_var */
1469
1470EXTERNL int
1471nc_put_var_text(int ncid, int varid, const char *op);
1472
1473EXTERNL int
1474nc_get_var_text(int ncid, int varid, char *ip);
1475
1476EXTERNL int
1477nc_put_var_uchar(int ncid, int varid, const unsigned char *op);
1478
1479EXTERNL int
1480nc_get_var_uchar(int ncid, int varid, unsigned char *ip);
1481
1482EXTERNL int
1483nc_put_var_schar(int ncid, int varid, const signed char *op);
1484
1485EXTERNL int
1486nc_get_var_schar(int ncid, int varid, signed char *ip);
1487
1488EXTERNL int
1489nc_put_var_short(int ncid, int varid, const short *op);
1490
1491EXTERNL int
1492nc_get_var_short(int ncid, int varid, short *ip);
1493
1494EXTERNL int
1495nc_put_var_int(int ncid, int varid, const int *op);
1496
1497EXTERNL int
1498nc_get_var_int(int ncid, int varid, int *ip);
1499
1500EXTERNL int
1501nc_put_var_long(int ncid, int varid, const long *op);
1502
1503EXTERNL int
1504nc_get_var_long(int ncid, int varid, long *ip);
1505
1506EXTERNL int
1507nc_put_var_float(int ncid, int varid, const float *op);
1508
1509EXTERNL int
1510nc_get_var_float(int ncid, int varid, float *ip);
1511
1512EXTERNL int
1513nc_put_var_double(int ncid, int varid, const double *op);
1514
1515EXTERNL int
1516nc_get_var_double(int ncid, int varid, double *ip);
1517
1518EXTERNL int
1519nc_put_var_ubyte(int ncid, int varid, const unsigned char *op);
1520
1521EXTERNL int
1522nc_get_var_ubyte(int ncid, int varid, unsigned char *ip);
1523
1524EXTERNL int
1525nc_put_var_ushort(int ncid, int varid, const unsigned short *op);
1526
1527EXTERNL int
1528nc_get_var_ushort(int ncid, int varid, unsigned short *ip);
1529
1530EXTERNL int
1531nc_put_var_uint(int ncid, int varid, const unsigned int *op);
1532
1533EXTERNL int
1534nc_get_var_uint(int ncid, int varid, unsigned int *ip);
1535
1536EXTERNL int
1537nc_put_var_longlong(int ncid, int varid, const long long *op);
1538
1539EXTERNL int
1540nc_get_var_longlong(int ncid, int varid, long long *ip);
1541
1542EXTERNL int
1543nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op);
1544
1545EXTERNL int
1546nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip);
1547
1548EXTERNL int
1549nc_put_var_string(int ncid, int varid, const char **op);
1550
1551EXTERNL int
1552nc_get_var_string(int ncid, int varid, char **ip);
1553
1554#ifdef LOGGING
1555
1556/* Set the log level. 0 shows only errors, 1 only major messages,
1557 * etc., to 5, which shows way too much information. */
1558EXTERNL int
1559nc_set_log_level(int new_level);
1560
1561/* Use this to turn off logging by calling
1562   nc_log_level(NC_TURN_OFF_LOGGING) */
1563#define NC_TURN_OFF_LOGGING (-1)
1564
1565/* Show the netCDF library's in-memory metadata for a file. */
1566EXTERNL int 
1567nc_show_metadata(int ncid);
1568
1569#else /* not LOGGING */
1570
1571#define nc_show_metadata(e)
1572#define nc_set_log_level(e)
1573
1574#endif /* LOGGING */
1575
1576/* End {put,get}_var */
1577
1578/* #ifdef _CRAYMPP */
1579/*
1580 * Public interfaces to better support
1581 * CRAY multi-processor systems like T3E.
1582 * A tip of the hat to NERSC.
1583 */
1584/*
1585 * It turns out we need to declare and define
1586 * these public interfaces on all platforms
1587 * or things get ugly working out the
1588 * FORTRAN interface. On !_CRAYMPP platforms,
1589 * these functions work as advertised, but you
1590 * can only use "processor element" 0.
1591 */
1592
1593EXTERNL int
1594nc__create_mp(const char *path, int cmode, size_t initialsz, int basepe,
1595         size_t *chunksizehintp, int *ncidp);
1596
1597EXTERNL int
1598nc__open_mp(const char *path, int mode, int basepe,
1599        size_t *chunksizehintp, int *ncidp);
1600
1601EXTERNL int
1602nc_delete(const char * path);
1603
1604EXTERNL int
1605nc_delete_mp(const char * path, int basepe);
1606
1607EXTERNL int
1608nc_set_base_pe(int ncid, int pe);
1609
1610EXTERNL int
1611nc_inq_base_pe(int ncid, int *pe);
1612
1613/* #endif _CRAYMPP */
1614
1615/* Begin v2.4 backward compatiblity */
1616/*
1617 * defining NO_NETCDF_2 to the preprocessor
1618 * turns off backward compatiblity declarations.
1619 */
1620#ifndef NO_NETCDF_2
1621
1622/*
1623 * Backward compatible aliases
1624 */
1625#define FILL_BYTE       NC_FILL_BYTE
1626#define FILL_CHAR       NC_FILL_CHAR
1627#define FILL_SHORT      NC_FILL_SHORT
1628#define FILL_LONG       NC_FILL_INT
1629#define FILL_FLOAT      NC_FILL_FLOAT
1630#define FILL_DOUBLE     NC_FILL_DOUBLE
1631
1632#define MAX_NC_DIMS     NC_MAX_DIMS
1633#define MAX_NC_ATTRS    NC_MAX_ATTRS
1634#define MAX_NC_VARS     NC_MAX_VARS
1635#define MAX_NC_NAME     NC_MAX_NAME
1636#define MAX_VAR_DIMS    NC_MAX_VAR_DIMS
1637
1638
1639/*
1640 * Global error status
1641 */
1642EXTERNL int ncerr;
1643
1644#define NC_ENTOOL       NC_EMAXNAME   /* Backward compatibility */
1645#define NC_EXDR         (-32)   /* */
1646#define NC_SYSERR       (-31)
1647
1648/*
1649 * Global options variable.
1650 * Used to determine behavior of error handler.
1651 */
1652#define NC_FATAL        1
1653#define NC_VERBOSE      2
1654
1655EXTERNL int ncopts;     /* default is (NC_FATAL | NC_VERBOSE) */
1656
1657EXTERNL void
1658nc_advise(const char *cdf_routine_name, int err, const char *fmt,...);
1659
1660/*
1661 * C data type corresponding to a netCDF NC_LONG argument,
1662 * a signed 32 bit object.
1663 *
1664 * This is the only thing in this file which architecture dependent.
1665 */
1666typedef int nclong;
1667
1668EXTERNL int
1669nctypelen(nc_type datatype);
1670
1671EXTERNL int
1672nccreate(const char* path, int cmode);
1673
1674EXTERNL int
1675ncopen(const char* path, int mode);
1676
1677EXTERNL int
1678ncsetfill(int ncid, int fillmode);
1679
1680EXTERNL int
1681ncredef(int ncid);
1682
1683EXTERNL int
1684ncendef(int ncid);
1685
1686EXTERNL int
1687ncsync(int ncid);
1688
1689EXTERNL int
1690ncabort(int ncid);
1691
1692EXTERNL int
1693ncclose(int ncid);
1694
1695EXTERNL int
1696ncinquire(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimp);
1697
1698EXTERNL int
1699ncdimdef(int ncid, const char *name, long len);
1700
1701EXTERNL int
1702ncdimid(int ncid, const char *name);
1703
1704EXTERNL int
1705ncdiminq(int ncid, int dimid, char *name, long *lenp);
1706
1707EXTERNL int
1708ncdimrename(int ncid, int dimid, const char *name);
1709
1710EXTERNL int
1711ncattput(int ncid, int varid, const char *name, nc_type xtype,
1712        int len, const void *op);
1713
1714EXTERNL int
1715ncattinq(int ncid, int varid, const char *name, nc_type *xtypep, int *lenp);
1716
1717EXTERNL int
1718ncattget(int ncid, int varid, const char *name, void *ip);
1719
1720EXTERNL int
1721ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out,
1722        int varid_out);
1723
1724EXTERNL int
1725ncattname(int ncid, int varid, int attnum, char *name);
1726
1727EXTERNL int
1728ncattrename(int ncid, int varid, const char *name, const char *newname);
1729
1730EXTERNL int
1731ncattdel(int ncid, int varid, const char *name);
1732
1733EXTERNL int
1734ncvardef(int ncid, const char *name, nc_type xtype,
1735        int ndims, const int *dimidsp);
1736
1737EXTERNL int
1738ncvarid(int ncid, const char *name);
1739
1740EXTERNL int
1741ncvarinq(int ncid, int varid, char *name, nc_type *xtypep,
1742        int *ndimsp, int *dimidsp, int *nattsp);
1743
1744EXTERNL int
1745ncvarput1(int ncid, int varid, const long *indexp, const void *op);
1746
1747EXTERNL int
1748ncvarget1(int ncid, int varid, const long *indexp, void *ip);
1749
1750EXTERNL int
1751ncvarput(int ncid, int varid, const long *startp, const long *countp,
1752        const void *op);
1753
1754EXTERNL int
1755ncvarget(int ncid, int varid, const long *startp, const long *countp, 
1756        void *ip);
1757
1758EXTERNL int
1759ncvarputs(int ncid, int varid, const long *startp, const long *countp,
1760        const long *stridep, const void *op);
1761
1762EXTERNL int
1763ncvargets(int ncid, int varid, const long *startp, const long *countp,
1764        const long *stridep, void *ip);
1765
1766EXTERNL int
1767ncvarputg(int ncid, int varid, const long *startp, const long *countp,
1768        const long *stridep, const long *imapp, const void *op);
1769
1770EXTERNL int
1771ncvargetg(int ncid, int varid, const long *startp, const long *countp,
1772        const long *stridep, const long *imapp, void *ip);
1773
1774EXTERNL int
1775ncvarrename(int ncid, int varid, const char *name);
1776
1777EXTERNL int
1778ncrecinq(int ncid, int *nrecvarsp, int *recvaridsp, long *recsizesp);
1779
1780EXTERNL int
1781ncrecget(int ncid, long recnum, void **datap);
1782
1783EXTERNL int
1784ncrecput(int ncid, long recnum, void *const *datap);
1785
1786/* End v2.4 backward compatiblity */
1787#endif /*!NO_NETCDF_2*/
1788
1789#if defined(__cplusplus)
1790}
1791#endif
1792
1793#endif /* _NETCDF_ */
Note: See TracBrowser for help on using the repository browser.