NetCDF
4.3.2
|
00001 00011 #ifndef _NETCDF_ 00012 #define _NETCDF_ 00013 00014 #include <stddef.h> /* size_t, ptrdiff_t */ 00015 #include <errno.h> /* netcdf functions sometimes return system errors */ 00016 00017 /* Required for alloca on Windows */ 00018 #if defined(_WIN32) || defined(_WIN64) 00019 #include <malloc.h> 00020 #endif 00021 00022 #ifdef _WIN64 00023 #include <sys/stat.h> 00024 #endif 00025 00027 typedef int nc_type; 00028 00029 #if defined(__cplusplus) 00030 extern "C" { 00031 #endif 00032 00033 /* 00034 * The netcdf external data types 00035 */ 00036 #define NC_NAT 0 00037 #define NC_BYTE 1 00038 #define NC_CHAR 2 00039 #define NC_SHORT 3 00040 #define NC_INT 4 00041 #define NC_LONG NC_INT 00042 #define NC_FLOAT 5 00043 #define NC_DOUBLE 6 00044 #define NC_UBYTE 7 00045 #define NC_USHORT 8 00046 #define NC_UINT 9 00047 #define NC_INT64 10 00048 #define NC_UINT64 11 00049 #define NC_STRING 12 00051 #define NC_MAX_ATOMIC_TYPE NC_STRING 00052 00053 /* The following are use internally in support of user-defines 00054 * types. They are also the class returned by nc_inq_user_type. */ 00055 #define NC_VLEN 13 00056 #define NC_OPAQUE 14 00057 #define NC_ENUM 15 00058 #define NC_COMPOUND 16 00060 /* Define the first user defined type id (leave some room) */ 00061 #define NC_FIRSTUSERTYPEID 32 00062 00068 #define NC_FILL_BYTE ((signed char)-127) 00069 #define NC_FILL_CHAR ((char)0) 00070 #define NC_FILL_SHORT ((short)-32767) 00071 #define NC_FILL_INT (-2147483647L) 00072 #define NC_FILL_FLOAT (9.9692099683868690e+36f) /* near 15 * 2^119 */ 00073 #define NC_FILL_DOUBLE (9.9692099683868690e+36) 00074 #define NC_FILL_UBYTE (255) 00075 #define NC_FILL_USHORT (65535) 00076 #define NC_FILL_UINT (4294967295U) 00077 #define NC_FILL_INT64 ((long long)-9223372036854775806LL) 00078 #define NC_FILL_UINT64 ((unsigned long long)18446744073709551614ULL) 00079 #define NC_FILL_STRING "" 00080 00090 #define NC_MAX_BYTE 127 00091 #define NC_MIN_BYTE (-NC_MAX_BYTE-1) 00092 #define NC_MAX_CHAR 255 00093 #define NC_MAX_SHORT 32767 00094 #define NC_MIN_SHORT (-NC_MAX_SHORT - 1) 00095 #define NC_MAX_INT 2147483647 00096 #define NC_MIN_INT (-NC_MAX_INT - 1) 00097 #define NC_MAX_FLOAT 3.402823466e+38f 00098 #define NC_MIN_FLOAT (-NC_MAX_FLOAT) 00099 #define NC_MAX_DOUBLE 1.7976931348623157e+308 00100 #define NC_MIN_DOUBLE (-NC_MAX_DOUBLE) 00101 #define NC_MAX_UBYTE NC_MAX_CHAR 00102 #define NC_MAX_USHORT 65535U 00103 #define NC_MAX_UINT 4294967295U 00104 #define NC_MAX_INT64 (9223372036854775807LL) 00105 #define NC_MIN_INT64 (-9223372036854775807LL-1) 00106 #define NC_MAX_UINT64 (18446744073709551615ULL) 00107 #define X_INT64_MAX (9223372036854775807LL) 00108 #define X_INT64_MIN (-X_INT64_MAX - 1) 00109 #define X_UINT64_MAX (18446744073709551615ULL) 00110 00117 #define _FillValue "_FillValue" 00118 #define NC_FILL 0 00119 #define NC_NOFILL 0x100 00121 /* Define the ioflags bits for nc_create and nc_open. 00122 currently unused: 0x0010,0x0020,0x0040,0x0080 00123 and the whole upper 16 bits 00124 */ 00125 00126 #define NC_NOWRITE 0x0000 00127 #define NC_WRITE 0x0001 00128 /* unused: 0x0002 */ 00129 #define NC_CLOBBER 0x0000 00130 #define NC_NOCLOBBER 0x0004 00132 #define NC_DISKLESS 0x0008 00133 #define NC_MMAP 0x0010 00135 #define NC_CLASSIC_MODEL 0x0100 00136 #define NC_64BIT_OFFSET 0x0200 00142 #define NC_LOCK 0x0400 00143 00146 #define NC_SHARE 0x0800 00147 00148 #define NC_NETCDF4 0x1000 00152 #define NC_MPIIO 0x2000 00153 00155 #define NC_MPIPOSIX 0x4000 00156 #define NC_PNETCDF 0x8000 00165 #define NC_FORMAT_CLASSIC (1) 00166 #define NC_FORMAT_64BIT (2) 00167 #define NC_FORMAT_NETCDF4 (3) 00168 #define NC_FORMAT_NETCDF4_CLASSIC (4) 00169 00188 #define NC_FORMAT_NC3 (1) 00189 #define NC_FORMAT_NC_HDF5 (2) /*cdf 4 subset of HDF5 */ 00190 #define NC_FORMAT_NC_HDF4 (3) /* netcdf 4 subset of HDF4 */ 00191 #define NC_FORMAT_PNETCDF (4) 00192 #define NC_FORMAT_DAP2 (5) 00193 #define NC_FORMAT_DAP4 (6) 00194 #define NC_FORMAT_UNDEFINED (0) 00195 00198 #define NC_SIZEHINT_DEFAULT 0 00199 00201 #define NC_ALIGN_CHUNK ((size_t)(-1)) 00202 00204 #define NC_UNLIMITED 0L 00205 00207 #define NC_GLOBAL -1 00208 00228 #define NC_MAX_DIMS 65536 00229 #define NC_MAX_ATTRS 8192 00230 #define NC_MAX_VARS 524288 00231 #define NC_MAX_NAME 256 00232 #define NC_MAX_VAR_DIMS 1024 00236 #define NC_MAX_HDF4_NAME 64 00237 00241 #define NC_ENDIAN_NATIVE 0 00242 #define NC_ENDIAN_LITTLE 1 00243 #define NC_ENDIAN_BIG 2 00244 00250 #define NC_CHUNKED 0 00251 #define NC_CONTIGUOUS 1 00252 00259 #define NC_NOCHECKSUM 0 00260 #define NC_FLETCHER32 1 00261 00268 #define NC_NOSHUFFLE 0 00269 #define NC_SHUFFLE 1 00270 00276 #define NC_ISSYSERR(err) ((err) > 0) 00277 00278 #define NC_NOERR 0 00279 #define NC2_ERR (-1) 00285 #define NC_EBADID (-33) 00286 #define NC_ENFILE (-34) 00287 #define NC_EEXIST (-35) 00288 #define NC_EINVAL (-36) 00289 #define NC_EPERM (-37) 00294 #define NC_ENOTINDEFINE (-38) 00295 00303 #define NC_EINDEFINE (-39) 00304 00310 #define NC_EINVALCOORDS (-40) 00311 #define NC_EMAXDIMS (-41) 00312 #define NC_ENAMEINUSE (-42) 00313 #define NC_ENOTATT (-43) 00314 #define NC_EMAXATTS (-44) 00315 #define NC_EBADTYPE (-45) 00316 #define NC_EBADDIM (-46) 00317 #define NC_EUNLIMPOS (-47) 00322 #define NC_EMAXVARS (-48) 00323 00327 #define NC_ENOTVAR (-49) 00328 #define NC_EGLOBAL (-50) 00329 #define NC_ENOTNC (-51) 00330 #define NC_ESTS (-52) 00331 #define NC_EMAXNAME (-53) 00332 #define NC_EUNLIMIT (-54) 00333 #define NC_ENORECVARS (-55) 00334 #define NC_ECHAR (-56) 00343 #define NC_EEDGE (-57) 00344 #define NC_ESTRIDE (-58) 00345 #define NC_EBADNAME (-59) 00346 /* N.B. following must match value in ncx.h */ 00347 00352 #define NC_ERANGE (-60) 00353 #define NC_ENOMEM (-61) 00354 #define NC_EVARSIZE (-62) 00355 #define NC_EDIMSIZE (-63) 00356 #define NC_ETRUNC (-64) 00357 #define NC_EAXISTYPE (-65) 00359 /* Following errors are added for DAP */ 00360 #define NC_EDAP (-66) 00361 #define NC_ECURL (-67) 00362 #define NC_EIO (-68) 00363 #define NC_ENODATA (-69) 00364 #define NC_EDAPSVC (-70) 00365 #define NC_EDAS (-71) 00366 #define NC_EDDS (-72) 00367 #define NC_EDATADDS (-73) 00368 #define NC_EDAPURL (-74) 00369 #define NC_EDAPCONSTRAINT (-75) 00370 #define NC_ETRANSLATION (-76) 00371 #define NC_EACCESS (-77) 00372 #define NC_EAUTH (-78) 00374 /* Misc. additional errors */ 00375 #define NC_ENOTFOUND (-90) 00376 #define NC_ECANTREMOVE (-91) 00378 /* The following was added in support of netcdf-4. Make all netcdf-4 00379 error codes < -100 so that errors can be added to netcdf-3 if 00380 needed. */ 00381 #define NC4_FIRST_ERROR (-100) 00382 00384 #define NC_EHDFERR (-101) 00385 #define NC_ECANTREAD (-102) 00386 #define NC_ECANTWRITE (-103) 00387 #define NC_ECANTCREATE (-104) 00388 #define NC_EFILEMETA (-105) 00389 #define NC_EDIMMETA (-106) 00390 #define NC_EATTMETA (-107) 00391 #define NC_EVARMETA (-108) 00392 #define NC_ENOCOMPOUND (-109) 00393 #define NC_EATTEXISTS (-110) 00394 #define NC_ENOTNC4 (-111) 00397 #define NC_ESTRICTNC3 (-112) 00398 #define NC_ENOTNC3 (-113) 00399 #define NC_ENOPAR (-114) 00400 #define NC_EPARINIT (-115) 00401 #define NC_EBADGRPID (-116) 00402 #define NC_EBADTYPID (-117) 00403 #define NC_ETYPDEFINED (-118) 00404 #define NC_EBADFIELD (-119) 00405 #define NC_EBADCLASS (-120) 00406 #define NC_EMAPTYPE (-121) 00407 #define NC_ELATEFILL (-122) 00408 #define NC_ELATEDEF (-123) 00409 #define NC_EDIMSCALE (-124) 00410 #define NC_ENOGRP (-125) 00411 #define NC_ESTORAGE (-126) 00412 #define NC_EBADCHUNK (-127) 00413 #define NC_ENOTBUILT (-128) 00414 #define NC_EDISKLESS (-129) 00415 #define NC_ECANTEXTEND (-130) 00416 #define NC_EMPI (-131) 00418 #define NC4_LAST_ERROR (-131) 00419 00420 /* This is used in netCDF-4 files for dimensions without coordinate 00421 * vars. */ 00422 #define DIM_WITHOUT_VARIABLE "This is a netCDF dimension but not a netCDF variable." 00423 00424 /* This is here at the request of the NCO team to support our 00425 * mistake of having chunksizes be first ints, then size_t. Doh! */ 00426 #define NC_HAVE_NEW_CHUNKING_API 1 00427 00428 00429 /*Errors for all remote access methods(e.g. DAP and CDMREMOTE)*/ 00430 #define NC_EURL (NC_EDAPURL) /* Malformed URL */ 00431 #define NC_ECONSTRAINT (NC_EDAPCONSTRAINT) /* Malformed Constraint*/ 00432 00433 00434 /* 00435 * The Interface 00436 */ 00437 00438 /* Declaration modifiers for DLL support (MSC et al) */ 00439 #if defined(DLL_NETCDF) /* define when library is a DLL */ 00440 # if defined(DLL_EXPORT) /* define when building the library */ 00441 # define MSC_EXTRA __declspec(dllexport) 00442 # else 00443 # define MSC_EXTRA __declspec(dllimport) 00444 # endif 00445 #include <io.h> 00446 #else 00447 #define MSC_EXTRA 00448 #endif /* defined(DLL_NETCDF) */ 00449 00450 # define EXTERNL MSC_EXTRA extern 00451 00452 #if defined(DLL_NETCDF) /* define when library is a DLL */ 00453 EXTERNL int ncerr; 00454 EXTERNL int ncopts; 00455 #endif 00456 00457 EXTERNL const char * 00458 nc_inq_libvers(void); 00459 00460 EXTERNL const char * 00461 nc_strerror(int ncerr); 00462 00463 EXTERNL int 00464 nc__create(const char *path, int cmode, size_t initialsz, 00465 size_t *chunksizehintp, int *ncidp); 00466 00467 EXTERNL int 00468 nc_create(const char *path, int cmode, int *ncidp); 00469 00470 EXTERNL int 00471 nc__open(const char *path, int mode, 00472 size_t *chunksizehintp, int *ncidp); 00473 00474 EXTERNL int 00475 nc_open(const char *path, int mode, int *ncidp); 00476 00477 /* Learn the path used to open/create the file. */ 00478 EXTERNL int 00479 nc_inq_path(int ncid, size_t *pathlen, char *path); 00480 00481 /* Given an ncid and group name (NULL gets root group), return 00482 * locid. */ 00483 EXTERNL int 00484 nc_inq_ncid(int ncid, const char *name, int *grp_ncid); 00485 00486 /* Given a location id, return the number of groups it contains, and 00487 * an array of their locids. */ 00488 EXTERNL int 00489 nc_inq_grps(int ncid, int *numgrps, int *ncids); 00490 00491 /* Given locid, find name of group. (Root group is named "/".) */ 00492 EXTERNL int 00493 nc_inq_grpname(int ncid, char *name); 00494 00495 /* Given ncid, find full name and len of full name. (Root group is 00496 * named "/", with length 1.) */ 00497 EXTERNL int 00498 nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name); 00499 00500 /* Given ncid, find len of full name. */ 00501 EXTERNL int 00502 nc_inq_grpname_len(int ncid, size_t *lenp); 00503 00504 /* Given an ncid, find the ncid of its parent group. */ 00505 EXTERNL int 00506 nc_inq_grp_parent(int ncid, int *parent_ncid); 00507 00508 /* Given a name and parent ncid, find group ncid. */ 00509 EXTERNL int 00510 nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid); 00511 00512 /* Given a full name and ncid, find group ncid. */ 00513 EXTERNL int 00514 nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid); 00515 00516 /* Get a list of ids for all the variables in a group. */ 00517 EXTERNL int 00518 nc_inq_varids(int ncid, int *nvars, int *varids); 00519 00520 /* Find all dimids for a location. This finds all dimensions in a 00521 * group, or any of its parents. */ 00522 EXTERNL int 00523 nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents); 00524 00525 /* Find all user-defined types for a location. This finds all 00526 * user-defined types in a group. */ 00527 EXTERNL int 00528 nc_inq_typeids(int ncid, int *ntypes, int *typeids); 00529 00530 /* Are two types equal? */ 00531 EXTERNL int 00532 nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, 00533 nc_type typeid2, int *equal); 00534 00535 /* Create a group. its ncid is returned in the new_ncid pointer. */ 00536 EXTERNL int 00537 nc_def_grp(int parent_ncid, const char *name, int *new_ncid); 00538 00539 /* Rename a group */ 00540 EXTERNL int 00541 nc_rename_grp(int grpid, const char *name); 00542 00543 /* Here are functions for dealing with compound types. */ 00544 00545 /* Create a compound type. */ 00546 EXTERNL int 00547 nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp); 00548 00549 /* Insert a named field into a compound type. */ 00550 EXTERNL int 00551 nc_insert_compound(int ncid, nc_type xtype, const char *name, 00552 size_t offset, nc_type field_typeid); 00553 00554 /* Insert a named array into a compound type. */ 00555 EXTERNL int 00556 nc_insert_array_compound(int ncid, nc_type xtype, const char *name, 00557 size_t offset, nc_type field_typeid, 00558 int ndims, const int *dim_sizes); 00559 00560 /* Get the name and size of a type. */ 00561 EXTERNL int 00562 nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size); 00563 00564 /* Get the id of a type from the name. */ 00565 EXTERNL int 00566 nc_inq_typeid(int ncid, const char *name, nc_type *typeidp); 00567 00568 /* Get the name, size, and number of fields in a compound type. */ 00569 EXTERNL int 00570 nc_inq_compound(int ncid, nc_type xtype, char *name, size_t *sizep, 00571 size_t *nfieldsp); 00572 00573 /* Get the name of a compound type. */ 00574 EXTERNL int 00575 nc_inq_compound_name(int ncid, nc_type xtype, char *name); 00576 00577 /* Get the size of a compound type. */ 00578 EXTERNL int 00579 nc_inq_compound_size(int ncid, nc_type xtype, size_t *sizep); 00580 00581 /* Get the number of fields in this compound type. */ 00582 EXTERNL int 00583 nc_inq_compound_nfields(int ncid, nc_type xtype, size_t *nfieldsp); 00584 00585 /* Given the xtype and the fieldid, get all info about it. */ 00586 EXTERNL int 00587 nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name, 00588 size_t *offsetp, nc_type *field_typeidp, int *ndimsp, 00589 int *dim_sizesp); 00590 00591 /* Given the typeid and the fieldid, get the name. */ 00592 EXTERNL int 00593 nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid, 00594 char *name); 00595 00596 /* Given the xtype and the name, get the fieldid. */ 00597 EXTERNL int 00598 nc_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name, 00599 int *fieldidp); 00600 00601 /* Given the xtype and fieldid, get the offset. */ 00602 EXTERNL int 00603 nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid, 00604 size_t *offsetp); 00605 00606 /* Given the xtype and the fieldid, get the type of that field. */ 00607 EXTERNL int 00608 nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid, 00609 nc_type *field_typeidp); 00610 00611 /* Given the xtype and the fieldid, get the number of dimensions for 00612 * that field (scalars are 0). */ 00613 EXTERNL int 00614 nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid, 00615 int *ndimsp); 00616 00617 /* Given the xtype and the fieldid, get the sizes of dimensions for 00618 * that field. User must have allocated storage for the dim_sizes. */ 00619 EXTERNL int 00620 nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid, 00621 int *dim_sizes); 00622 00624 typedef struct { 00625 size_t len; 00626 void *p; 00627 } nc_vlen_t; 00628 00633 #define NC_COMPOUND_OFFSET(S,M) (offsetof(S,M)) 00634 00635 /* Create a variable length type. */ 00636 EXTERNL int 00637 nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep); 00638 00639 /* Find out about a vlen. */ 00640 EXTERNL int 00641 nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, 00642 nc_type *base_nc_typep); 00643 00644 /* When you read VLEN type the library will actually allocate the 00645 * storage space for the data. This storage space must be freed, so 00646 * pass the pointer back to this function, when you're done with the 00647 * data, and it will free the vlen memory. */ 00648 EXTERNL int 00649 nc_free_vlen(nc_vlen_t *vl); 00650 00651 EXTERNL int 00652 nc_free_vlens(size_t len, nc_vlen_t vlens[]); 00653 00654 /* Put or get one element in a vlen array. */ 00655 EXTERNL int 00656 nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, 00657 size_t len, const void *data); 00658 00659 EXTERNL int 00660 nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element, 00661 size_t *len, void *data); 00662 00663 /* When you read the string type the library will allocate the storage 00664 * space for the data. This storage space must be freed, so pass the 00665 * pointer back to this function, when you're done with the data, and 00666 * it will free the string memory. */ 00667 EXTERNL int 00668 nc_free_string(size_t len, char **data); 00669 00670 /* Find out about a user defined type. */ 00671 EXTERNL int 00672 nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *size, 00673 nc_type *base_nc_typep, size_t *nfieldsp, int *classp); 00674 00675 /* Write an attribute of any type. */ 00676 EXTERNL int 00677 nc_put_att(int ncid, int varid, const char *name, nc_type xtype, 00678 size_t len, const void *op); 00679 00680 /* Read an attribute of any type. */ 00681 EXTERNL int 00682 nc_get_att(int ncid, int varid, const char *name, void *ip); 00683 00684 /* Enum type. */ 00685 00686 /* Create an enum type. Provide a base type and a name. At the moment 00687 * only ints are accepted as base types. */ 00688 EXTERNL int 00689 nc_def_enum(int ncid, nc_type base_typeid, const char *name, 00690 nc_type *typeidp); 00691 00692 /* Insert a named value into an enum type. The value must fit within 00693 * the size of the enum type, the name size must be <= NC_MAX_NAME. */ 00694 EXTERNL int 00695 nc_insert_enum(int ncid, nc_type xtype, const char *name, 00696 const void *value); 00697 00698 /* Get information about an enum type: its name, base type and the 00699 * number of members defined. */ 00700 EXTERNL int 00701 nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, 00702 size_t *base_sizep, size_t *num_membersp); 00703 00704 /* Get information about an enum member: a name and value. Name size 00705 * will be <= NC_MAX_NAME. */ 00706 EXTERNL int 00707 nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, 00708 void *value); 00709 00710 00711 /* Get enum name from enum value. Name size will be <= NC_MAX_NAME. */ 00712 EXTERNL int 00713 nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier); 00714 00715 /* Opaque type. */ 00716 00717 /* Create an opaque type. Provide a size and a name. */ 00718 EXTERNL int 00719 nc_def_opaque(int ncid, size_t size, const char *name, nc_type *xtypep); 00720 00721 /* Get information about an opaque type. */ 00722 EXTERNL int 00723 nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep); 00724 00725 /* Write entire var of any type. */ 00726 EXTERNL int 00727 nc_put_var(int ncid, int varid, const void *op); 00728 00729 /* Read entire var of any type. */ 00730 EXTERNL int 00731 nc_get_var(int ncid, int varid, void *ip); 00732 00733 /* Write one value. */ 00734 EXTERNL int 00735 nc_put_var1(int ncid, int varid, const size_t *indexp, 00736 const void *op); 00737 00738 /* Read one value. */ 00739 EXTERNL int 00740 nc_get_var1(int ncid, int varid, const size_t *indexp, void *ip); 00741 00742 /* Write an array of values. */ 00743 EXTERNL int 00744 nc_put_vara(int ncid, int varid, const size_t *startp, 00745 const size_t *countp, const void *op); 00746 00747 /* Read an array of values. */ 00748 EXTERNL int 00749 nc_get_vara(int ncid, int varid, const size_t *startp, 00750 const size_t *countp, void *ip); 00751 00752 /* Write slices of an array of values. */ 00753 EXTERNL int 00754 nc_put_vars(int ncid, int varid, const size_t *startp, 00755 const size_t *countp, const ptrdiff_t *stridep, 00756 const void *op); 00757 00758 /* Read slices of an array of values. */ 00759 EXTERNL int 00760 nc_get_vars(int ncid, int varid, const size_t *startp, 00761 const size_t *countp, const ptrdiff_t *stridep, 00762 void *ip); 00763 00764 /* Write mapped slices of an array of values. */ 00765 EXTERNL int 00766 nc_put_varm(int ncid, int varid, const size_t *startp, 00767 const size_t *countp, const ptrdiff_t *stridep, 00768 const ptrdiff_t *imapp, const void *op); 00769 00770 /* Read mapped slices of an array of values. */ 00771 EXTERNL int 00772 nc_get_varm(int ncid, int varid, const size_t *startp, 00773 const size_t *countp, const ptrdiff_t *stridep, 00774 const ptrdiff_t *imapp, void *ip); 00775 00776 /* Extra netcdf-4 stuff. */ 00777 00778 /* Set compression settings for a variable. Lower is faster, higher is 00779 * better. Must be called after nc_def_var and before nc_enddef. */ 00780 EXTERNL int 00781 nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, 00782 int deflate_level); 00783 00784 /* Find out compression settings of a var. */ 00785 EXTERNL int 00786 nc_inq_var_deflate(int ncid, int varid, int *shufflep, 00787 int *deflatep, int *deflate_levelp); 00788 00789 /* Find out szip settings of a var. */ 00790 EXTERNL int 00791 nc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp); 00792 00793 /* Set fletcher32 checksum for a var. This must be done after nc_def_var 00794 and before nc_enddef. */ 00795 EXTERNL int 00796 nc_def_var_fletcher32(int ncid, int varid, int fletcher32); 00797 00798 /* Inquire about fletcher32 checksum for a var. */ 00799 EXTERNL int 00800 nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p); 00801 00802 /* Define chunking for a variable. This must be done after nc_def_var 00803 and before nc_enddef. */ 00804 EXTERNL int 00805 nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp); 00806 00807 /* Inq chunking stuff for a var. */ 00808 EXTERNL int 00809 nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp); 00810 00811 /* Define fill value behavior for a variable. This must be done after 00812 nc_def_var and before nc_enddef. */ 00813 EXTERNL int 00814 nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value); 00815 00816 /* Inq fill value setting for a var. */ 00817 EXTERNL int 00818 nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep); 00819 00820 /* Define the endianness of a variable. */ 00821 EXTERNL int 00822 nc_def_var_endian(int ncid, int varid, int endian); 00823 00824 /* Learn about the endianness of a variable. */ 00825 EXTERNL int 00826 nc_inq_var_endian(int ncid, int varid, int *endianp); 00827 00828 /* Set the fill mode (classic or 64-bit offset files only). */ 00829 EXTERNL int 00830 nc_set_fill(int ncid, int fillmode, int *old_modep); 00831 00832 /* Set the default nc_create format to NC_FORMAT_CLASSIC, 00833 * NC_FORMAT_64BIT, NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC. */ 00834 EXTERNL int 00835 nc_set_default_format(int format, int *old_formatp); 00836 00837 /* Set the cache size, nelems, and preemption policy. */ 00838 EXTERNL int 00839 nc_set_chunk_cache(size_t size, size_t nelems, float preemption); 00840 00841 /* Get the cache size, nelems, and preemption policy. */ 00842 EXTERNL int 00843 nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp); 00844 00845 /* Set the per-variable cache size, nelems, and preemption policy. */ 00846 EXTERNL int 00847 nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, 00848 float preemption); 00849 00850 /* Set the per-variable cache size, nelems, and preemption policy. */ 00851 EXTERNL int 00852 nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, 00853 float *preemptionp); 00854 00855 EXTERNL int 00856 nc_redef(int ncid); 00857 00858 /* Is this ever used? */ 00859 EXTERNL int 00860 nc__enddef(int ncid, size_t h_minfree, size_t v_align, 00861 size_t v_minfree, size_t r_align); 00862 00863 EXTERNL int 00864 nc_enddef(int ncid); 00865 00866 EXTERNL int 00867 nc_sync(int ncid); 00868 00869 EXTERNL int 00870 nc_abort(int ncid); 00871 00872 EXTERNL int 00873 nc_close(int ncid); 00874 00875 EXTERNL int 00876 nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp); 00877 00878 EXTERNL int 00879 nc_inq_ndims(int ncid, int *ndimsp); 00880 00881 EXTERNL int 00882 nc_inq_nvars(int ncid, int *nvarsp); 00883 00884 EXTERNL int 00885 nc_inq_natts(int ncid, int *nattsp); 00886 00887 EXTERNL int 00888 nc_inq_unlimdim(int ncid, int *unlimdimidp); 00889 00890 /* The next function is for NetCDF-4 only */ 00891 EXTERNL int 00892 nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp); 00893 00894 /* Added in 3.6.1 to return format of netCDF file. */ 00895 EXTERNL int 00896 nc_inq_format(int ncid, int *formatp); 00897 00898 /* Added in 4.3.1 to return additional format info */ 00899 EXTERNL int 00900 nc_inq_format_extended(int ncid, int *formatp, int* modep); 00901 00902 /* Begin _dim */ 00903 00904 EXTERNL int 00905 nc_def_dim(int ncid, const char *name, size_t len, int *idp); 00906 00907 EXTERNL int 00908 nc_inq_dimid(int ncid, const char *name, int *idp); 00909 00910 EXTERNL int 00911 nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp); 00912 00913 EXTERNL int 00914 nc_inq_dimname(int ncid, int dimid, char *name); 00915 00916 EXTERNL int 00917 nc_inq_dimlen(int ncid, int dimid, size_t *lenp); 00918 00919 EXTERNL int 00920 nc_rename_dim(int ncid, int dimid, const char *name); 00921 00922 /* End _dim */ 00923 /* Begin _att */ 00924 00925 EXTERNL int 00926 nc_inq_att(int ncid, int varid, const char *name, 00927 nc_type *xtypep, size_t *lenp); 00928 00929 EXTERNL int 00930 nc_inq_attid(int ncid, int varid, const char *name, int *idp); 00931 00932 EXTERNL int 00933 nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep); 00934 00935 EXTERNL int 00936 nc_inq_attlen(int ncid, int varid, const char *name, size_t *lenp); 00937 00938 EXTERNL int 00939 nc_inq_attname(int ncid, int varid, int attnum, char *name); 00940 00941 EXTERNL int 00942 nc_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out); 00943 00944 EXTERNL int 00945 nc_rename_att(int ncid, int varid, const char *name, const char *newname); 00946 00947 EXTERNL int 00948 nc_del_att(int ncid, int varid, const char *name); 00949 00950 /* End _att */ 00951 /* Begin {put,get}_att */ 00952 00953 EXTERNL int 00954 nc_put_att_text(int ncid, int varid, const char *name, 00955 size_t len, const char *op); 00956 00957 EXTERNL int 00958 nc_get_att_text(int ncid, int varid, const char *name, char *ip); 00959 00960 EXTERNL int 00961 nc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, 00962 size_t len, const unsigned char *op); 00963 00964 EXTERNL int 00965 nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip); 00966 00967 EXTERNL int 00968 nc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, 00969 size_t len, const signed char *op); 00970 00971 EXTERNL int 00972 nc_get_att_schar(int ncid, int varid, const char *name, signed char *ip); 00973 00974 EXTERNL int 00975 nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, 00976 size_t len, const short *op); 00977 00978 EXTERNL int 00979 nc_get_att_short(int ncid, int varid, const char *name, short *ip); 00980 00981 EXTERNL int 00982 nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, 00983 size_t len, const int *op); 00984 00985 EXTERNL int 00986 nc_get_att_int(int ncid, int varid, const char *name, int *ip); 00987 00988 EXTERNL int 00989 nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, 00990 size_t len, const long *op); 00991 00992 EXTERNL int 00993 nc_get_att_long(int ncid, int varid, const char *name, long *ip); 00994 00995 EXTERNL int 00996 nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, 00997 size_t len, const float *op); 00998 00999 EXTERNL int 01000 nc_get_att_float(int ncid, int varid, const char *name, float *ip); 01001 01002 EXTERNL int 01003 nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, 01004 size_t len, const double *op); 01005 01006 EXTERNL int 01007 nc_get_att_double(int ncid, int varid, const char *name, double *ip); 01008 01009 EXTERNL int 01010 nc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, 01011 size_t len, const unsigned short *op); 01012 01013 EXTERNL int 01014 nc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip); 01015 01016 EXTERNL int 01017 nc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, 01018 size_t len, const unsigned int *op); 01019 01020 EXTERNL int 01021 nc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip); 01022 01023 EXTERNL int 01024 nc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, 01025 size_t len, const long long *op); 01026 01027 EXTERNL int 01028 nc_get_att_longlong(int ncid, int varid, const char *name, long long *ip); 01029 01030 EXTERNL int 01031 nc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, 01032 size_t len, const unsigned long long *op); 01033 01034 EXTERNL int 01035 nc_get_att_ulonglong(int ncid, int varid, const char *name, 01036 unsigned long long *ip); 01037 01038 EXTERNL int 01039 nc_put_att_string(int ncid, int varid, const char *name, 01040 size_t len, const char **op); 01041 01042 EXTERNL int 01043 nc_get_att_string(int ncid, int varid, const char *name, char **ip); 01044 01045 /* End {put,get}_att */ 01046 /* Begin _var */ 01047 01048 EXTERNL int 01049 nc_def_var(int ncid, const char *name, nc_type xtype, int ndims, 01050 const int *dimidsp, int *varidp); 01051 01052 EXTERNL int 01053 nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, 01054 int *ndimsp, int *dimidsp, int *nattsp); 01055 01056 EXTERNL int 01057 nc_inq_varid(int ncid, const char *name, int *varidp); 01058 01059 EXTERNL int 01060 nc_inq_varname(int ncid, int varid, char *name); 01061 01062 EXTERNL int 01063 nc_inq_vartype(int ncid, int varid, nc_type *xtypep); 01064 01065 EXTERNL int 01066 nc_inq_varndims(int ncid, int varid, int *ndimsp); 01067 01068 EXTERNL int 01069 nc_inq_vardimid(int ncid, int varid, int *dimidsp); 01070 01071 EXTERNL int 01072 nc_inq_varnatts(int ncid, int varid, int *nattsp); 01073 01074 EXTERNL int 01075 nc_rename_var(int ncid, int varid, const char *name); 01076 01077 EXTERNL int 01078 nc_copy_var(int ncid_in, int varid, int ncid_out); 01079 01080 #ifndef ncvarcpy 01081 /* support the old name for now */ 01082 #define ncvarcpy(ncid_in, varid, ncid_out) ncvarcopy((ncid_in), (varid), (ncid_out)) 01083 #endif 01084 01085 /* End _var */ 01086 /* Begin {put,get}_var1 */ 01087 01088 EXTERNL int 01089 nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op); 01090 01091 EXTERNL int 01092 nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip); 01093 01094 EXTERNL int 01095 nc_put_var1_uchar(int ncid, int varid, const size_t *indexp, 01096 const unsigned char *op); 01097 01098 EXTERNL int 01099 nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, 01100 unsigned char *ip); 01101 01102 EXTERNL int 01103 nc_put_var1_schar(int ncid, int varid, const size_t *indexp, 01104 const signed char *op); 01105 01106 EXTERNL int 01107 nc_get_var1_schar(int ncid, int varid, const size_t *indexp, 01108 signed char *ip); 01109 01110 EXTERNL int 01111 nc_put_var1_short(int ncid, int varid, const size_t *indexp, 01112 const short *op); 01113 01114 EXTERNL int 01115 nc_get_var1_short(int ncid, int varid, const size_t *indexp, 01116 short *ip); 01117 01118 EXTERNL int 01119 nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op); 01120 01121 EXTERNL int 01122 nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip); 01123 01124 EXTERNL int 01125 nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op); 01126 01127 EXTERNL int 01128 nc_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip); 01129 01130 EXTERNL int 01131 nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op); 01132 01133 EXTERNL int 01134 nc_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip); 01135 01136 EXTERNL int 01137 nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op); 01138 01139 EXTERNL int 01140 nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip); 01141 01142 EXTERNL int 01143 nc_put_var1_ushort(int ncid, int varid, const size_t *indexp, 01144 const unsigned short *op); 01145 01146 EXTERNL int 01147 nc_get_var1_ushort(int ncid, int varid, const size_t *indexp, 01148 unsigned short *ip); 01149 01150 EXTERNL int 01151 nc_put_var1_uint(int ncid, int varid, const size_t *indexp, 01152 const unsigned int *op); 01153 01154 EXTERNL int 01155 nc_get_var1_uint(int ncid, int varid, const size_t *indexp, 01156 unsigned int *ip); 01157 01158 EXTERNL int 01159 nc_put_var1_longlong(int ncid, int varid, const size_t *indexp, 01160 const long long *op); 01161 01162 EXTERNL int 01163 nc_get_var1_longlong(int ncid, int varid, const size_t *indexp, 01164 long long *ip); 01165 01166 EXTERNL int 01167 nc_put_var1_ulonglong(int ncid, int varid, const size_t *indexp, 01168 const unsigned long long *op); 01169 01170 EXTERNL int 01171 nc_get_var1_ulonglong(int ncid, int varid, const size_t *indexp, 01172 unsigned long long *ip); 01173 01174 EXTERNL int 01175 nc_put_var1_string(int ncid, int varid, const size_t *indexp, 01176 const char **op); 01177 01178 EXTERNL int 01179 nc_get_var1_string(int ncid, int varid, const size_t *indexp, 01180 char **ip); 01181 01182 /* End {put,get}_var1 */ 01183 /* Begin {put,get}_vara */ 01184 01185 EXTERNL int 01186 nc_put_vara_text(int ncid, int varid, const size_t *startp, 01187 const size_t *countp, const char *op); 01188 01189 EXTERNL int 01190 nc_get_vara_text(int ncid, int varid, const size_t *startp, 01191 const size_t *countp, char *ip); 01192 01193 EXTERNL int 01194 nc_put_vara_uchar(int ncid, int varid, const size_t *startp, 01195 const size_t *countp, const unsigned char *op); 01196 01197 EXTERNL int 01198 nc_get_vara_uchar(int ncid, int varid, const size_t *startp, 01199 const size_t *countp, unsigned char *ip); 01200 01201 EXTERNL int 01202 nc_put_vara_schar(int ncid, int varid, const size_t *startp, 01203 const size_t *countp, const signed char *op); 01204 01205 EXTERNL int 01206 nc_get_vara_schar(int ncid, int varid, const size_t *startp, 01207 const size_t *countp, signed char *ip); 01208 01209 EXTERNL int 01210 nc_put_vara_short(int ncid, int varid, const size_t *startp, 01211 const size_t *countp, const short *op); 01212 01213 EXTERNL int 01214 nc_get_vara_short(int ncid, int varid, const size_t *startp, 01215 const size_t *countp, short *ip); 01216 01217 EXTERNL int 01218 nc_put_vara_int(int ncid, int varid, const size_t *startp, 01219 const size_t *countp, const int *op); 01220 01221 EXTERNL int 01222 nc_get_vara_int(int ncid, int varid, const size_t *startp, 01223 const size_t *countp, int *ip); 01224 01225 EXTERNL int 01226 nc_put_vara_long(int ncid, int varid, const size_t *startp, 01227 const size_t *countp, const long *op); 01228 01229 EXTERNL int 01230 nc_get_vara_long(int ncid, int varid, 01231 const size_t *startp, const size_t *countp, long *ip); 01232 01233 EXTERNL int 01234 nc_put_vara_float(int ncid, int varid, 01235 const size_t *startp, const size_t *countp, const float *op); 01236 01237 EXTERNL int 01238 nc_get_vara_float(int ncid, int varid, 01239 const size_t *startp, const size_t *countp, float *ip); 01240 01241 EXTERNL int 01242 nc_put_vara_double(int ncid, int varid, const size_t *startp, 01243 const size_t *countp, const double *op); 01244 01245 EXTERNL int 01246 nc_get_vara_double(int ncid, int varid, const size_t *startp, 01247 const size_t *countp, double *ip); 01248 01249 EXTERNL int 01250 nc_put_vara_ushort(int ncid, int varid, const size_t *startp, 01251 const size_t *countp, const unsigned short *op); 01252 01253 EXTERNL int 01254 nc_get_vara_ushort(int ncid, int varid, const size_t *startp, 01255 const size_t *countp, unsigned short *ip); 01256 01257 EXTERNL int 01258 nc_put_vara_uint(int ncid, int varid, const size_t *startp, 01259 const size_t *countp, const unsigned int *op); 01260 01261 EXTERNL int 01262 nc_get_vara_uint(int ncid, int varid, const size_t *startp, 01263 const size_t *countp, unsigned int *ip); 01264 01265 EXTERNL int 01266 nc_put_vara_longlong(int ncid, int varid, const size_t *startp, 01267 const size_t *countp, const long long *op); 01268 01269 EXTERNL int 01270 nc_get_vara_longlong(int ncid, int varid, const size_t *startp, 01271 const size_t *countp, long long *ip); 01272 01273 EXTERNL int 01274 nc_put_vara_ulonglong(int ncid, int varid, const size_t *startp, 01275 const size_t *countp, const unsigned long long *op); 01276 01277 EXTERNL int 01278 nc_get_vara_ulonglong(int ncid, int varid, const size_t *startp, 01279 const size_t *countp, unsigned long long *ip); 01280 01281 EXTERNL int 01282 nc_put_vara_string(int ncid, int varid, const size_t *startp, 01283 const size_t *countp, const char **op); 01284 01285 EXTERNL int 01286 nc_get_vara_string(int ncid, int varid, const size_t *startp, 01287 const size_t *countp, char **ip); 01288 01289 /* End {put,get}_vara */ 01290 /* Begin {put,get}_vars */ 01291 01292 EXTERNL int 01293 nc_put_vars_text(int ncid, int varid, 01294 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01295 const char *op); 01296 01297 EXTERNL int 01298 nc_get_vars_text(int ncid, int varid, 01299 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01300 char *ip); 01301 01302 EXTERNL int 01303 nc_put_vars_uchar(int ncid, int varid, 01304 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01305 const unsigned char *op); 01306 01307 EXTERNL int 01308 nc_get_vars_uchar(int ncid, int varid, 01309 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01310 unsigned char *ip); 01311 01312 EXTERNL int 01313 nc_put_vars_schar(int ncid, int varid, 01314 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01315 const signed char *op); 01316 01317 EXTERNL int 01318 nc_get_vars_schar(int ncid, int varid, 01319 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01320 signed char *ip); 01321 01322 EXTERNL int 01323 nc_put_vars_short(int ncid, int varid, 01324 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01325 const short *op); 01326 01327 EXTERNL int 01328 nc_get_vars_short(int ncid, int varid, const size_t *startp, 01329 const size_t *countp, const ptrdiff_t *stridep, 01330 short *ip); 01331 01332 EXTERNL int 01333 nc_put_vars_int(int ncid, int varid, 01334 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01335 const int *op); 01336 01337 EXTERNL int 01338 nc_get_vars_int(int ncid, int varid, 01339 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01340 int *ip); 01341 01342 EXTERNL int 01343 nc_put_vars_long(int ncid, int varid, 01344 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01345 const long *op); 01346 01347 EXTERNL int 01348 nc_get_vars_long(int ncid, int varid, 01349 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01350 long *ip); 01351 01352 EXTERNL int 01353 nc_put_vars_float(int ncid, int varid, 01354 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01355 const float *op); 01356 01357 EXTERNL int 01358 nc_get_vars_float(int ncid, int varid, 01359 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01360 float *ip); 01361 01362 EXTERNL int 01363 nc_put_vars_double(int ncid, int varid, 01364 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 01365 const double *op); 01366 01367 EXTERNL int 01368 nc_get_vars_double(int ncid, int varid, const size_t *startp, 01369 const size_t *countp, const ptrdiff_t *stridep, 01370 double *ip); 01371 01372 EXTERNL int 01373 nc_put_vars_ushort(int ncid, int varid, const size_t *startp, 01374 const size_t *countp, const ptrdiff_t *stridep, 01375 const unsigned short *op); 01376 01377 EXTERNL int 01378 nc_get_vars_ushort(int ncid, int varid, const size_t *startp, 01379 const size_t *countp, const ptrdiff_t *stridep, 01380 unsigned short *ip); 01381 01382 EXTERNL int 01383 nc_put_vars_uint(int ncid, int varid, const size_t *startp, 01384 const size_t *countp, const ptrdiff_t *stridep, 01385 const unsigned int *op); 01386 01387 EXTERNL int 01388 nc_get_vars_uint(int ncid, int varid, const size_t *startp, 01389 const size_t *countp, const ptrdiff_t *stridep, 01390 unsigned int *ip); 01391 01392 EXTERNL int 01393 nc_put_vars_longlong(int ncid, int varid, const size_t *startp, 01394 const size_t *countp, const ptrdiff_t *stridep, 01395 const long long *op); 01396 01397 EXTERNL int 01398 nc_get_vars_longlong(int ncid, int varid, const size_t *startp, 01399 const size_t *countp, const ptrdiff_t *stridep, 01400 long long *ip); 01401 01402 EXTERNL int 01403 nc_put_vars_ulonglong(int ncid, int varid, const size_t *startp, 01404 const size_t *countp, const ptrdiff_t *stridep, 01405 const unsigned long long *op); 01406 01407 EXTERNL int 01408 nc_get_vars_ulonglong(int ncid, int varid, const size_t *startp, 01409 const size_t *countp, const ptrdiff_t *stridep, 01410 unsigned long long *ip); 01411 01412 EXTERNL int 01413 nc_put_vars_string(int ncid, int varid, const size_t *startp, 01414 const size_t *countp, const ptrdiff_t *stridep, 01415 const char **op); 01416 01417 EXTERNL int 01418 nc_get_vars_string(int ncid, int varid, const size_t *startp, 01419 const size_t *countp, const ptrdiff_t *stridep, 01420 char **ip); 01421 01422 /* End {put,get}_vars */ 01423 /* Begin {put,get}_varm */ 01424 01425 EXTERNL int 01426 nc_put_varm_text(int ncid, int varid, const size_t *startp, 01427 const size_t *countp, const ptrdiff_t *stridep, 01428 const ptrdiff_t *imapp, const char *op); 01429 01430 EXTERNL int 01431 nc_get_varm_text(int ncid, int varid, const size_t *startp, 01432 const size_t *countp, const ptrdiff_t *stridep, 01433 const ptrdiff_t *imapp, char *ip); 01434 01435 EXTERNL int 01436 nc_put_varm_uchar(int ncid, int varid, const size_t *startp, 01437 const size_t *countp, const ptrdiff_t *stridep, 01438 const ptrdiff_t *imapp, const unsigned char *op); 01439 01440 EXTERNL int 01441 nc_get_varm_uchar(int ncid, int varid, const size_t *startp, 01442 const size_t *countp, const ptrdiff_t *stridep, 01443 const ptrdiff_t *imapp, unsigned char *ip); 01444 01445 EXTERNL int 01446 nc_put_varm_schar(int ncid, int varid, const size_t *startp, 01447 const size_t *countp, const ptrdiff_t *stridep, 01448 const ptrdiff_t *imapp, const signed char *op); 01449 01450 EXTERNL int 01451 nc_get_varm_schar(int ncid, int varid, const size_t *startp, 01452 const size_t *countp, const ptrdiff_t *stridep, 01453 const ptrdiff_t *imapp, signed char *ip); 01454 01455 EXTERNL int 01456 nc_put_varm_short(int ncid, int varid, const size_t *startp, 01457 const size_t *countp, const ptrdiff_t *stridep, 01458 const ptrdiff_t *imapp, const short *op); 01459 01460 EXTERNL int 01461 nc_get_varm_short(int ncid, int varid, const size_t *startp, 01462 const size_t *countp, const ptrdiff_t *stridep, 01463 const ptrdiff_t *imapp, short *ip); 01464 01465 EXTERNL int 01466 nc_put_varm_int(int ncid, int varid, const size_t *startp, 01467 const size_t *countp, const ptrdiff_t *stridep, 01468 const ptrdiff_t *imapp, const int *op); 01469 01470 EXTERNL int 01471 nc_get_varm_int(int ncid, int varid, const size_t *startp, 01472 const size_t *countp, const ptrdiff_t *stridep, 01473 const ptrdiff_t *imapp, int *ip); 01474 01475 EXTERNL int 01476 nc_put_varm_long(int ncid, int varid, const size_t *startp, 01477 const size_t *countp, const ptrdiff_t *stridep, 01478 const ptrdiff_t *imapp, const long *op); 01479 01480 EXTERNL int 01481 nc_get_varm_long(int ncid, int varid, const size_t *startp, 01482 const size_t *countp, const ptrdiff_t *stridep, 01483 const ptrdiff_t *imapp, long *ip); 01484 01485 EXTERNL int 01486 nc_put_varm_float(int ncid, int varid,const size_t *startp, 01487 const size_t *countp, const ptrdiff_t *stridep, 01488 const ptrdiff_t *imapp, const float *op); 01489 01490 EXTERNL int 01491 nc_get_varm_float(int ncid, int varid,const size_t *startp, 01492 const size_t *countp, const ptrdiff_t *stridep, 01493 const ptrdiff_t *imapp, float *ip); 01494 01495 EXTERNL int 01496 nc_put_varm_double(int ncid, int varid, const size_t *startp, 01497 const size_t *countp, const ptrdiff_t *stridep, 01498 const ptrdiff_t *imapp, const double *op); 01499 01500 EXTERNL int 01501 nc_get_varm_double(int ncid, int varid, const size_t *startp, 01502 const size_t *countp, const ptrdiff_t *stridep, 01503 const ptrdiff_t * imapp, double *ip); 01504 01505 EXTERNL int 01506 nc_put_varm_ushort(int ncid, int varid, const size_t *startp, 01507 const size_t *countp, const ptrdiff_t *stridep, 01508 const ptrdiff_t * imapp, const unsigned short *op); 01509 01510 EXTERNL int 01511 nc_get_varm_ushort(int ncid, int varid, const size_t *startp, 01512 const size_t *countp, const ptrdiff_t *stridep, 01513 const ptrdiff_t * imapp, unsigned short *ip); 01514 01515 EXTERNL int 01516 nc_put_varm_uint(int ncid, int varid, const size_t *startp, 01517 const size_t *countp, const ptrdiff_t *stridep, 01518 const ptrdiff_t * imapp, const unsigned int *op); 01519 01520 EXTERNL int 01521 nc_get_varm_uint(int ncid, int varid, const size_t *startp, 01522 const size_t *countp, const ptrdiff_t *stridep, 01523 const ptrdiff_t * imapp, unsigned int *ip); 01524 01525 EXTERNL int 01526 nc_put_varm_longlong(int ncid, int varid, const size_t *startp, 01527 const size_t *countp, const ptrdiff_t *stridep, 01528 const ptrdiff_t * imapp, const long long *op); 01529 01530 EXTERNL int 01531 nc_get_varm_longlong(int ncid, int varid, const size_t *startp, 01532 const size_t *countp, const ptrdiff_t *stridep, 01533 const ptrdiff_t * imapp, long long *ip); 01534 01535 EXTERNL int 01536 nc_put_varm_ulonglong(int ncid, int varid, const size_t *startp, 01537 const size_t *countp, const ptrdiff_t *stridep, 01538 const ptrdiff_t * imapp, const unsigned long long *op); 01539 01540 EXTERNL int 01541 nc_get_varm_ulonglong(int ncid, int varid, const size_t *startp, 01542 const size_t *countp, const ptrdiff_t *stridep, 01543 const ptrdiff_t * imapp, unsigned long long *ip); 01544 01545 EXTERNL int 01546 nc_put_varm_string(int ncid, int varid, const size_t *startp, 01547 const size_t *countp, const ptrdiff_t *stridep, 01548 const ptrdiff_t * imapp, const char **op); 01549 01550 EXTERNL int 01551 nc_get_varm_string(int ncid, int varid, const size_t *startp, 01552 const size_t *countp, const ptrdiff_t *stridep, 01553 const ptrdiff_t * imapp, char **ip); 01554 01555 /* End {put,get}_varm */ 01556 /* Begin {put,get}_var */ 01557 01558 EXTERNL int 01559 nc_put_var_text(int ncid, int varid, const char *op); 01560 01561 EXTERNL int 01562 nc_get_var_text(int ncid, int varid, char *ip); 01563 01564 EXTERNL int 01565 nc_put_var_uchar(int ncid, int varid, const unsigned char *op); 01566 01567 EXTERNL int 01568 nc_get_var_uchar(int ncid, int varid, unsigned char *ip); 01569 01570 EXTERNL int 01571 nc_put_var_schar(int ncid, int varid, const signed char *op); 01572 01573 EXTERNL int 01574 nc_get_var_schar(int ncid, int varid, signed char *ip); 01575 01576 EXTERNL int 01577 nc_put_var_short(int ncid, int varid, const short *op); 01578 01579 EXTERNL int 01580 nc_get_var_short(int ncid, int varid, short *ip); 01581 01582 EXTERNL int 01583 nc_put_var_int(int ncid, int varid, const int *op); 01584 01585 EXTERNL int 01586 nc_get_var_int(int ncid, int varid, int *ip); 01587 01588 EXTERNL int 01589 nc_put_var_long(int ncid, int varid, const long *op); 01590 01591 EXTERNL int 01592 nc_get_var_long(int ncid, int varid, long *ip); 01593 01594 EXTERNL int 01595 nc_put_var_float(int ncid, int varid, const float *op); 01596 01597 EXTERNL int 01598 nc_get_var_float(int ncid, int varid, float *ip); 01599 01600 EXTERNL int 01601 nc_put_var_double(int ncid, int varid, const double *op); 01602 01603 EXTERNL int 01604 nc_get_var_double(int ncid, int varid, double *ip); 01605 01606 EXTERNL int 01607 nc_put_var_ushort(int ncid, int varid, const unsigned short *op); 01608 01609 EXTERNL int 01610 nc_get_var_ushort(int ncid, int varid, unsigned short *ip); 01611 01612 EXTERNL int 01613 nc_put_var_uint(int ncid, int varid, const unsigned int *op); 01614 01615 EXTERNL int 01616 nc_get_var_uint(int ncid, int varid, unsigned int *ip); 01617 01618 EXTERNL int 01619 nc_put_var_longlong(int ncid, int varid, const long long *op); 01620 01621 EXTERNL int 01622 nc_get_var_longlong(int ncid, int varid, long long *ip); 01623 01624 EXTERNL int 01625 nc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op); 01626 01627 EXTERNL int 01628 nc_get_var_ulonglong(int ncid, int varid, unsigned long long *ip); 01629 01630 EXTERNL int 01631 nc_put_var_string(int ncid, int varid, const char **op); 01632 01633 EXTERNL int 01634 nc_get_var_string(int ncid, int varid, char **ip); 01635 01636 /* Begin Deprecated, same as functions with "_ubyte" replaced by "_uchar" */ 01637 EXTERNL int 01638 nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype, 01639 size_t len, const unsigned char *op); 01640 EXTERNL int 01641 nc_get_att_ubyte(int ncid, int varid, const char *name, 01642 unsigned char *ip); 01643 EXTERNL int 01644 nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp, 01645 const unsigned char *op); 01646 EXTERNL int 01647 nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp, 01648 unsigned char *ip); 01649 EXTERNL int 01650 nc_put_vara_ubyte(int ncid, int varid, const size_t *startp, 01651 const size_t *countp, const unsigned char *op); 01652 EXTERNL int 01653 nc_get_vara_ubyte(int ncid, int varid, const size_t *startp, 01654 const size_t *countp, unsigned char *ip); 01655 EXTERNL int 01656 nc_put_vars_ubyte(int ncid, int varid, const size_t *startp, 01657 const size_t *countp, const ptrdiff_t *stridep, 01658 const unsigned char *op); 01659 EXTERNL int 01660 nc_get_vars_ubyte(int ncid, int varid, const size_t *startp, 01661 const size_t *countp, const ptrdiff_t *stridep, 01662 unsigned char *ip); 01663 EXTERNL int 01664 nc_put_varm_ubyte(int ncid, int varid, const size_t *startp, 01665 const size_t *countp, const ptrdiff_t *stridep, 01666 const ptrdiff_t * imapp, const unsigned char *op); 01667 EXTERNL int 01668 nc_get_varm_ubyte(int ncid, int varid, const size_t *startp, 01669 const size_t *countp, const ptrdiff_t *stridep, 01670 const ptrdiff_t * imapp, unsigned char *ip); 01671 EXTERNL int 01672 nc_put_var_ubyte(int ncid, int varid, const unsigned char *op); 01673 EXTERNL int 01674 nc_get_var_ubyte(int ncid, int varid, unsigned char *ip); 01675 /* End Deprecated */ 01676 01677 #ifdef LOGGING 01678 01679 /* Set the log level. 0 shows only errors, 1 only major messages, 01680 * etc., to 5, which shows way too much information. */ 01681 EXTERNL int 01682 nc_set_log_level(int new_level); 01683 01684 /* Use this to turn off logging by calling 01685 nc_log_level(NC_TURN_OFF_LOGGING) */ 01686 #define NC_TURN_OFF_LOGGING (-1) 01687 01688 #else /* not LOGGING */ 01689 01690 #define nc_set_log_level(e) 01691 01692 #endif /* LOGGING */ 01693 01694 /* Show the netCDF library's in-memory metadata for a file. */ 01695 EXTERNL int 01696 nc_show_metadata(int ncid); 01697 01698 /* End {put,get}_var */ 01699 01700 /* #ifdef _CRAYMPP */ 01701 /* 01702 * Public interfaces to better support 01703 * CRAY multi-processor systems like T3E. 01704 * A tip of the hat to NERSC. 01705 */ 01706 /* 01707 * It turns out we need to declare and define 01708 * these public interfaces on all platforms 01709 * or things get ugly working out the 01710 * FORTRAN interface. On !_CRAYMPP platforms, 01711 * these functions work as advertised, but you 01712 * can only use "processor element" 0. 01713 */ 01714 01715 EXTERNL int 01716 nc__create_mp(const char *path, int cmode, size_t initialsz, int basepe, 01717 size_t *chunksizehintp, int *ncidp); 01718 01719 EXTERNL int 01720 nc__open_mp(const char *path, int mode, int basepe, 01721 size_t *chunksizehintp, int *ncidp); 01722 01723 EXTERNL int 01724 nc_delete(const char *path); 01725 01726 EXTERNL int 01727 nc_delete_mp(const char *path, int basepe); 01728 01729 EXTERNL int 01730 nc_set_base_pe(int ncid, int pe); 01731 01732 EXTERNL int 01733 nc_inq_base_pe(int ncid, int *pe); 01734 01735 /* #endif _CRAYMPP */ 01736 01737 /* This v2 function is used in the nc_test program. */ 01738 EXTERNL int 01739 nctypelen(nc_type datatype); 01740 01741 /* Begin v2.4 backward compatiblity */ 01742 /* 01743 * defining NO_NETCDF_2 to the preprocessor 01744 * turns off backward compatiblity declarations. 01745 */ 01746 #ifndef NO_NETCDF_2 01747 01750 #define FILL_BYTE NC_FILL_BYTE 01751 #define FILL_CHAR NC_FILL_CHAR 01752 #define FILL_SHORT NC_FILL_SHORT 01753 #define FILL_LONG NC_FILL_INT 01754 #define FILL_FLOAT NC_FILL_FLOAT 01755 #define FILL_DOUBLE NC_FILL_DOUBLE 01756 01757 #define MAX_NC_DIMS NC_MAX_DIMS 01758 #define MAX_NC_ATTRS NC_MAX_ATTRS 01759 #define MAX_NC_VARS NC_MAX_VARS 01760 #define MAX_NC_NAME NC_MAX_NAME 01761 #define MAX_VAR_DIMS NC_MAX_VAR_DIMS 01762 01765 /* 01766 * Global error status 01767 */ 01768 EXTERNL int ncerr; 01769 01770 #define NC_ENTOOL NC_EMAXNAME /* Backward compatibility */ 01771 #define NC_EXDR (-32) /* */ 01772 #define NC_SYSERR (-31) 01773 01774 /* 01775 * Global options variable. 01776 * Used to determine behavior of error handler. 01777 */ 01778 #define NC_FATAL 1 01779 #define NC_VERBOSE 2 01780 01781 EXTERNL int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */ 01782 01783 EXTERNL void 01784 nc_advise(const char *cdf_routine_name, int err, const char *fmt,...); 01785 01786 /* 01787 * C data type corresponding to a netCDF NC_LONG argument, 01788 * a signed 32 bit object. 01789 * 01790 * This is the only thing in this file which architecture dependent. 01791 */ 01792 typedef int nclong; 01793 01794 EXTERNL int 01795 nccreate(const char* path, int cmode); 01796 01797 EXTERNL int 01798 ncopen(const char* path, int mode); 01799 01800 EXTERNL int 01801 ncsetfill(int ncid, int fillmode); 01802 01803 EXTERNL int 01804 ncredef(int ncid); 01805 01806 EXTERNL int 01807 ncendef(int ncid); 01808 01809 EXTERNL int 01810 ncsync(int ncid); 01811 01812 EXTERNL int 01813 ncabort(int ncid); 01814 01815 EXTERNL int 01816 ncclose(int ncid); 01817 01818 EXTERNL int 01819 ncinquire(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimp); 01820 01821 EXTERNL int 01822 ncdimdef(int ncid, const char *name, long len); 01823 01824 EXTERNL int 01825 ncdimid(int ncid, const char *name); 01826 01827 EXTERNL int 01828 ncdiminq(int ncid, int dimid, char *name, long *lenp); 01829 01830 EXTERNL int 01831 ncdimrename(int ncid, int dimid, const char *name); 01832 01833 EXTERNL int 01834 ncattput(int ncid, int varid, const char *name, nc_type xtype, 01835 int len, const void *op); 01836 01837 EXTERNL int 01838 ncattinq(int ncid, int varid, const char *name, nc_type *xtypep, int *lenp); 01839 01840 EXTERNL int 01841 ncattget(int ncid, int varid, const char *name, void *ip); 01842 01843 EXTERNL int 01844 ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out, 01845 int varid_out); 01846 01847 EXTERNL int 01848 ncattname(int ncid, int varid, int attnum, char *name); 01849 01850 EXTERNL int 01851 ncattrename(int ncid, int varid, const char *name, const char *newname); 01852 01853 EXTERNL int 01854 ncattdel(int ncid, int varid, const char *name); 01855 01856 EXTERNL int 01857 ncvardef(int ncid, const char *name, nc_type xtype, 01858 int ndims, const int *dimidsp); 01859 01860 EXTERNL int 01861 ncvarid(int ncid, const char *name); 01862 01863 EXTERNL int 01864 ncvarinq(int ncid, int varid, char *name, nc_type *xtypep, 01865 int *ndimsp, int *dimidsp, int *nattsp); 01866 01867 EXTERNL int 01868 ncvarput1(int ncid, int varid, const long *indexp, const void *op); 01869 01870 EXTERNL int 01871 ncvarget1(int ncid, int varid, const long *indexp, void *ip); 01872 01873 EXTERNL int 01874 ncvarput(int ncid, int varid, const long *startp, const long *countp, 01875 const void *op); 01876 01877 EXTERNL int 01878 ncvarget(int ncid, int varid, const long *startp, const long *countp, 01879 void *ip); 01880 01881 EXTERNL int 01882 ncvarputs(int ncid, int varid, const long *startp, const long *countp, 01883 const long *stridep, const void *op); 01884 01885 EXTERNL int 01886 ncvargets(int ncid, int varid, const long *startp, const long *countp, 01887 const long *stridep, void *ip); 01888 01889 EXTERNL int 01890 ncvarputg(int ncid, int varid, const long *startp, const long *countp, 01891 const long *stridep, const long *imapp, const void *op); 01892 01893 EXTERNL int 01894 ncvargetg(int ncid, int varid, const long *startp, const long *countp, 01895 const long *stridep, const long *imapp, void *ip); 01896 01897 EXTERNL int 01898 ncvarrename(int ncid, int varid, const char *name); 01899 01900 EXTERNL int 01901 ncrecinq(int ncid, int *nrecvarsp, int *recvaridsp, long *recsizesp); 01902 01903 EXTERNL int 01904 ncrecget(int ncid, long recnum, void **datap); 01905 01906 EXTERNL int 01907 ncrecput(int ncid, long recnum, void *const *datap); 01908 01909 /* End v2.4 backward compatiblity */ 01910 #endif 01912 #if defined(__cplusplus) 01913 } 01914 #endif 01915 01916 /* Temporary hack to shut up warnings */ 01917 #ifndef __MINGW32_VERSION 01918 #define END_OF_MAIN() 01919 #endif 01920 01921 01922 /* Allow dependent software to tell if 01923 nc_rename_grp() is available, as requested 01924 by Charlie Zender. */ 01925 #ifndef NC_HAVE_RENAME_GRP 01926 #define NC_HAVE_RENAME_GRP 01927 #endif 01928 01929 /* Allow dependent software to tell if 01930 inq_format_extended() is available. 01931 01932 This is not a scalable approach to querying 01933 the functionality of the netcdf library, but 01934 it will do for the time being. */ 01935 #ifndef NC_HAVE_INQ_FORMAT_EXTENDED 01936 #define NC_HAVE_INQ_FORMAT_EXTENDED 01937 #endif 01938 01939 01940 #endif /* _NETCDF_ */ 01941 01942 01943