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