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 University 7 Corporation for Atmospheric Research/Unidata. See \ref copyright file 8 for more info. 9 */ 10 11 module netcdf; 12 13 import core.stdc.config; 14 15 /*! The nc_type type is just an int. */ 16 alias nc_type = int; 17 18 extern(C): 19 20 /* 21 * The netcdf external data types 22 */ 23 enum NC_NAT = 0; /**< Not A Type */ 24 enum NC_BYTE = 1; /**< signed 1 byte integer */ 25 enum NC_CHAR = 2; /**< ISO/ASCII character */ 26 enum NC_SHORT = 3; /**< signed 2 byte integer */ 27 enum NC_INT = 4; /**< signed 4 byte integer */ 28 enum NC_LONG = NC_INT; /**< deprecated, but required for backward compatibility. */ 29 enum NC_FLOAT = 5; /**< single precision floating point number */ 30 enum NC_DOUBLE = 6; /**< double precision floating point number */ 31 enum NC_UBYTE = 7; /**< u1 byte int */ 32 enum NC_USHORT = 8; /**< u2-byte int */ 33 enum NC_UINT = 9; /**< u4-byte int */ 34 enum NC_INT64 = 10; /**< signed 8-byte int */ 35 enum NC_UINT64 = 11; /**< u8-byte int */ 36 enum NC_STRING = 12; /**< string */ 37 38 enum NC_MAX_ATOMIC_TYPE = NC_STRING; 39 40 /* The following are use internally in support of user-defines 41 * types. They are also the class returned by nc_inq_user_type. */ 42 enum NC_VLEN = 13; /**< vlen (variable-length) types */ 43 enum NC_OPAQUE = 14; /**< opaque types */ 44 enum NC_ENUM = 15; /**< enum types */ 45 enum NC_COMPOUND = 16; /**< compound types */ 46 47 /* Define the first user defined type id (leave some room) */ 48 enum NC_FIRSTUSERTYPEID = 32; 49 50 /** Default fill value. This is used unless _FillValue attribute 51 * is set. These values are stuffed into newly allocated space as 52 * appropriate. The hope is that one might use these to notice that a 53 * particular datum has not been set. */ 54 /**@{*/ 55 enum byte NC_FILL_BYTE = -127; 56 enum char NC_FILL_CHAR = 0; 57 enum short NC_FILL_SHORT = -32767; 58 enum int NC_FILL_INT = -2147483647; 59 enum float NC_FILL_FLOAT = 9.9692099683868690e+36; /* near 15 * 2^119 */ 60 enum double NC_FILL_DOUBLE = 9.9692099683868690e+36; 61 enum ubyte NC_FILL_UBYTE = 255; 62 enum ushort NC_FILL_USHORT = 65535; 63 enum uint NC_FILL_UINT = 4294967295; 64 enum long NC_FILL_INT64 = -9223372036854775806; 65 enum ulong NC_FILL_UINT64 = 18446744073709551614U; 66 67 @property char* NC_FILL_STRING() { return emptyStr.ptr; } 68 69 private __gshared static char[1] emptyStr; 70 /**@}*/ 71 72 /*! Max or min values for a type. Nothing greater/smaller can be 73 * stored in a netCDF file for their associated types. Recall that a C 74 * compiler may define int to be any length it wants, but a NC_INT is 75 * *always* a 4 byte signed int. On a platform with 64 bit ints, 76 * there will be many ints which are outside the range supported by 77 * NC_INT. But since NC_INT is an external format, it has to mean the 78 * same thing everywhere. */ 79 /**@{*/ 80 enum byte NC_MAX_BYTE = 127; 81 enum byte NC_MIN_BYTE = -NC_MAX_BYTE-1; 82 enum char NC_MAX_CHAR = 255; 83 enum short NC_MAX_SHORT = 32767; 84 enum short NC_MIN_SHORT = -NC_MAX_SHORT - 1; 85 enum int NC_MAX_INT = 2147483647; 86 enum int NC_MIN_INT = -NC_MAX_INT - 1; 87 enum float NC_MAX_FLOAT = 3.402823466e+38; 88 enum float NC_MIN_FLOAT = -NC_MAX_FLOAT; 89 enum double NC_MAX_DOUBLE = 1.7976931348623157e+308; 90 enum double NC_MIN_DOUBLE = -NC_MAX_DOUBLE; 91 enum ubyte NC_MAX_UBYTE = NC_MAX_CHAR; 92 enum ushort NC_MAX_USHORT = 65535; 93 enum uint NC_MAX_UINT = 4294967295; 94 enum long NC_MAX_INT64 = 9223372036854775807; 95 enum long NC_MIN_INT64 = -9223372036854775807-1; 96 enum ulong NC_MAX_UINT64 = 18446744073709551615U; 97 //what are these for? 98 enum long X_INT64_MAX = 9223372036854775807; 99 enum long X_INT64_MIN = -X_INT64_MAX - 1; 100 enum ulong X_UINT64_MAX = 18446744073709551615U; 101 /**@}*/ 102 103 /** Name of fill value attribute. If you wish a variable to use a 104 * different value than the above defaults, create an attribute with 105 * the same type as the variable and this reserved name. The value you 106 * give the attribute will be used as the fill value for that 107 * variable. */ 108 @property char* _FillValue() { return _FillValueStr.ptr; } 109 enum NC_FILL = 0; /**< Argument to nc_set_fill() to clear NC_NOFILL */ 110 enum NC_NOFILL = 0x100; /**< Argument to nc_set_fill() to turn off filling of data. */ 111 112 private __gshared static char[10] _FillValueStr = "_FillValue"; 113 114 /* Define the ioflags bits for nc_create and nc_open. 115 currently unused: 0x0010,0x0020,0x0040,0x0080 116 and the whole upper 16 bits 117 */ 118 119 enum NC_NOWRITE = 0x0000; /**< Set read-only access for nc_open(). */ 120 enum NC_WRITE = 0x0001; /**< Set read-write access for nc_open(). */ 121 /* unused: 0x0002 */ 122 enum NC_CLOBBER = 0x0000; /**< Destroy existing file. Mode flag for nc_create(). */ 123 enum NC_NOCLOBBER = 0x0004; /**< Don't destroy existing file. Mode flag for nc_create(). */ 124 125 enum NC_DISKLESS = 0x0008; /**< Use diskless file. Mode flag for nc_open() or nc_create(). */ 126 enum NC_MMAP = 0x0010; /**< Use diskless file with mmap. Mode flag for nc_open() or nc_create(). */ 127 128 enum NC_CLASSIC_MODEL = 0x0100; /**< Enforce classic model. Mode flag for nc_create(). */ 129 enum NC_64BIT_OFFSET = 0x0200; /**< Use large (64-bit) file offsets. Mode flag for nc_create(). */ 130 131 /** \deprecated The following flag currently is ignored, but use in 132 * nc_open() or nc_create() may someday support use of advisory 133 * locking to prevent multiple writers from clobbering a file 134 */ 135 enum NC_LOCK = 0x0400; 136 137 /** Share updates, limit cacheing. 138 Use this in mode flags for both nc_create() and nc_open(). */ 139 enum NC_SHARE = 0x0800; 140 141 enum NC_NETCDF4 = 0x1000; /**< Use netCDF-4/HDF5 format. Mode flag for nc_create(). */ 142 143 /** Turn on MPI I/O. 144 Use this in mode flags for both nc_create() and nc_open(). */ 145 enum NC_MPIIO = 0x2000; 146 /** Turn on MPI POSIX I/O. 147 Use this in mode flags for both nc_create() and nc_open(). */ 148 enum NC_MPIPOSIX = 0x4000; /**< \deprecated As of libhdf5 1.8.13. */ 149 enum NC_PNETCDF = 0x8000; /**< Use parallel-netcdf library. Mode flag for nc_open(). */ 150 151 /** Format specifier for nc_set_default_format() and returned 152 * by nc_inq_format. This returns the format as provided by 153 * the API. See nc_inq_format_extended to see the true file format. 154 * Starting with version 3.6, there are different format netCDF files. 155 * 4.0 introduces the third one. \see netcdf_format 156 */ 157 /**@{*/ 158 enum NC_FORMAT_CLASSIC = 1; 159 enum NC_FORMAT_64BIT = 2; 160 enum NC_FORMAT_NETCDF4 = 3; 161 enum NC_FORMAT_NETCDF4_CLASSIC = 4; 162 163 /**@}*/ 164 165 /** Extended format specifier returned by nc_inq_format_extended() 166 * Added in version 4.3.1. This returns the true format of the 167 * underlying data. 168 * The function returns two values 169 * 1. a small integer indicating the underlying source type 170 * of the data. Note that this may differ from what the user 171 * sees from nc_inq_format() because this latter function 172 * returns what the user can expect to see thru the API. 173 * 2. A mode value indicating what mode flags are effectively 174 * set for this dataset. This usually will be a superset 175 * of the mode flags used as the argument to nc_open 176 * or nc_create. 177 * More or less, the #1 values track the set of dispatch tables. 178 * The #1 values are as follows. 179 */ 180 /**@{*/ 181 enum NC_FORMAT_NC3 = 1; 182 enum NC_FORMAT_NC_HDF5 = 2; /*cdf 4 subset of HDF5 */ 183 enum NC_FORMAT_NC_HDF4 = 3; /* netcdf 4 subset of HDF4 */ 184 enum NC_FORMAT_PNETCDF = 4; 185 enum NC_FORMAT_DAP2 = 5; 186 enum NC_FORMAT_DAP4 = 6; 187 enum NC_FORMAT_UNDEFINED = 0; 188 /**@}*/ 189 190 /** Let nc__create() or nc__open() figure out a suitable buffer size. */ 191 enum NC_SIZEHINT_DEFAULT = 0; 192 193 /** In nc__enddef(), align to the buffer size. */ 194 enum size_t NC_ALIGN_CHUNK = -1; 195 196 /** Size argument to nc_def_dim() for an unlimited dimension. */ 197 enum long NC_UNLIMITED = 0; 198 199 /** Attribute id to put/get a global attribute. */ 200 enum NC_GLOBAL = -1; 201 202 /** 203 Maximum for classic library. 204 205 In the classic netCDF model there are maximum values for the number of 206 dimensions in the file (\ref NC_MAX_DIMS), the number of global or per 207 variable attributes (\ref NC_MAX_ATTRS), the number of variables in 208 the file (\ref NC_MAX_VARS), and the length of a name (\ref 209 NC_MAX_NAME). 210 211 These maximums are enforced by the interface, to facilitate writing 212 applications and utilities. However, nothing is statically allocated 213 to these sizes internally. 214 215 These maximums are not used for netCDF-4/HDF5 files unless they were 216 created with the ::NC_CLASSIC_MODEL flag. 217 218 As a rule, NC_MAX_VAR_DIMS <= NC_MAX_DIMS. 219 */ 220 /**@{*/ 221 enum NC_MAX_DIMS = 1024; 222 enum NC_MAX_ATTRS = 8192; 223 enum NC_MAX_VARS = 8192; 224 enum NC_MAX_NAME = 256; 225 enum NC_MAX_VAR_DIMS = 1024; /**< max per variable dimensions */ 226 /**@}*/ 227 228 /** This is the max size of an SD dataset name in HDF4 (from HDF4 documentation).*/ 229 enum NC_MAX_HDF4_NAME = 64; 230 231 /** In HDF5 files you can set the endianness of variables with 232 nc_def_var_endian(). This define is used there. */ 233 /**@{*/ 234 enum NC_ENDIAN_NATIVE = 0; 235 enum NC_ENDIAN_LITTLE = 1; 236 enum NC_ENDIAN_BIG = 2; 237 /**@}*/ 238 239 /** In HDF5 files you can set storage for each variable to be either 240 * contiguous or chunked, with nc_def_var_chunking(). This define is 241 * used there. */ 242 /**@{*/ 243 enum NC_CHUNKED = 0; 244 enum NC_CONTIGUOUS = 1; 245 /**@}*/ 246 247 /** In HDF5 files you can set check-summing for each variable. 248 Currently the only checksum available is Fletcher-32, which can be set 249 with the function nc_def_var_fletcher32. These defines are used 250 there. */ 251 /**@{*/ 252 enum NC_NOCHECKSUM = 0; 253 enum NC_FLETCHER32 = 1; 254 /**@}*/ 255 256 /**@{*/ 257 /** Control the HDF5 shuffle filter. In HDF5 files you can specify 258 * that a shuffle filter should be used on each chunk of a variable to 259 * improve compression for that variable. This per-variable shuffle 260 * property can be set with the function nc_def_var_deflate(). */ 261 enum NC_NOSHUFFLE = 0; 262 enum NC_SHUFFLE = 1; 263 /**@}*/ 264 265 /** The netcdf version 3 functions all return integer error status. 266 * These are the possible values, in addition to certain values from 267 * the system errno.h. 268 */ 269 bool NC_ISSYSERR(int err) { return err > 0; } 270 271 enum NC_NOERR = 0; /**< No Error */ 272 enum NC2_ERR = -1; /**< Returned for all errors in the v2 API. */ 273 274 /** Not a netcdf id. 275 276 The specified netCDF ID does not refer to an 277 open netCDF dataset. */ 278 enum NC_EBADID = -33; 279 enum NC_ENFILE = -34; /**< Too many netcdfs open */ 280 enum NC_EEXIST = -35; /**< netcdf file exists && NC_NOCLOBBER */ 281 enum NC_EINVAL = -36; /**< Invalid Argument */ 282 enum NC_EPERM = -37; /**< Write to read only */ 283 284 /** Operation not allowed in data mode. This is returned for netCDF 285 classic or 64-bit offset files, or for netCDF-4 files, when they were 286 been created with ::NC_CLASSIC_MODEL flag in nc_create(). */ 287 enum NC_ENOTINDEFINE = -38; 288 289 /** Operation not allowed in define mode. 290 291 The specified netCDF is in define mode rather than data mode. 292 293 With netCDF-4/HDF5 files, this error will not occur, unless 294 ::NC_CLASSIC_MODEL was used in nc_create(). 295 */ 296 enum NC_EINDEFINE = -39; 297 298 /** Index exceeds dimension bound. 299 300 The specified corner indices were out of range for the rank of the 301 specified variable. For example, a negative index or an index that is 302 larger than the corresponding dimension length will cause an error. */ 303 enum NC_EINVALCOORDS = -40; 304 enum NC_EMAXDIMS = -41; /**< NC_MAX_DIMS exceeded */ 305 enum NC_ENAMEINUSE = -42; /**< String match to name in use */ 306 enum NC_ENOTATT = -43; /**< Attribute not found */ 307 enum NC_EMAXATTS = -44; /**< NC_MAX_ATTRS exceeded */ 308 enum NC_EBADTYPE = -45; /**< Not a netcdf data type */ 309 enum NC_EBADDIM = -46; /**< Invalid dimension id or name */ 310 enum NC_EUNLIMPOS = -47; /**< NC_UNLIMITED in the wrong index */ 311 312 /** NC_MAX_VARS exceeded. Max number of variables exceeded in a 313 classic or 64-bit offset file, or an netCDF-4 file with 314 ::NC_CLASSIC_MODEL on. */ 315 enum NC_EMAXVARS = -48; 316 317 /** Variable not found. 318 319 The variable ID is invalid for the specified netCDF dataset. */ 320 enum NC_ENOTVAR = -49; 321 enum NC_EGLOBAL = -50; /**< Action prohibited on NC_GLOBAL varid */ 322 enum NC_ENOTNC = -51; /**< Not a netcdf file */ 323 enum NC_ESTS = -52; /**< In Fortran, string too short* / 324 enum NC_EMAXNAME = -53; /**< NC_MAX_NAME exceeded */ 325 enum NC_EUNLIMIT = -54; /**< NC_UNLIMITED size already in use */ 326 enum NC_ENORECVARS = -55; /**< nc_rec op when there are no record vars */ 327 enum NC_ECHAR = -56; /**< Attempt to convert between text & numbers */ 328 329 /** Start+count exceeds dimension bound. 330 331 The specified edge lengths added to the specified corner would have 332 referenced data out of range for the rank of the specified 333 variable. For example, an edge length that is larger than the 334 corresponding dimension length minus the corner index will cause an 335 error. */ 336 enum NC_EEDGE = -57; 337 enum NC_ESTRIDE = -58; /**< Illegal stride */ 338 enum NC_EBADNAME = -59; /**< Attribute or variable name contains illegal characters */ 339 /* N.B. following must match value in ncx.h */ 340 341 /** Math result not representable. 342 343 One or more of the values are out of the range of values representable 344 by the desired type. */ 345 enum NC_ERANGE = -60; 346 enum NC_ENOMEM = -61; /**< Memory allocation (malloc) failure */ 347 enum NC_EVARSIZE = -62; /**< One or more variable sizes violate format constraints */ 348 enum NC_EDIMSIZE = -63; /**< Invalid dimension size */ 349 enum NC_ETRUNC = -64; /**< File likely truncated or possibly corrupted */ 350 enum NC_EAXISTYPE = -65; /**< Unknown axis type. */ 351 352 /* Following errors are added for DAP */ 353 enum NC_EDAP = -66; /**< Generic DAP error */ 354 enum NC_ECURL = -67; /**< Generic libcurl error */ 355 enum NC_EIO = -68; /**< Generic IO error */ 356 enum NC_ENODATA = -69; /**< Attempt to access variable with no data */ 357 enum NC_EDAPSVC = -70; /**< DAP server error */ 358 enum NC_EDAS = -71; /**< Malformed or inaccessible DAS */ 359 enum NC_EDDS = -72; /**< Malformed or inaccessible DDS */ 360 enum NC_EDATADDS = -73; /**< Malformed or inaccessible DATADDS */ 361 enum NC_EDAPURL = -74; /**< Malformed DAP URL */ 362 enum NC_EDAPCONSTRAINT = -75; /**< Malformed DAP Constraint*/ 363 enum NC_ETRANSLATION = -76; /**< Untranslatable construct */ 364 enum NC_EACCESS = -77; /**< Access Failure */ 365 enum NC_EAUTH = -78; /**< Authorization Failure */ 366 367 /* Misc. additional errors */ 368 enum NC_ENOTFOUND = -90; /**< No such file */ 369 enum NC_ECANTREMOVE = -91; /**< Can't remove file */ 370 371 /* The following was added in support of netcdf-4. Make all netcdf-4 372 error codes < -100 so that errors can be added to netcdf-3 if 373 needed. */ 374 enum NC4_FIRST_ERROR = -100; 375 376 /** Error at HDF5 layer. */ 377 enum NC_EHDFERR = -101; 378 enum NC_ECANTREAD = -102; /**< Can't read. */ 379 enum NC_ECANTWRITE = -103; /**< Can't write. */ 380 enum NC_ECANTCREATE = -104; /**< Can't create. */ 381 enum NC_EFILEMETA = -105; /**< Problem with file metadata. */ 382 enum NC_EDIMMETA = -106; /**< Problem with dimension metadata. */ 383 enum NC_EATTMETA = -107; /**< Problem with attribute metadata. */ 384 enum NC_EVARMETA = -108; /**< Problem with variable metadata. */ 385 enum NC_ENOCOMPOUND = -109; /**< Not a compound type. */ 386 enum NC_EATTEXISTS = -110; /**< Attribute already exists. */ 387 enum NC_ENOTNC4 = -111; /**< Attempting netcdf-4 operation on netcdf-3 file. */ 388 389 /** Attempting netcdf-4 operation on strict nc3 netcdf-4 file. */ 390 enum NC_ESTRICTNC3 = -112; 391 enum NC_ENOTNC3 = -113; /**< Attempting netcdf-3 operation on netcdf-4 file. */ 392 enum NC_ENOPAR = -114; /**< Parallel operation on file opened for non-parallel access. */ 393 enum NC_EPARINIT = -115; /**< Error initializing for parallel access. */ 394 enum NC_EBADGRPID = -116; /**< Bad group ID. */ 395 enum NC_EBADTYPID = -117; /**< Bad type ID. */ 396 enum NC_ETYPDEFINED = -118; /**< Type has already been defined and may not be edited. */ 397 enum NC_EBADFIELD = -119; /**< Bad field ID. */ 398 enum NC_EBADCLASS = -120; /**< Bad class. */ 399 enum NC_EMAPTYPE = -121; /**< Mapped access for atomic types only. */ 400 enum NC_ELATEFILL = -122; /**< Attempt to define fill value when data already exists. */ 401 enum NC_ELATEDEF = -123; /**< Attempt to define var properties, like deflate, after enddef. */ 402 enum NC_EDIMSCALE = -124; /**< Probem with HDF5 dimscales. */ 403 enum NC_ENOGRP = -125; /**< No group found. */ 404 enum NC_ESTORAGE = -126; /**< Can't specify both contiguous and chunking. */ 405 enum NC_EBADCHUNK = -127; /**< Bad chunksize. */ 406 enum NC_ENOTBUILT = -128; /**< Attempt to use feature that was not turned on when netCDF was built. */ 407 enum NC_EDISKLESS = -129; /**< Error in using diskless access. */ 408 enum NC_ECANTEXTEND = -130; /**< Attempt to extend dataset during ind. I/O operation. */ 409 enum NC_EMPI = -131; /**< MPI operation failed. */ 410 411 enum NC4_LAST_ERROR = -131; 412 413 /* This is used in netCDF-4 files for dimensions without coordinate 414 * vars. */ 415 @property char* DIM_WITHOUT_VARIABLE() { return DIM_WITHOUT_VARIABLEStr.ptr; } 416 private __gshared static char[53] DIM_WITHOUT_VARIABLEStr= "This is a netCDF dimension but not a netCDF variable."; 417 418 /* This is here at the request of the NCO team to support our 419 * mistake of having chunksizes be first ints, then size_t. Doh! */ 420 enum NC_HAVE_NEW_CHUNKING_API = 1; 421 422 423 /*Errors for all remote access methods(e.g. DAP and CDMREMOTE)*/ 424 enum NC_EURL = NC_EDAPURL; /* Malformed URL */ 425 enum NC_ECONSTRAINT = NC_EDAPCONSTRAINT; /* Malformed Constraint*/ 426 427 /* 428 * The Interface 429 */ 430 431 version(DLL_NETCDF) /* define when library is a DLL */ 432 { 433 int ncerr; 434 int ncopts; 435 } 436 437 const(char)* nc_inq_libvers(); 438 439 const(char)* nc_strerror(int ncerr); 440 441 int nc__create(const(char)* path, int cmode, size_t initialsz, 442 size_t* chunksizehintp, int* ncidp); 443 444 int nc_create(const(char)* path, int cmode, int* ncidp); 445 446 int nc__open(const(char)* path, int mode, 447 size_t* chunksizehintp, int* ncidp); 448 449 int nc_open(const(char)* path, int mode, int* ncidp); 450 451 /* Learn the path used to open/create the file. */ 452 int nc_inq_path(int ncid, size_t* pathlen, char* path); 453 454 /* Given an ncid and group name (NULL gets root group), return 455 * locid. */ 456 int nc_inq_ncid(int ncid, const(char)* name, int* grp_ncid); 457 458 /* Given a location id, return the number of groups it contains, and 459 * an array of their locids. */ 460 int nc_inq_grps(int ncid, int* numgrps, int* ncids); 461 462 /* Given locid, find name of group. (Root group is named "/".) */ 463 int nc_inq_grpname(int ncid, char* name); 464 465 /* Given ncid, find full name and len of full name. (Root group is 466 * named "/", with length 1.) */ 467 int nc_inq_grpname_full(int ncid, size_t* lenp, char* full_name); 468 469 /* Given ncid, find len of full name. */ 470 int nc_inq_grpname_len(int ncid, size_t* lenp); 471 472 /* Given an ncid, find the ncid of its parent group. */ 473 int nc_inq_grp_parent(int ncid, int* parent_ncid); 474 475 /* Given a name and parent ncid, find group ncid. */ 476 int nc_inq_grp_ncid(int ncid, const(char)* grp_name, int* grp_ncid); 477 478 /* Given a full name and ncid, find group ncid. */ 479 int nc_inq_grp_full_ncid(int ncid, const(char)* full_name, int* grp_ncid); 480 481 /* Get a list of ids for all the variables in a group. */ 482 int nc_inq_varids(int ncid, int* nvars, int* varids); 483 484 /* Find all dimids for a location. This finds all dimensions in a 485 * group, or any of its parents. */ 486 int nc_inq_dimids(int ncid, int* ndims, int* dimids, int include_parents); 487 488 /* Find all user-defined types for a location. This finds all 489 * user-defined types in a group. */ 490 int nc_inq_typeids(int ncid, int* ntypes, int* typeids); 491 492 /* Are two types equal? */ 493 int nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, 494 nc_type typeid2, int* equal); 495 496 /* Create a group. its ncid is returned in the new_ncid pointer. */ 497 int nc_def_grp(int parent_ncid, const(char)* name, int* new_ncid); 498 499 /* Rename a group */ 500 int nc_rename_grp(int grpid, const(char)* name); 501 502 /* Here are functions for dealing with compound types. */ 503 504 /* Create a compound type. */ 505 int nc_def_compound(int ncid, size_t size, const(char)* name, nc_type* typeidp); 506 507 /* Insert a named field into a compound type. */ 508 int nc_insert_compound(int ncid, nc_type xtype, const(char)* name, 509 size_t offset, nc_type field_typeid); 510 511 /* Insert a named array into a compound type. */ 512 int nc_insert_array_compound(int ncid, nc_type xtype, const(char)* name, 513 size_t offset, nc_type field_typeid, 514 int ndims, const(int)* dim_sizes); 515 516 /* Get the name and size of a type. */ 517 int nc_inq_type(int ncid, nc_type xtype, char* name, size_t* size); 518 519 /* Get the id of a type from the name. */ 520 int nc_inq_typeid(int ncid, const(char)* name, nc_type* typeidp); 521 522 /* Get the name, size, and number of fields in a compound type. */ 523 int nc_inq_compound(int ncid, nc_type xtype, char* name, size_t* sizep, 524 size_t* nfieldsp); 525 526 /* Get the name of a compound type. */ 527 int nc_inq_compound_name(int ncid, nc_type xtype, char* name); 528 529 /* Get the size of a compound type. */ 530 int nc_inq_compound_size(int ncid, nc_type xtype, size_t* sizep); 531 532 /* Get the number of fields in this compound type. */ 533 int nc_inq_compound_nfields(int ncid, nc_type xtype, size_t* nfieldsp); 534 535 /* Given the xtype and the fieldid, get all info about it. */ 536 int nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char* name, 537 size_t* offsetp, nc_type* field_typeidp, int* ndimsp, 538 int* dim_sizesp); 539 540 /* Given the typeid and the fieldid, get the name. */ 541 int nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid, 542 char* name); 543 544 /* Given the xtype and the name, get the fieldid. */ 545 int nc_inq_compound_fieldindex(int ncid, nc_type xtype, const(char)* name, 546 int* fieldidp); 547 548 /* Given the xtype and fieldid, get the offset. */ 549 int nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid, 550 size_t* offsetp); 551 552 /* Given the xtype and the fieldid, get the type of that field. */ 553 int nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid, 554 nc_type* field_typeidp); 555 556 /* Given the xtype and the fieldid, get the number of dimensions for 557 * that field (scalars are 0). */ 558 int nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid, 559 int* ndimsp); 560 561 /* Given the xtype and the fieldid, get the sizes of dimensions for 562 * that field. User must have allocated storage for the dim_sizes. */ 563 int nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid, 564 int* dim_sizes); 565 566 /** This is the type of arrays of vlens. */ 567 struct nc_vlen_t 568 { 569 size_t len; /**< Length of VL data (in base type units) */ 570 void* p; /**< Pointer to VL data */ 571 } 572 573 /** Calculate an offset for creating a compound type. This calls a 574 * mysterious C macro which was found carved into one of the blocks of 575 * the Newgrange passage tomb in County Meath, Ireland. This code has 576 * been carbon dated to 3200 B.C.E. */ 577 /// D specific just use S.M.offsetof instead 578 579 /* Create a variable length type. */ 580 int nc_def_vlen(int ncid, const(char)* name, nc_type base_typeid, nc_type* xtypep); 581 582 /* Find out about a vlen. */ 583 int nc_inq_vlen(int ncid, nc_type xtype, char* name, size_t* datum_sizep, 584 nc_type* base_nc_typep); 585 586 /* When you read VLEN type the library will actually allocate the 587 * storage space for the data. This storage space must be freed, so 588 * pass the pointer back to this function, when you're done with the 589 * data, and it will free the vlen memory. */ 590 int nc_free_vlen(nc_vlen_t* vl); 591 592 int nc_free_vlens(size_t len, nc_vlen_t* vlens); 593 594 /* Put or get one element in a vlen array. */ 595 int nc_put_vlen_element(int ncid, int typeid1, void* vlen_element, 596 size_t len, const(void)* data); 597 598 int nc_get_vlen_element(int ncid, int typeid1, const(void)* vlen_element, 599 size_t* len, void* data); 600 601 /* When you read the string type the library will allocate the storage 602 * space for the data. This storage space must be freed, so pass the 603 * pointer back to this function, when you're done with the data, and 604 * it will free the string memory. */ 605 int nc_free_string(size_t len, char** data); 606 607 /* Find out about a user defined type. */ 608 int nc_inq_user_type(int ncid, nc_type xtype, char* name, size_t* size, 609 nc_type* base_nc_typep, size_t* nfieldsp, int* classp); 610 611 /* Write an attribute of any type. */ 612 int nc_put_att(int ncid, int varid, const(char)* name, nc_type xtype, 613 size_t len, const(void)* op); 614 615 /* Read an attribute of any type. */ 616 int nc_get_att(int ncid, int varid, const(char)* name, void* ip); 617 618 /* Enum type. */ 619 620 /* Create an enum type. Provide a base type and a name. At the moment 621 * only ints are accepted as base types. */ 622 int nc_def_enum(int ncid, nc_type base_typeid, const(char)* name, 623 nc_type* typeidp); 624 625 /* Insert a named value into an enum type. The value must fit within 626 * the size of the enum type, the name size must be <= NC_MAX_NAME. */ 627 int nc_insert_enum(int ncid, nc_type xtype, const(char)* name, 628 const(void)* value); 629 630 /* Get information about an enum type: its name, base type and the 631 * number of members defined. */ 632 int nc_inq_enum(int ncid, nc_type xtype, char* name, nc_type* base_nc_typep, 633 size_t* base_sizep, size_t* num_membersp); 634 635 /* Get information about an enum member: a name and value. Name size 636 * will be <= NC_MAX_NAME. */ 637 int nc_inq_enum_member(int ncid, nc_type xtype, int idx, char* name, 638 void* value); 639 640 641 /* Get enum name from enum value. Name size will be <= NC_MAX_NAME. */ 642 int nc_inq_enum_ident(int ncid, nc_type xtype, c_long value, char* identifier); 643 644 /* Opaque type. */ 645 646 /* Create an opaque type. Provide a size and a name. */ 647 int nc_def_opaque(int ncid, size_t size, const(char)* name, nc_type* xtypep); 648 649 /* Get information about an opaque type. */ 650 int nc_inq_opaque(int ncid, nc_type xtype, char* name, size_t* sizep); 651 652 /* Write entire var of any type. */ 653 int nc_put_var(int ncid, int varid, const(void)* op); 654 655 /* Read entire var of any type. */ 656 int nc_get_var(int ncid, int varid, void* ip); 657 658 /* Write one value. */ 659 int nc_put_var1(int ncid, int varid, const(size_t)* indexp, 660 const(void)* op); 661 662 /* Read one value. */ 663 int nc_get_var1(int ncid, int varid, const(size_t)* indexp, void* ip); 664 665 /* Write an array of values. */ 666 int nc_put_vara(int ncid, int varid, const(size_t)* startp, 667 const(size_t)* countp, const(void)* op); 668 669 /* Read an array of values. */ 670 int nc_get_vara(int ncid, int varid, const(size_t)* startp, 671 const(size_t)* countp, void* ip); 672 673 /* Write slices of an array of values. */ 674 int nc_put_vars(int ncid, int varid, const(size_t)* startp, 675 const(size_t)* countp, const(ptrdiff_t)* stridep, 676 const(void)* op); 677 678 /* Read slices of an array of values. */ 679 int nc_get_vars(int ncid, int varid, const(size_t)* startp, 680 const(size_t)* countp, const(ptrdiff_t)* stridep, 681 void* ip); 682 683 /* Write mapped slices of an array of values. */ 684 int nc_put_varm(int ncid, int varid, const(size_t)* startp, 685 const(size_t)* countp, const(ptrdiff_t)* stridep, 686 const(ptrdiff_t)* imapp, const(void)* op); 687 688 /* Read mapped slices of an array of values. */ 689 int nc_get_varm(int ncid, int varid, const(size_t)* startp, 690 const(size_t)* countp, const(ptrdiff_t)* stridep, 691 const(ptrdiff_t)* imapp, void* ip); 692 693 /* Extra netcdf-4 stuff. */ 694 695 /* Set compression settings for a variable. Lower is faster, higher is 696 * better. Must be called after nc_def_var and before nc_enddef. */ 697 int nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, 698 int deflate_level); 699 700 /* Find out compression settings of a var. */ 701 int nc_inq_var_deflate(int ncid, int varid, int* shufflep, 702 int* deflatep, int* deflate_levelp); 703 704 /* Find out szip settings of a var. */ 705 int nc_inq_var_szip(int ncid, int varid, int* options_maskp, int* pixels_per_blockp); 706 707 /* Set fletcher32 checksum for a var. This must be done after nc_def_var 708 and before nc_enddef. */ 709 int nc_def_var_fletcher32(int ncid, int varid, int fletcher32); 710 711 /* Inquire about fletcher32 checksum for a var. */ 712 int nc_inq_var_fletcher32(int ncid, int varid, int* fletcher32p); 713 714 /* Define chunking for a variable. This must be done after nc_def_var 715 and before nc_enddef. */ 716 int nc_def_var_chunking(int ncid, int varid, int storage, const(size_t)* chunksizesp); 717 718 /* Inq chunking stuff for a var. */ 719 int nc_inq_var_chunking(int ncid, int varid, int* storagep, size_t* chunksizesp); 720 721 /* Define fill value behavior for a variable. This must be done after 722 nc_def_var and before nc_enddef. */ 723 int nc_def_var_fill(int ncid, int varid, int no_fill, const(void)* fill_value); 724 725 /* Inq fill value setting for a var. */ 726 int nc_inq_var_fill(int ncid, int varid, int* no_fill, void* fill_valuep); 727 728 /* Define the endianness of a variable. */ 729 int nc_def_var_endian(int ncid, int varid, int endian); 730 731 /* Learn about the endianness of a variable. */ 732 int nc_inq_var_endian(int ncid, int varid, int* endianp); 733 734 /* Set the fill mode (classic or 64-bit offset files only). */ 735 int nc_set_fill(int ncid, int fillmode, int* old_modep); 736 737 /* Set the default nc_create format to NC_FORMAT_CLASSIC, 738 * NC_FORMAT_64BIT, NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC. */ 739 int nc_set_default_format(int format, int* old_formatp); 740 741 /* Set the cache size, nelems, and preemption policy. */ 742 int nc_set_chunk_cache(size_t size, size_t nelems, float preemption); 743 744 /* Get the cache size, nelems, and preemption policy. */ 745 int nc_get_chunk_cache(size_t* sizep, size_t* nelemsp, float* preemptionp); 746 747 /* Set the per-variable cache size, nelems, and preemption policy. */ 748 int nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, 749 float preemption); 750 751 /* Set the per-variable cache size, nelems, and preemption policy. */ 752 int nc_get_var_chunk_cache(int ncid, int varid, size_t* sizep, size_t* nelemsp, 753 float* preemptionp); 754 755 int nc_redef(int ncid); 756 757 /* Is this ever used? */ 758 int nc__enddef(int ncid, size_t h_minfree, size_t v_align, 759 size_t v_minfree, size_t r_align); 760 761 int nc_enddef(int ncid); 762 763 int nc_sync(int ncid); 764 765 int nc_abort(int ncid); 766 767 int nc_close(int ncid); 768 769 int nc_inq(int ncid, int* ndimsp, int* nvarsp, int* nattsp, int* unlimdimidp); 770 771 int nc_inq_ndims(int ncid, int* ndimsp); 772 773 int nc_inq_nvars(int ncid, int* nvarsp); 774 775 int nc_inq_natts(int ncid, int* nattsp); 776 777 int nc_inq_unlimdim(int ncid, int* unlimdimidp); 778 779 /* The next function is for NetCDF-4 only */ 780 int nc_inq_unlimdims(int ncid, int* nunlimdimsp, int* unlimdimidsp); 781 782 /* Added in 3.6.1 to return format of netCDF file. */ 783 int nc_inq_format(int ncid, int* formatp); 784 785 /* Added in 4.3.1 to return additional format info */ 786 int nc_inq_format_extended(int ncid, int* formatp, int* modep); 787 788 /* Begin _dim */ 789 790 int nc_def_dim(int ncid, const(char)* name, size_t len, int* idp); 791 792 int nc_inq_dimid(int ncid, const(char)* name, int* idp); 793 794 int nc_inq_dim(int ncid, int dimid, char* name, size_t* lenp); 795 796 int nc_inq_dimname(int ncid, int dimid, char* name); 797 798 int nc_inq_dimlen(int ncid, int dimid, size_t* lenp); 799 800 int nc_rename_dim(int ncid, int dimid, const(char)* name); 801 802 /* End _dim */ 803 /* Begin _att */ 804 805 int nc_inq_att(int ncid, int varid, const(char)* name, 806 nc_type* xtypep, size_t* lenp); 807 808 int nc_inq_attid(int ncid, int varid, const(char)* name, int* idp); 809 810 int nc_inq_atttype(int ncid, int varid, const(char)* name, nc_type* xtypep); 811 812 int nc_inq_attlen(int ncid, int varid, const(char)* name, size_t* lenp); 813 814 int nc_inq_attname(int ncid, int varid, int attnum, char* name); 815 816 int nc_copy_att(int ncid_in, int varid_in, const(char)* name, int ncid_out, int varid_out); 817 818 int nc_rename_att(int ncid, int varid, const(char)* name, const(char)* newname); 819 820 int nc_del_att(int ncid, int varid, const(char)* name); 821 822 /* End _att */ 823 /* Begin {put,get}_att */ 824 825 int nc_put_att_text(int ncid, int varid, const(char)* name, 826 size_t len, const(char)* op); 827 828 int nc_get_att_text(int ncid, int varid, const(char)* name, char* ip); 829 830 int nc_put_att_ubyte(int ncid, int varid, const(char)* name, nc_type xtype, 831 size_t len, const(ubyte)* op); 832 833 int nc_get_att_ubyte(int ncid, int varid, const(char)* name, ubyte* ip); 834 835 int nc_put_att_schar(int ncid, int varid, const(char)* name, nc_type xtype, 836 size_t len, const(byte)* op); 837 838 int nc_get_att_schar(int ncid, int varid, const(char)* name, byte* ip); 839 840 int nc_put_att_short(int ncid, int varid, const(char)* name, nc_type xtype, 841 size_t len, const(short)* op); 842 843 int nc_get_att_short(int ncid, int varid, const(char)* name, short* ip); 844 845 int nc_put_att_int(int ncid, int varid, const(char)* name, nc_type xtype, 846 size_t len, const(int)* op); 847 848 int nc_get_att_int(int ncid, int varid, const(char)* name, int* ip); 849 850 int nc_put_att_long(int ncid, int varid, const(char)* name, nc_type xtype, 851 size_t len, const(c_long)* op); 852 853 int nc_get_att_long(int ncid, int varid, const(char)* name, c_long* ip); 854 855 int nc_put_att_float(int ncid, int varid, const(char)* name, nc_type xtype, 856 size_t len, const(float)* op); 857 858 int nc_get_att_float(int ncid, int varid, const(char)* name, float* ip); 859 860 int nc_put_att_double(int ncid, int varid, const(char)* name, nc_type xtype, 861 size_t len, const(double)* op); 862 863 int nc_get_att_double(int ncid, int varid, const(char)* name, double* ip); 864 865 int nc_put_att_ushort(int ncid, int varid, const(char)* name, nc_type xtype, 866 size_t len, const(ushort)* op); 867 868 int nc_get_att_ushort(int ncid, int varid, const(char)* name, ushort* ip); 869 870 int nc_put_att_uint(int ncid, int varid, const(char)* name, nc_type xtype, 871 size_t len, const(uint)* op); 872 873 int nc_get_att_uint(int ncid, int varid, const(char)* name, uint* ip); 874 875 int nc_put_att_longlong(int ncid, int varid, const(char)* name, nc_type xtype, 876 size_t len, const(long)* op); 877 878 int nc_get_att_longlong(int ncid, int varid, const(char)* name, long* ip); 879 880 int nc_put_att_ulonglong(int ncid, int varid, const(char)* name, nc_type xtype, 881 size_t len, const(ulong)* op); 882 883 int nc_get_att_ulonglong(int ncid, int varid, const(char)* name, 884 ulong* ip); 885 886 int nc_put_att_string(int ncid, int varid, const(char)* name, 887 size_t len, const(char)** op); 888 889 int nc_get_att_string(int ncid, int varid, const(char)* name, char** ip); 890 891 /* End {put,get}_att */ 892 /* Begin _var */ 893 894 int nc_def_var(int ncid, const(char)* name, nc_type xtype, int ndims, 895 const(int)* dimidsp, int* varidp); 896 897 int nc_inq_var(int ncid, int varid, char* name, nc_type* xtypep, 898 int* ndimsp, int* dimidsp, int* nattsp); 899 900 int nc_inq_varid(int ncid, const(char)* name, int* varidp); 901 902 int nc_inq_varname(int ncid, int varid, char* name); 903 904 int nc_inq_vartype(int ncid, int varid, nc_type* xtypep); 905 906 int nc_inq_varndims(int ncid, int varid, int* ndimsp); 907 908 int nc_inq_vardimid(int ncid, int varid, int* dimidsp); 909 910 int nc_inq_varnatts(int ncid, int varid, int* nattsp); 911 912 int nc_rename_var(int ncid, int varid, const(char)* name); 913 914 int nc_copy_var(int ncid_in, int varid, int ncid_out); 915 916 /* End _var */ 917 /* Begin {put,get}_var1 */ 918 919 int nc_put_var1_text(int ncid, int varid, const(size_t)* indexp, const(char)* op); 920 921 int nc_get_var1_text(int ncid, int varid, const(size_t)* indexp, char* ip); 922 923 int nc_put_var1_ubyte(int ncid, int varid, const(size_t)* indexp, 924 const(ubyte)* op); 925 926 int nc_get_var1_ubyte(int ncid, int varid, const(size_t)* indexp, 927 ubyte* ip); 928 929 int nc_put_var1_schar(int ncid, int varid, const(size_t)* indexp, 930 const(byte)* op); 931 932 int nc_get_var1_schar(int ncid, int varid, const(size_t)* indexp, 933 byte* ip); 934 935 int nc_put_var1_short(int ncid, int varid, const(size_t)* indexp, 936 const(short)* op); 937 938 int nc_get_var1_short(int ncid, int varid, const(size_t)* indexp, 939 short* ip); 940 941 int nc_put_var1_int(int ncid, int varid, const(size_t)* indexp, const(int)* op); 942 943 int nc_get_var1_int(int ncid, int varid, const(size_t)* indexp, int* ip); 944 945 int nc_put_var1_long(int ncid, int varid, const(size_t)* indexp, const(c_long)* op); 946 947 int nc_get_var1_long(int ncid, int varid, const(size_t)* indexp, c_long* ip); 948 949 int nc_put_var1_float(int ncid, int varid, const(size_t)* indexp, const(float)* op); 950 951 int nc_get_var1_float(int ncid, int varid, const(size_t)* indexp, float* ip); 952 953 int nc_put_var1_double(int ncid, int varid, const(size_t)* indexp, const(double)* op); 954 955 int nc_get_var1_double(int ncid, int varid, const(size_t)* indexp, double* ip); 956 957 int nc_put_var1_ushort(int ncid, int varid, const(size_t)* indexp, 958 const(ushort)* op); 959 960 int nc_get_var1_ushort(int ncid, int varid, const(size_t)* indexp, 961 ushort* ip); 962 963 int nc_put_var1_uint(int ncid, int varid, const(size_t)* indexp, 964 const(uint)* op); 965 966 int nc_get_var1_uint(int ncid, int varid, const(size_t)* indexp, 967 uint* ip); 968 969 int nc_put_var1_longlong(int ncid, int varid, const(size_t)* indexp, 970 const(long)* op); 971 972 int nc_get_var1_longlong(int ncid, int varid, const(size_t)* indexp, 973 long* ip); 974 975 int nc_put_var1_ulonglong(int ncid, int varid, const(size_t)* indexp, 976 const(ulong)* op); 977 978 int nc_get_var1_ulonglong(int ncid, int varid, const(size_t)* indexp, 979 const(ulong)* ip); 980 981 int nc_put_var1_string(int ncid, int varid, const(size_t)* indexp, 982 const(char)** op); 983 984 int nc_get_var1_string(int ncid, int varid, const(size_t)* indexp, 985 char** ip); 986 987 /* End {put,get}_var1 */ 988 /* Begin {put,get}_vara */ 989 990 int nc_put_vara_text(int ncid, int varid, const(size_t)* startp, 991 const(size_t)* countp, const(char)* op); 992 993 int nc_get_vara_text(int ncid, int varid, const(size_t)* startp, 994 const(size_t)* countp, char* ip); 995 996 int nc_put_vara_ubyte(int ncid, int varid, const(size_t)* startp, 997 const(size_t)* countp, const(ubyte)* op); 998 999 int nc_get_vara_ubyte(int ncid, int varid, const(size_t)* startp, 1000 const(size_t)* countp, ubyte* ip); 1001 1002 int nc_put_vara_schar(int ncid, int varid, const(size_t)* startp, 1003 const(size_t)* countp, const(byte)* op); 1004 1005 int nc_get_vara_schar(int ncid, int varid, const(size_t)* startp, 1006 const(size_t)* countp, byte* ip); 1007 1008 int nc_put_vara_short(int ncid, int varid, const(size_t)* startp, 1009 const(size_t)* countp, const(short)* op); 1010 1011 int nc_get_vara_short(int ncid, int varid, const(size_t)* startp, 1012 const(size_t)* countp, short* ip); 1013 1014 int nc_put_vara_int(int ncid, int varid, const(size_t)* startp, 1015 const(size_t)* countp, const(int)* op); 1016 1017 int nc_get_vara_int(int ncid, int varid, const(size_t)* startp, 1018 const(size_t)* countp, int* ip); 1019 1020 int nc_put_vara_long(int ncid, int varid, const(size_t)* startp, 1021 const(size_t)* countp, const(c_long)* op); 1022 1023 int nc_get_vara_long(int ncid, int varid, 1024 const(size_t)* startp, const(size_t)* countp, c_long* ip); 1025 1026 int nc_put_vara_float(int ncid, int varid, 1027 const(size_t)* startp, const(size_t)* countp, const(float)* op); 1028 1029 int nc_get_vara_float(int ncid, int varid, 1030 const(size_t)* startp, const(size_t)* countp, float* ip); 1031 1032 int nc_put_vara_double(int ncid, int varid, const(size_t)* startp, 1033 const(size_t)* countp, const(double)* op); 1034 1035 int nc_get_vara_double(int ncid, int varid, const(size_t)* startp, 1036 const(size_t)* countp, double* ip); 1037 1038 int nc_put_vara_ushort(int ncid, int varid, const(size_t)* startp, 1039 const(size_t)* countp, const(ushort)* op); 1040 1041 int nc_get_vara_ushort(int ncid, int varid, const(size_t)* startp, 1042 const(size_t)* countp, ushort* ip); 1043 1044 int nc_put_vara_uint(int ncid, int varid, const(size_t)* startp, 1045 const(size_t)* countp, const(uint)* op); 1046 1047 int nc_get_vara_uint(int ncid, int varid, const(size_t)* startp, 1048 const(size_t)* countp, uint* ip); 1049 1050 int nc_put_vara_longlong(int ncid, int varid, const(size_t)* startp, 1051 const(size_t)* countp, const(long)* op); 1052 1053 int nc_get_vara_longlong(int ncid, int varid, const(size_t)* startp, 1054 const(size_t)* countp, long* ip); 1055 1056 int nc_put_vara_ulonglong(int ncid, int varid, const(size_t)* startp, 1057 const(size_t)* countp, const(ulong)* op); 1058 1059 int nc_get_vara_ulonglong(int ncid, int varid, const(size_t)* startp, 1060 const(size_t)* countp, ulong* ip); 1061 1062 int nc_put_vara_string(int ncid, int varid, const(size_t)* startp, 1063 const(size_t)* countp, const(char)** op); 1064 1065 int nc_get_vara_string(int ncid, int varid, const(size_t)* startp, 1066 const(size_t)* countp, char** ip); 1067 1068 /* End {put,get}_vara */ 1069 /* Begin {put,get}_vars */ 1070 1071 int nc_put_vars_text(int ncid, int varid, 1072 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1073 const(char)* op); 1074 1075 int nc_get_vars_text(int ncid, int varid, 1076 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1077 char* ip); 1078 1079 int nc_put_vars_ubyte(int ncid, int varid, 1080 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1081 const(ubyte)* op); 1082 1083 int nc_get_vars_ubyte(int ncid, int varid, 1084 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1085 ubyte* ip); 1086 1087 int nc_put_vars_schar(int ncid, int varid, 1088 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1089 const(byte)* op); 1090 1091 int nc_get_vars_schar(int ncid, int varid, 1092 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1093 byte* ip); 1094 1095 int nc_put_vars_short(int ncid, int varid, 1096 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1097 const(short)* op); 1098 1099 int nc_get_vars_short(int ncid, int varid, const(size_t)* startp, 1100 const(size_t)* countp, const(ptrdiff_t)* stridep, 1101 short* ip); 1102 1103 int nc_put_vars_int(int ncid, int varid, 1104 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1105 const(int)* op); 1106 1107 int nc_get_vars_int(int ncid, int varid, 1108 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1109 int* ip); 1110 1111 int nc_put_vars_long(int ncid, int varid, 1112 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1113 const(c_long)* op); 1114 1115 int nc_get_vars_long(int ncid, int varid, 1116 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1117 c_long* ip); 1118 1119 int nc_put_vars_float(int ncid, int varid, 1120 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1121 const(float)* op); 1122 1123 int nc_get_vars_float(int ncid, int varid, 1124 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1125 float* ip); 1126 1127 int nc_put_vars_double(int ncid, int varid, 1128 const(size_t)* startp, const(size_t)* countp, const(ptrdiff_t)* stridep, 1129 const(double)* op); 1130 1131 int nc_get_vars_double(int ncid, int varid, const(size_t)* startp, 1132 const(size_t)* countp, const(ptrdiff_t)* stridep, 1133 double* ip); 1134 1135 int nc_put_vars_ushort(int ncid, int varid, const(size_t)* startp, 1136 const(size_t)* countp, const(ptrdiff_t)* stridep, 1137 const(ushort)* op); 1138 1139 int nc_get_vars_ushort(int ncid, int varid, const(size_t)* startp, 1140 const(size_t)* countp, const(ptrdiff_t)* stridep, 1141 ushort* ip); 1142 1143 int nc_put_vars_uint(int ncid, int varid, const(size_t)* startp, 1144 const(size_t)* countp, const(ptrdiff_t)* stridep, 1145 const(uint)* op); 1146 1147 int nc_get_vars_uint(int ncid, int varid, const(size_t)* startp, 1148 const(size_t)* countp, const(ptrdiff_t)* stridep, 1149 uint* ip); 1150 1151 int nc_put_vars_longlong(int ncid, int varid, const(size_t)* startp, 1152 const(size_t)* countp, const(ptrdiff_t)* stridep, 1153 const(long)* op); 1154 1155 int nc_get_vars_longlong(int ncid, int varid, const(size_t)* startp, 1156 const(size_t)* countp, const(ptrdiff_t)* stridep, 1157 long* ip); 1158 1159 int nc_put_vars_ulonglong(int ncid, int varid, const(size_t)* startp, 1160 const(size_t)* countp, const(ptrdiff_t)* stridep, 1161 const(ulong)* op); 1162 1163 int nc_get_vars_ulonglong(int ncid, int varid, const(size_t)* startp, 1164 const(size_t)* countp, const(ptrdiff_t)* stridep, 1165 ulong* ip); 1166 1167 int nc_put_vars_string(int ncid, int varid, const(size_t)* startp, 1168 const(size_t)* countp, const(ptrdiff_t)* stridep, 1169 const(char)** op); 1170 1171 int nc_get_vars_string(int ncid, int varid, const(size_t)* startp, 1172 const(size_t)* countp, const(ptrdiff_t)* stridep, 1173 char** ip); 1174 1175 /* End {put,get}_vars */ 1176 /* Begin {put,get}_varm */ 1177 1178 int nc_put_varm_text(int ncid, int varid, const(size_t)* startp, 1179 const(size_t)* countp, const(ptrdiff_t)* stridep, 1180 const(ptrdiff_t)* imapp, const(char)* op); 1181 1182 int nc_get_varm_text(int ncid, int varid, const(size_t)* startp, 1183 const(size_t)* countp, const(ptrdiff_t)* stridep, 1184 const(ptrdiff_t)* imapp, char* ip); 1185 1186 int nc_put_varm_ubyte(int ncid, int varid, const(size_t)* startp, 1187 const(size_t)* countp, const(ptrdiff_t)* stridep, 1188 const(ptrdiff_t)* imapp, const(ubyte)* op); 1189 1190 int nc_get_varm_ubyte(int ncid, int varid, const(size_t)* startp, 1191 const(size_t)* countp, const(ptrdiff_t)* stridep, 1192 const(ptrdiff_t)* imapp, ubyte* ip); 1193 1194 int nc_put_varm_schar(int ncid, int varid, const(size_t)* startp, 1195 const(size_t)* countp, const(ptrdiff_t)* stridep, 1196 const(ptrdiff_t)* imapp, const(byte)* op); 1197 1198 int nc_get_varm_schar(int ncid, int varid, const(size_t)* startp, 1199 const(size_t)* countp, const(ptrdiff_t)* stridep, 1200 const(ptrdiff_t)* imapp, byte* ip); 1201 1202 int nc_put_varm_short(int ncid, int varid, const(size_t)* startp, 1203 const(size_t)* countp, const(ptrdiff_t)* stridep, 1204 const(ptrdiff_t)* imapp, const(short)* op); 1205 1206 int nc_get_varm_short(int ncid, int varid, const(size_t)* startp, 1207 const(size_t)* countp, const(ptrdiff_t)* stridep, 1208 const(ptrdiff_t)* imapp, short* ip); 1209 1210 int nc_put_varm_int(int ncid, int varid, const(size_t)* startp, 1211 const(size_t)* countp, const(ptrdiff_t)* stridep, 1212 const(ptrdiff_t)* imapp, const(int)* op); 1213 1214 int nc_get_varm_int(int ncid, int varid, const(size_t)* startp, 1215 const(size_t)* countp, const(ptrdiff_t)* stridep, 1216 const(ptrdiff_t)* imapp, int* ip); 1217 1218 int nc_put_varm_long(int ncid, int varid, const(size_t)* startp, 1219 const(size_t)* countp, const(ptrdiff_t)* stridep, 1220 const(ptrdiff_t)* imapp, const(c_long)* op); 1221 1222 int nc_get_varm_long(int ncid, int varid, const(size_t)* startp, 1223 const(size_t)* countp, const(ptrdiff_t)* stridep, 1224 const(ptrdiff_t)* imapp, c_long* ip); 1225 1226 int nc_put_varm_float(int ncid, int varid,const(size_t)* startp, 1227 const(size_t)* countp, const(ptrdiff_t)* stridep, 1228 const(ptrdiff_t)* imapp, const(float)* op); 1229 1230 int nc_get_varm_float(int ncid, int varid,const(size_t)* startp, 1231 const(size_t)* countp, const(ptrdiff_t)* stridep, 1232 const(ptrdiff_t)* imapp, float* ip); 1233 1234 int nc_put_varm_double(int ncid, int varid, const(size_t)* startp, 1235 const(size_t)* countp, const(ptrdiff_t)* stridep, 1236 const(ptrdiff_t)* imapp, const(double)* op); 1237 1238 int nc_get_varm_double(int ncid, int varid, const(size_t)* startp, 1239 const(size_t)* countp, const(ptrdiff_t)* stridep, 1240 const(ptrdiff_t)* imapp, double* ip); 1241 1242 int nc_put_varm_ushort(int ncid, int varid, const(size_t)* startp, 1243 const(size_t)* countp, const(ptrdiff_t)* stridep, 1244 const(ptrdiff_t)* imapp, const(ushort)* op); 1245 1246 int nc_get_varm_ushort(int ncid, int varid, const(size_t)* startp, 1247 const(size_t)* countp, const(ptrdiff_t)* stridep, 1248 const(ptrdiff_t)* imapp, ushort* ip); 1249 1250 int nc_put_varm_uint(int ncid, int varid, const(size_t)* startp, 1251 const(size_t)* countp, const(ptrdiff_t)* stridep, 1252 const(ptrdiff_t)* imapp, const(uint)* op); 1253 1254 int nc_get_varm_uint(int ncid, int varid, const(size_t)* startp, 1255 const(size_t)* countp, const(ptrdiff_t)* stridep, 1256 const(ptrdiff_t)* imapp, uint* ip); 1257 1258 int nc_put_varm_longlong(int ncid, int varid, const(size_t)* startp, 1259 const(size_t)* countp, const(ptrdiff_t)* stridep, 1260 const(ptrdiff_t)* imapp, const long* op); 1261 1262 int nc_get_varm_longlong(int ncid, int varid, const(size_t)* startp, 1263 const(size_t)* countp, const(ptrdiff_t)* stridep, 1264 const(ptrdiff_t)* imapp, long* ip); 1265 1266 int nc_put_varm_ulonglong(int ncid, int varid, const(size_t)* startp, 1267 const(size_t)* countp, const(ptrdiff_t)* stridep, 1268 const(ptrdiff_t)* imapp, const(ulong)* op); 1269 1270 int nc_get_varm_ulonglong(int ncid, int varid, const(size_t)* startp, 1271 const(size_t)* countp, const(ptrdiff_t)* stridep, 1272 const(ptrdiff_t)* imapp, ulong* ip); 1273 1274 int nc_put_varm_string(int ncid, int varid, const(size_t)* startp, 1275 const(size_t)* countp, const(ptrdiff_t)* stridep, 1276 const(ptrdiff_t)* imapp, const(char)** op); 1277 1278 int nc_get_varm_string(int ncid, int varid, const(size_t)* startp, 1279 const(size_t)* countp, const(ptrdiff_t)* stridep, 1280 const(ptrdiff_t)* imapp, char** ip); 1281 1282 /* End {put,get}_varm */ 1283 /* Begin {put,get}_var */ 1284 1285 int nc_put_var_text(int ncid, int varid, const(char)* op); 1286 1287 int nc_get_var_text(int ncid, int varid, char* ip); 1288 1289 int nc_put_var_ubyte(int ncid, int varid, const(ubyte)* op); 1290 1291 int nc_get_var_ubyte(int ncid, int varid, ubyte* ip); 1292 1293 int nc_put_var_schar(int ncid, int varid, const(byte)* op); 1294 1295 int nc_get_var_schar(int ncid, int varid, byte* ip); 1296 1297 int nc_put_var_short(int ncid, int varid, const(short)* op); 1298 1299 int nc_get_var_short(int ncid, int varid, short* ip); 1300 1301 int nc_put_var_int(int ncid, int varid, const(int)* op); 1302 1303 int nc_get_var_int(int ncid, int varid, int* ip); 1304 1305 int nc_put_var_long(int ncid, int varid, const(c_long)* op); 1306 1307 int nc_get_var_long(int ncid, int varid, c_long* ip); 1308 1309 int nc_put_var_float(int ncid, int varid, const(float)* op); 1310 1311 int nc_get_var_float(int ncid, int varid, float* ip); 1312 1313 int nc_put_var_double(int ncid, int varid, const(double)* op); 1314 1315 int nc_get_var_double(int ncid, int varid, double* ip); 1316 1317 int nc_put_var_ushort(int ncid, int varid, const(ushort)* op); 1318 1319 int nc_get_var_ushort(int ncid, int varid, ushort* ip); 1320 1321 int nc_put_var_uint(int ncid, int varid, const(uint)* op); 1322 1323 int nc_get_var_uint(int ncid, int varid, uint* ip); 1324 1325 int nc_put_var_longlong(int ncid, int varid, const(long)* op); 1326 1327 int nc_get_var_longlong(int ncid, int varid, long* ip); 1328 1329 int nc_put_var_ulonglong(int ncid, int varid, const(ulong)* op); 1330 1331 int nc_get_var_ulonglong(int ncid, int varid, ulong* ip); 1332 1333 int nc_put_var_string(int ncid, int varid, const(char)** op); 1334 1335 int nc_get_var_string(int ncid, int varid, char** ip); 1336 1337 /* Use this to turn off logging by calling 1338 nc_log_level(NC_TURN_OFF_LOGGING) */ 1339 enum NC_TURN_OFF_LOGGING = -1; 1340 1341 version(LOGGING) 1342 { 1343 /* Set the log level. 0 shows only errors, 1 only major messages, 1344 * etc., to 5, which shows way too much information. */ 1345 int nc_set_log_level(int new_level); 1346 } 1347 else 1348 { 1349 //no-op 1350 int nc_set_log_level(int new_level) { return 0; } 1351 } 1352 1353 /* Show the netCDF library's in-memory metadata for a file. */ 1354 int nc_show_metadata(int ncid); 1355 1356 /* End {put,get}_var */ 1357 1358 /* #ifdef _CRAYMPP */ 1359 /* 1360 * Public interfaces to better support 1361 * CRAY multi-processor systems like T3E. 1362 * A tip of the hat to NERSC. 1363 */ 1364 /* 1365 * It turns out we need to declare and define 1366 * these public interfaces on all platforms 1367 * or things get ugly working out the 1368 * FORTRAN interface. On !_CRAYMPP platforms, 1369 * these functions work as advertised, but you 1370 * can only use "processor element" 0. 1371 */ 1372 1373 int nc__create_mp(const(char)* path, int cmode, size_t initialsz, int basepe, 1374 size_t* chunksizehintp, int* ncidp); 1375 1376 int nc__open_mp(const(char)* path, int mode, int basepe, 1377 size_t* chunksizehintp, int* ncidp); 1378 1379 int nc_delete(const(char)* path); 1380 1381 int nc_delete_mp(const(char)* path, int basepe); 1382 1383 int nc_set_base_pe(int ncid, int pe); 1384 1385 int nc_inq_base_pe(int ncid, int* pe); 1386 1387 /* #endif _CRAYMPP */