netcdf.h
Go to the documentation of this file.00001 /* 00002 * Copyright 1993-2005 University Corporation for Atmospheric Research/Unidata 00003 * 00004 * Portions of this software were developed by the Unidata Program at the 00005 * University Corporation for Atmospheric Research. 00006 * 00007 * Access and use of this software shall impose the following obligations 00008 * and understandings on the user. The user is granted the right, without 00009 * any fee or cost, to use, copy, modify, alter, enhance and distribute 00010 * this software, and any derivative works thereof, and its supporting 00011 * documentation for any purpose whatsoever, provided that this entire 00012 * notice appears in all copies of the software, derivative works and 00013 * supporting documentation. Further, UCAR requests that the user credit 00014 * UCAR/Unidata in any publications that result from the use of this 00015 * software or in any product that includes this software. The names UCAR 00016 * and/or Unidata, however, may not be used in any advertising or publicity 00017 * to endorse or promote any products or commercial entity unless specific 00018 * written permission is obtained from UCAR/Unidata. The user also 00019 * understands that UCAR/Unidata is not obligated to provide the user with 00020 * any support, consulting, training or assistance of any kind with regard 00021 * to the use, operation and performance of this software nor to provide 00022 * the user with any updates, revisions, new versions or "bug fixes." 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR 00025 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, 00028 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00029 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00030 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00031 * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 00032 */ 00033 /* "$Id$" */ 00034 00035 #ifndef _NETCDF_ 00036 #define _NETCDF_ 00037 00038 #include <stddef.h> /* size_t, ptrdiff_t */ 00039 #include <errno.h> /* netcdf functions sometimes return system errors */ 00040 00041 #if defined(__cplusplus) 00042 extern "C" { 00043 #endif 00044 00045 /* 00046 * The netcdf external data types 00047 */ 00048 typedef enum { 00049 NC_NAT = 0, /* NAT = 'Not A Type' (c.f. NaN) */ 00050 NC_BYTE = 1, /* signed 1 byte integer */ 00051 NC_CHAR = 2, /* ISO/ASCII character */ 00052 NC_SHORT = 3, /* signed 2 byte integer */ 00053 NC_INT = 4, /* signed 4 byte integer */ 00054 NC_FLOAT = 5, /* single precision floating point number */ 00055 NC_DOUBLE = 6 /* double precision floating point number */ 00056 } nc_type; 00057 00058 00059 /* 00060 * Default fill values, used unless _FillValue attribute is set. 00061 * These values are stuffed into newly allocated space as appropriate. 00062 * The hope is that one might use these to notice that a particular datum 00063 * has not been set. 00064 */ 00065 #define NC_FILL_BYTE ((signed char)-127) 00066 #define NC_FILL_CHAR ((char)0) 00067 #define NC_FILL_SHORT ((short)-32767) 00068 #define NC_FILL_INT (-2147483647L) 00069 #define NC_FILL_FLOAT (9.9692099683868690e+36f) /* near 15 * 2^119 */ 00070 #define NC_FILL_DOUBLE (9.9692099683868690e+36) 00071 00072 00073 /* 00074 * The above values are defaults. 00075 * If you wish a variable to use a different value than the above 00076 * defaults, create an attribute with the same type as the variable 00077 * and the following reserved name. The value you give the attribute 00078 * will be used as the fill value for that variable. 00079 */ 00080 #define _FillValue "_FillValue" 00081 #define NC_FILL 0 /* argument to ncsetfill to clear NC_NOFILL */ 00082 #define NC_NOFILL 0x100 /* Don't fill data section an records */ 00083 00084 /* 00085 * 'mode' flags for ncopen 00086 */ 00087 #define NC_NOWRITE 0 /* default is read only */ 00088 #define NC_WRITE 0x1 /* read & write */ 00089 00090 /* 00091 * 'mode' flags for nccreate 00092 */ 00093 #define NC_CLOBBER 0 00094 #define NC_NOCLOBBER 0x4 /* Don't destroy existing file on create */ 00095 #define NC_64BIT_OFFSET 0x0200 /* Use large (64-bit) file offsets */ 00096 00097 /* 00098 * 'mode' flags for nccreate and ncopen 00099 */ 00100 #define NC_SHARE 0x0800 /* Share updates, limit cacheing */ 00101 #define NC_STRICT_NC3 (0x8) 00102 00103 /* The following flag currently is ignored, but use in 00104 * nc_open() or nc_create() may someday support use of advisory 00105 * locking to prevent multiple writers from clobbering a file 00106 */ 00107 #define NC_LOCK 0x0400 /* Use locking if available */ 00108 00109 /* 00110 * Starting with version 3.6, there were two different format netCDF 00111 * files. netCDF-4 introduces the third one. 00112 */ 00113 #define NC_FORMAT_CLASSIC (1) 00114 #define NC_FORMAT_64BIT (2) 00115 #define NC_FORMAT_NETCDF4 (3) 00116 #define NC_FORMAT_NETCDF4_CLASSIC (4) /* create netcdf-4 files, with NC_STRICT_NC3. */ 00117 00118 /* 00119 * Let nc__create() or nc__open() figure out 00120 * as suitable chunk size. 00121 */ 00122 #define NC_SIZEHINT_DEFAULT 0 00123 00124 /* 00125 * In nc__enddef(), align to the chunk size. 00126 */ 00127 #define NC_ALIGN_CHUNK ((size_t)(-1)) 00128 00129 /* 00130 * 'size' argument to ncdimdef for an unlimited dimension 00131 */ 00132 #define NC_UNLIMITED 0L 00133 00134 /* 00135 * attribute id to put/get a global attribute 00136 */ 00137 #define NC_GLOBAL -1 00138 00139 /* These are in support of the coordinate axis stuff. */ 00140 #define NC_NOAXISTYPE 0 00141 #define NC_LATITUDE 1 00142 #define NC_LONGITUDE 2 00143 #define NC_GEOX 3 00144 #define NC_GEOY 4 00145 #define NC_GEOZ 5 00146 #define NC_HEIGHT_UP 6 00147 #define NC_HEIGHT_DOWN 7 00148 #define NC_PRESSURE 8 00149 #define NC_TIME 9 00150 #define NC_RADAZ 10 00151 #define NC_RADEL 11 00152 #define NC_RADDIST 12 00153 00154 /* 00155 * These maximums are enforced by the interface, to facilitate writing 00156 * applications and utilities. However, nothing is statically allocated to 00157 * these sizes internally. 00158 */ 00159 #define NC_MAX_DIMS 65536 /* max dimensions per file */ 00160 #define NC_MAX_ATTRS 8192 /* max global or per variable attributes */ 00161 #define NC_MAX_VARS 524288 /* max variables per file */ 00162 #define NC_MAX_NAME 256 /* max length of a name */ 00163 #define NC_MAX_VAR_DIMS 8 /* max per variable dimensions */ 00164 00165 /* 00166 * The netcdf version 3 functions all return integer error status. 00167 * These are the possible values, in addition to certain 00168 * values from the system errno.h. 00169 */ 00170 00171 #define NC_ISSYSERR(err) ((err) > 0) 00172 00173 #define NC_NOERR 0 /* No Error */ 00174 00175 #define NC2_ERR (-1) /* Returned for all errors in the v2 API. */ 00176 #define NC_EBADID (-33) /* Not a netcdf id */ 00177 #define NC_ENFILE (-34) /* Too many netcdfs open */ 00178 #define NC_EEXIST (-35) /* netcdf file exists && NC_NOCLOBBER */ 00179 #define NC_EINVAL (-36) /* Invalid Argument */ 00180 #define NC_EPERM (-37) /* Write to read only */ 00181 #define NC_ENOTINDEFINE (-38) /* Operation not allowed in data mode */ 00182 #define NC_EINDEFINE (-39) /* Operation not allowed in define mode */ 00183 #define NC_EINVALCOORDS (-40) /* Index exceeds dimension bound */ 00184 #define NC_EMAXDIMS (-41) /* NC_MAX_DIMS exceeded */ 00185 #define NC_ENAMEINUSE (-42) /* String match to name in use */ 00186 #define NC_ENOTATT (-43) /* Attribute not found */ 00187 #define NC_EMAXATTS (-44) /* NC_MAX_ATTRS exceeded */ 00188 #define NC_EBADTYPE (-45) /* Not a netcdf data type */ 00189 #define NC_EBADDIM (-46) /* Invalid dimension id or name */ 00190 #define NC_EUNLIMPOS (-47) /* NC_UNLIMITED in the wrong index */ 00191 #define NC_EMAXVARS (-48) /* NC_MAX_VARS exceeded */ 00192 #define NC_ENOTVAR (-49) /* Variable not found */ 00193 #define NC_EGLOBAL (-50) /* Action prohibited on NC_GLOBAL varid */ 00194 #define NC_ENOTNC (-51) /* Not a netcdf file */ 00195 #define NC_ESTS (-52) /* In Fortran, string too short */ 00196 #define NC_EMAXNAME (-53) /* NC_MAX_NAME exceeded */ 00197 #define NC_EUNLIMIT (-54) /* NC_UNLIMITED size already in use */ 00198 #define NC_ENORECVARS (-55) /* nc_rec op when there are no record vars */ 00199 #define NC_ECHAR (-56) /* Attempt to convert between text & numbers */ 00200 #define NC_EEDGE (-57) /* Start+count exceeds dimension bound */ 00201 #define NC_ESTRIDE (-58) /* Illegal stride */ 00202 #define NC_EBADNAME (-59) /* Attribute or variable name 00203 contains illegal characters */ 00204 /* N.B. following must match value in ncx.h */ 00205 #define NC_ERANGE (-60) /* Math result not representable */ 00206 #define NC_ENOMEM (-61) /* Memory allocation (malloc) failure */ 00207 00208 #define NC_EVARSIZE (-62) /* One or more variable sizes violate 00209 format constraints */ 00210 #define NC_EDIMSIZE (-63) /* Invalid dimension size */ 00211 #define NC_ETRUNC (-64) /* File likely truncated or possibly corrupted */ 00212 00213 /* 00214 * The Interface 00215 */ 00216 00217 /* Declaration modifiers for DLL support (MSC et al) */ 00218 00219 #if defined(DLL_NETCDF) /* define when library is a DLL */ 00220 # if defined(NC_DLL_EXPORT) /* define when building the library */ 00221 # define MSC_EXTRA __declspec(dllexport) 00222 # else 00223 # define MSC_EXTRA __declspec(dllimport) 00224 # endif 00225 #include <io.h> 00226 #define lseek _lseeki64 00227 #define off_t __int64 00228 #define stat __stat64 00229 #define fstat _fstat64 00230 #else 00231 #define MSC_EXTRA 00232 #endif /* defined(DLL_NETCDF) */ 00233 00234 # define EXTERNL extern MSC_EXTRA 00235 00236 /* When netCDF is built as a DLL, this will export ncerr and 00237 * ncopts. When it is used as a DLL, it will import them. */ 00238 #if defined(DLL_NETCDF) 00239 MSC_EXTRA int ncerr; 00240 MSC_EXTRA int ncopts; 00241 #endif 00242 00243 EXTERNL const char * 00244 nc_inq_libvers(void); 00245 00246 EXTERNL const char * 00247 nc_strerror(int ncerr); 00248 00249 EXTERNL int 00250 nc__create(const char *path, int cmode, size_t initialsz, 00251 size_t *chunksizehintp, int *ncidp); 00252 00253 EXTERNL int 00254 nc_create(const char *path, int cmode, int *ncidp); 00255 00256 EXTERNL int 00257 nc__open(const char *path, int mode, 00258 size_t *chunksizehintp, int *ncidp); 00259 00260 EXTERNL int 00261 nc_open(const char *path, int mode, int *ncidp); 00262 00263 EXTERNL int 00264 nc_set_fill(int ncid, int fillmode, int *old_modep); 00265 00266 EXTERNL int 00267 nc_redef(int ncid); 00268 00269 EXTERNL int 00270 nc__enddef(int ncid, size_t h_minfree, size_t v_align, 00271 size_t v_minfree, size_t r_align); 00272 00273 EXTERNL int 00274 nc_enddef(int ncid); 00275 00276 EXTERNL int 00277 nc_sync(int ncid); 00278 00279 EXTERNL int 00280 nc_abort(int ncid); 00281 00282 EXTERNL int 00283 nc_close(int ncid); 00284 00285 EXTERNL int 00286 nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp); 00287 00288 EXTERNL int 00289 nc_inq_ndims(int ncid, int *ndimsp); 00290 00291 EXTERNL int 00292 nc_inq_nvars(int ncid, int *nvarsp); 00293 00294 EXTERNL int 00295 nc_inq_natts(int ncid, int *nattsp); 00296 00297 EXTERNL int 00298 nc_inq_unlimdim(int ncid, int *unlimdimidp); 00299 00300 EXTERNL int 00301 nc_set_default_format(int format, int *old_formatp); 00302 00303 EXTERNL int 00304 nc_inq_format(int ncid, int *formatp); 00305 00306 /* Begin _dim */ 00307 00308 EXTERNL int 00309 nc_def_dim(int ncid, const char *name, size_t len, int *idp); 00310 00311 EXTERNL int 00312 nc_inq_dimid(int ncid, const char *name, int *idp); 00313 00314 EXTERNL int 00315 nc_inq_dim(int ncid, int dimid, char *name, size_t *lenp); 00316 00317 EXTERNL int 00318 nc_inq_dimname(int ncid, int dimid, char *name); 00319 00320 EXTERNL int 00321 nc_inq_dimlen(int ncid, int dimid, size_t *lenp); 00322 00323 EXTERNL int 00324 nc_rename_dim(int ncid, int dimid, const char *name); 00325 00326 /* End _dim */ 00327 /* Begin _att */ 00328 00329 EXTERNL int 00330 nc_inq_att(int ncid, int varid, const char *name, 00331 nc_type *xtypep, size_t *lenp); 00332 00333 EXTERNL int 00334 nc_inq_attid(int ncid, int varid, const char *name, int *idp); 00335 00336 EXTERNL int 00337 nc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep); 00338 00339 EXTERNL int 00340 nc_inq_attlen(int ncid, int varid, const char *name, size_t *lenp); 00341 00342 EXTERNL int 00343 nc_inq_attname(int ncid, int varid, int attnum, char *name); 00344 00345 EXTERNL int 00346 nc_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out); 00347 00348 EXTERNL int 00349 nc_rename_att(int ncid, int varid, const char *name, const char *newname); 00350 00351 EXTERNL int 00352 nc_del_att(int ncid, int varid, const char *name); 00353 00354 /* End _att */ 00355 /* Begin {put,get}_att */ 00356 00357 EXTERNL int 00358 nc_put_att(int ncid, int varid, const char *name, nc_type datatype, 00359 size_t len, const void *value); 00360 00361 EXTERNL int 00362 nc_get_att(int ncid, int varid, const char *name, void *value); 00363 00364 EXTERNL int 00365 nc_put_att_text(int ncid, int varid, const char *name, 00366 size_t len, const char *op); 00367 00368 EXTERNL int 00369 nc_get_att_text(int ncid, int varid, const char *name, char *ip); 00370 00371 EXTERNL int 00372 nc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, 00373 size_t len, const unsigned char *op); 00374 00375 EXTERNL int 00376 nc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip); 00377 00378 EXTERNL int 00379 nc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, 00380 size_t len, const signed char *op); 00381 00382 EXTERNL int 00383 nc_get_att_schar(int ncid, int varid, const char *name, signed char *ip); 00384 00385 EXTERNL int 00386 nc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, 00387 size_t len, const short *op); 00388 00389 EXTERNL int 00390 nc_get_att_short(int ncid, int varid, const char *name, short *ip); 00391 00392 EXTERNL int 00393 nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, 00394 size_t len, const int *op); 00395 00396 EXTERNL int 00397 nc_get_att_int(int ncid, int varid, const char *name, int *ip); 00398 00399 EXTERNL int 00400 nc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, 00401 size_t len, const long *op); 00402 00403 EXTERNL int 00404 nc_get_att_long(int ncid, int varid, const char *name, long *ip); 00405 00406 EXTERNL int 00407 nc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, 00408 size_t len, const float *op); 00409 00410 EXTERNL int 00411 nc_get_att_float(int ncid, int varid, const char *name, float *ip); 00412 00413 EXTERNL int 00414 nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, 00415 size_t len, const double *op); 00416 00417 EXTERNL int 00418 nc_get_att_double(int ncid, int varid, const char *name, double *ip); 00419 00420 /* End {put,get}_att */ 00421 /* Begin _var */ 00422 00423 EXTERNL int 00424 nc_def_var(int ncid, const char *name, nc_type xtype, int ndims, 00425 const int *dimidsp, int *varidp); 00426 00427 EXTERNL int 00428 nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, 00429 int *ndimsp, int *dimidsp, int *nattsp); 00430 00431 EXTERNL int 00432 nc_inq_varid(int ncid, const char *name, int *varidp); 00433 00434 EXTERNL int 00435 nc_inq_varname(int ncid, int varid, char *name); 00436 00437 EXTERNL int 00438 nc_inq_vartype(int ncid, int varid, nc_type *xtypep); 00439 00440 EXTERNL int 00441 nc_inq_varndims(int ncid, int varid, int *ndimsp); 00442 00443 EXTERNL int 00444 nc_inq_vardimid(int ncid, int varid, int *dimidsp); 00445 00446 EXTERNL int 00447 nc_inq_varnatts(int ncid, int varid, int *nattsp); 00448 00449 EXTERNL int 00450 nc_rename_var(int ncid, int varid, const char *name); 00451 00452 EXTERNL int 00453 nc_copy_var(int ncid_in, int varid, int ncid_out); 00454 #ifndef ncvarcpy 00455 /* support the old name for now */ 00456 #define ncvarcpy(ncid_in, varid, ncid_out) ncvarcopy((ncid_in), (varid), (ncid_out)) 00457 #endif 00458 00459 /* End _var */ 00460 /* Begin {put,get}_var1 */ 00461 00462 EXTERNL int 00463 nc_put_var1(int ncid, int varid, const size_t *indexp, const void *value); 00464 00465 EXTERNL int 00466 nc_get_var1(int ncid, int varid, const size_t *indexp, void *value); 00467 00468 EXTERNL int 00469 nc_put_var1_text(int ncid, int varid, const size_t *indexp, const char *op); 00470 00471 EXTERNL int 00472 nc_get_var1_text(int ncid, int varid, const size_t *indexp, char *ip); 00473 00474 EXTERNL int 00475 nc_put_var1_uchar(int ncid, int varid, const size_t *indexp, 00476 const unsigned char *op); 00477 00478 EXTERNL int 00479 nc_get_var1_uchar(int ncid, int varid, const size_t *indexp, 00480 unsigned char *ip); 00481 00482 EXTERNL int 00483 nc_put_var1_schar(int ncid, int varid, const size_t *indexp, 00484 const signed char *op); 00485 00486 EXTERNL int 00487 nc_get_var1_schar(int ncid, int varid, const size_t *indexp, 00488 signed char *ip); 00489 00490 EXTERNL int 00491 nc_put_var1_short(int ncid, int varid, const size_t *indexp, 00492 const short *op); 00493 00494 EXTERNL int 00495 nc_get_var1_short(int ncid, int varid, const size_t *indexp, 00496 short *ip); 00497 00498 EXTERNL int 00499 nc_put_var1_int(int ncid, int varid, const size_t *indexp, const int *op); 00500 00501 EXTERNL int 00502 nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip); 00503 00504 EXTERNL int 00505 nc_put_var1_long(int ncid, int varid, const size_t *indexp, const long *op); 00506 00507 EXTERNL int 00508 nc_get_var1_long(int ncid, int varid, const size_t *indexp, long *ip); 00509 00510 EXTERNL int 00511 nc_put_var1_float(int ncid, int varid, const size_t *indexp, const float *op); 00512 00513 EXTERNL int 00514 nc_get_var1_float(int ncid, int varid, const size_t *indexp, float *ip); 00515 00516 EXTERNL int 00517 nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op); 00518 00519 EXTERNL int 00520 nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip); 00521 00522 /* End {put,get}_var1 */ 00523 /* Begin {put,get}_vara */ 00524 00525 EXTERNL int 00526 nc_put_vara(int ncid, int varid, 00527 const size_t *start, const size_t *count, const void *value); 00528 00529 EXTERNL int 00530 nc_get_vara(int ncid, int varid, 00531 const size_t *start, const size_t *count, void *value); 00532 00533 EXTERNL int 00534 nc_put_vara_text(int ncid, int varid, 00535 const size_t *startp, const size_t *countp, const char *op); 00536 00537 EXTERNL int 00538 nc_get_vara_text(int ncid, int varid, 00539 const size_t *startp, const size_t *countp, char *ip); 00540 00541 EXTERNL int 00542 nc_put_vara_uchar(int ncid, int varid, 00543 const size_t *startp, const size_t *countp, const unsigned char *op); 00544 00545 EXTERNL int 00546 nc_get_vara_uchar(int ncid, int varid, 00547 const size_t *startp, const size_t *countp, unsigned char *ip); 00548 00549 EXTERNL int 00550 nc_put_vara_schar(int ncid, int varid, 00551 const size_t *startp, const size_t *countp, const signed char *op); 00552 00553 EXTERNL int 00554 nc_get_vara_schar(int ncid, int varid, 00555 const size_t *startp, const size_t *countp, signed char *ip); 00556 00557 EXTERNL int 00558 nc_put_vara_short(int ncid, int varid, 00559 const size_t *startp, const size_t *countp, const short *op); 00560 00561 EXTERNL int 00562 nc_get_vara_short(int ncid, int varid, 00563 const size_t *startp, const size_t *countp, short *ip); 00564 00565 EXTERNL int 00566 nc_put_vara_int(int ncid, int varid, 00567 const size_t *startp, const size_t *countp, const int *op); 00568 00569 EXTERNL int 00570 nc_get_vara_int(int ncid, int varid, 00571 const size_t *startp, const size_t *countp, int *ip); 00572 00573 EXTERNL int 00574 nc_put_vara_long(int ncid, int varid, 00575 const size_t *startp, const size_t *countp, const long *op); 00576 00577 EXTERNL int 00578 nc_get_vara_long(int ncid, int varid, 00579 const size_t *startp, const size_t *countp, long *ip); 00580 00581 EXTERNL int 00582 nc_put_vara_float(int ncid, int varid, 00583 const size_t *startp, const size_t *countp, const float *op); 00584 00585 EXTERNL int 00586 nc_get_vara_float(int ncid, int varid, 00587 const size_t *startp, const size_t *countp, float *ip); 00588 00589 EXTERNL int 00590 nc_put_vara_double(int ncid, int varid, 00591 const size_t *startp, const size_t *countp, const double *op); 00592 00593 EXTERNL int 00594 nc_get_vara_double(int ncid, int varid, 00595 const size_t *startp, const size_t *countp, double *ip); 00596 00597 /* End {put,get}_vara */ 00598 /* Begin {put,get}_vars */ 00599 00600 EXTERNL int 00601 nc_put_vars(int ncid, int varid, 00602 const size_t *start, const size_t *count, const ptrdiff_t *stride, 00603 const void * value); 00604 00605 EXTERNL int 00606 nc_get_vars(int ncid, int varid, 00607 const size_t *start, const size_t *count, const ptrdiff_t *stride, 00608 void * value); 00609 00610 EXTERNL int 00611 nc_put_vars_text(int ncid, int varid, 00612 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00613 const char *op); 00614 00615 EXTERNL int 00616 nc_get_vars_text(int ncid, int varid, 00617 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00618 char *ip); 00619 00620 EXTERNL int 00621 nc_put_vars_uchar(int ncid, int varid, 00622 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00623 const unsigned char *op); 00624 00625 EXTERNL int 00626 nc_get_vars_uchar(int ncid, int varid, 00627 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00628 unsigned char *ip); 00629 00630 EXTERNL int 00631 nc_put_vars_schar(int ncid, int varid, 00632 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00633 const signed char *op); 00634 00635 EXTERNL int 00636 nc_get_vars_schar(int ncid, int varid, 00637 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00638 signed char *ip); 00639 00640 EXTERNL int 00641 nc_put_vars_short(int ncid, int varid, 00642 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00643 const short *op); 00644 00645 EXTERNL int 00646 nc_get_vars_short(int ncid, int varid, 00647 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00648 short *ip); 00649 00650 EXTERNL int 00651 nc_put_vars_int(int ncid, int varid, 00652 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00653 const int *op); 00654 00655 EXTERNL int 00656 nc_get_vars_int(int ncid, int varid, 00657 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00658 int *ip); 00659 00660 EXTERNL int 00661 nc_put_vars_long(int ncid, int varid, 00662 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00663 const long *op); 00664 00665 EXTERNL int 00666 nc_get_vars_long(int ncid, int varid, 00667 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00668 long *ip); 00669 00670 EXTERNL int 00671 nc_put_vars_float(int ncid, int varid, 00672 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00673 const float *op); 00674 00675 EXTERNL int 00676 nc_get_vars_float(int ncid, int varid, 00677 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00678 float *ip); 00679 00680 EXTERNL int 00681 nc_put_vars_double(int ncid, int varid, 00682 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00683 const double *op); 00684 00685 EXTERNL int 00686 nc_get_vars_double(int ncid, int varid, 00687 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00688 double *ip); 00689 00690 /* End {put,get}_vars */ 00691 /* Begin {put,get}_varm */ 00692 00693 EXTERNL int 00694 nc_put_varm(int ncid, int varid, const size_t *start, const size_t *count, 00695 const ptrdiff_t *stride, const ptrdiff_t *imapp, 00696 const void *value); 00697 00698 EXTERNL int 00699 nc_get_varm(int ncid, int varid, const size_t *start, const size_t *count, 00700 const ptrdiff_t *stride, const ptrdiff_t *imapp, void *value); 00701 00702 EXTERNL int 00703 nc_put_varm_text(int ncid, int varid, 00704 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00705 const ptrdiff_t *imapp, 00706 const char *op); 00707 00708 EXTERNL int 00709 nc_get_varm_text(int ncid, int varid, 00710 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00711 const ptrdiff_t *imapp, 00712 char *ip); 00713 00714 EXTERNL int 00715 nc_put_varm_uchar(int ncid, int varid, 00716 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00717 const ptrdiff_t *imapp, 00718 const unsigned char *op); 00719 00720 EXTERNL int 00721 nc_get_varm_uchar(int ncid, int varid, 00722 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00723 const ptrdiff_t *imapp, 00724 unsigned char *ip); 00725 00726 EXTERNL int 00727 nc_put_varm_schar(int ncid, int varid, 00728 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00729 const ptrdiff_t *imapp, 00730 const signed char *op); 00731 00732 EXTERNL int 00733 nc_get_varm_schar(int ncid, int varid, 00734 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00735 const ptrdiff_t *imapp, 00736 signed char *ip); 00737 00738 EXTERNL int 00739 nc_put_varm_short(int ncid, int varid, 00740 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00741 const ptrdiff_t *imapp, 00742 const short *op); 00743 00744 EXTERNL int 00745 nc_get_varm_short(int ncid, int varid, 00746 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00747 const ptrdiff_t *imapp, 00748 short *ip); 00749 00750 EXTERNL int 00751 nc_put_varm_int(int ncid, int varid, 00752 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00753 const ptrdiff_t *imapp, 00754 const int *op); 00755 00756 EXTERNL int 00757 nc_get_varm_int(int ncid, int varid, 00758 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00759 const ptrdiff_t *imapp, 00760 int *ip); 00761 00762 EXTERNL int 00763 nc_put_varm_long(int ncid, int varid, 00764 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00765 const ptrdiff_t *imapp, 00766 const long *op); 00767 00768 EXTERNL int 00769 nc_get_varm_long(int ncid, int varid, 00770 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00771 const ptrdiff_t *imapp, 00772 long *ip); 00773 00774 EXTERNL int 00775 nc_put_varm_float(int ncid, int varid, 00776 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00777 const ptrdiff_t *imapp, 00778 const float *op); 00779 00780 EXTERNL int 00781 nc_get_varm_float(int ncid, int varid, 00782 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00783 const ptrdiff_t *imapp, 00784 float *ip); 00785 00786 EXTERNL int 00787 nc_put_varm_double(int ncid, int varid, 00788 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00789 const ptrdiff_t *imapp, 00790 const double *op); 00791 00792 EXTERNL int 00793 nc_get_varm_double(int ncid, int varid, 00794 const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, 00795 const ptrdiff_t * imapp, 00796 double *ip); 00797 00798 /* End {put,get}_varm */ 00799 /* Begin {put,get}_var */ 00800 00801 EXTERNL int 00802 nc_put_var_text(int ncid, int varid, const char *op); 00803 00804 EXTERNL int 00805 nc_get_var_text(int ncid, int varid, char *ip); 00806 00807 EXTERNL int 00808 nc_put_var_uchar(int ncid, int varid, const unsigned char *op); 00809 00810 EXTERNL int 00811 nc_get_var_uchar(int ncid, int varid, unsigned char *ip); 00812 00813 EXTERNL int 00814 nc_put_var_schar(int ncid, int varid, const signed char *op); 00815 00816 EXTERNL int 00817 nc_get_var_schar(int ncid, int varid, signed char *ip); 00818 00819 EXTERNL int 00820 nc_put_var_short(int ncid, int varid, const short *op); 00821 00822 EXTERNL int 00823 nc_get_var_short(int ncid, int varid, short *ip); 00824 00825 EXTERNL int 00826 nc_put_var_int(int ncid, int varid, const int *op); 00827 00828 EXTERNL int 00829 nc_get_var_int(int ncid, int varid, int *ip); 00830 00831 EXTERNL int 00832 nc_put_var_long(int ncid, int varid, const long *op); 00833 00834 EXTERNL int 00835 nc_get_var_long(int ncid, int varid, long *ip); 00836 00837 EXTERNL int 00838 nc_put_var_float(int ncid, int varid, const float *op); 00839 00840 EXTERNL int 00841 nc_get_var_float(int ncid, int varid, float *ip); 00842 00843 EXTERNL int 00844 nc_put_var_double(int ncid, int varid, const double *op); 00845 00846 EXTERNL int 00847 nc_get_var_double(int ncid, int varid, double *ip); 00848 00849 #ifdef LOGGING 00850 00851 #ifdef DEBUG 00852 EXTERNL void 00853 nc_exit(void); 00854 #endif 00855 00856 EXTERNL void 00857 nc_set_log_level(int new_level); 00858 /* Use this to turn off logging by calling 00859 nc_log_level(NC_TURN_OFF_LOGGING) */ 00860 #define NC_TURN_OFF_LOGGING (-1) 00861 00862 #else /* not LOGGING */ 00863 00864 #define nc_set_log_level(e) 00865 00866 #endif 00867 00868 /* End {put,get}_var */ 00869 00870 /* #ifdef _CRAYMPP */ 00871 /* 00872 * Public interfaces to better support 00873 * CRAY multi-processor systems like T3E. 00874 * A tip of the hat to NERSC. 00875 */ 00876 /* 00877 * It turns out we need to declare and define 00878 * these public interfaces on all platforms 00879 * or things get ugly working out the 00880 * FORTRAN interface. On !_CRAYMPP platforms, 00881 * these functions work as advertised, but you 00882 * can only use "processor element" 0. 00883 */ 00884 00885 EXTERNL int 00886 nc__create_mp(const char *path, int cmode, size_t initialsz, int basepe, 00887 size_t *chunksizehintp, int *ncidp); 00888 00889 EXTERNL int 00890 nc__open_mp(const char *path, int mode, int basepe, 00891 size_t *chunksizehintp, int *ncidp); 00892 00893 EXTERNL int 00894 nc_delete(const char * path); 00895 00896 EXTERNL int 00897 nc_delete_mp(const char * path, int basepe); 00898 00899 EXTERNL int 00900 nc_set_base_pe(int ncid, int pe); 00901 00902 EXTERNL int 00903 nc_inq_base_pe(int ncid, int *pe); 00904 00905 /* #endif _CRAYMPP */ 00906 00907 /* Begin v2.4 backward compatiblity */ 00908 /* 00909 * defining NO_NETCDF_2 to the preprocessor 00910 * turns off backward compatiblity declarations. 00911 */ 00912 #ifndef NO_NETCDF_2 00913 00914 /* 00915 * Backward compatible aliases 00916 */ 00917 #define FILL_BYTE NC_FILL_BYTE 00918 #define FILL_CHAR NC_FILL_CHAR 00919 #define FILL_SHORT NC_FILL_SHORT 00920 #define FILL_LONG NC_FILL_INT 00921 #define FILL_FLOAT NC_FILL_FLOAT 00922 #define FILL_DOUBLE NC_FILL_DOUBLE 00923 00924 #define MAX_NC_DIMS NC_MAX_DIMS 00925 #define MAX_NC_ATTRS NC_MAX_ATTRS 00926 #define MAX_NC_VARS NC_MAX_VARS 00927 #define MAX_NC_NAME NC_MAX_NAME 00928 #define MAX_VAR_DIMS NC_MAX_VAR_DIMS 00929 00930 /* 00931 * If and when 64 integer types become ubiquitous, 00932 * we would like to use NC_LONG for that. 00933 * For now, define for backward compatibility. 00934 */ 00935 #define NC_LONG NC_INT 00936 00937 /* 00938 * Global error status 00939 */ 00940 EXTERNL int ncerr; 00941 00942 #define NC_ENTOOL NC_EMAXNAME /* Backward compatibility */ 00943 #define NC_EXDR (-32) /* */ 00944 #define NC_SYSERR (-31) 00945 00946 /* 00947 * Avoid use of this meaningless macro 00948 * Use sysconf(_SC_OPEN_MAX). 00949 */ 00950 #ifndef MAX_NC_OPEN 00951 #define MAX_NC_OPEN 32 00952 #endif 00953 00954 /* 00955 * Global options variable. 00956 * Used to determine behavior of error handler. 00957 */ 00958 #define NC_FATAL 1 00959 #define NC_VERBOSE 2 00960 00961 EXTERNL int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */ 00962 00963 EXTERNL void 00964 nc_advise(const char *cdf_routine_name, int err, const char *fmt,...); 00965 00966 /* 00967 * C data type corresponding to a netCDF NC_LONG argument, 00968 * a signed 32 bit object. 00969 * 00970 * This is the only thing in this file which architecture dependent. 00971 */ 00972 typedef int nclong; 00973 00974 EXTERNL int 00975 nctypelen(nc_type datatype); 00976 00977 EXTERNL int 00978 nccreate(const char* path, int cmode); 00979 00980 EXTERNL int 00981 ncopen(const char* path, int mode); 00982 00983 EXTERNL int 00984 ncsetfill(int ncid, int fillmode); 00985 00986 EXTERNL int 00987 ncredef(int ncid); 00988 00989 EXTERNL int 00990 ncendef(int ncid); 00991 00992 EXTERNL int 00993 ncsync(int ncid); 00994 00995 EXTERNL int 00996 ncabort(int ncid); 00997 00998 EXTERNL int 00999 ncclose(int ncid); 01000 01001 EXTERNL int 01002 ncinquire(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimp); 01003 01004 EXTERNL int 01005 ncdimdef(int ncid, const char *name, long len); 01006 01007 EXTERNL int 01008 ncdimid(int ncid, const char *name); 01009 01010 EXTERNL int 01011 ncdiminq(int ncid, int dimid, char *name, long *lenp); 01012 01013 EXTERNL int 01014 ncdimrename(int ncid, int dimid, const char *name); 01015 01016 EXTERNL int 01017 ncattput(int ncid, int varid, const char *name, nc_type xtype, 01018 int len, const void *op); 01019 01020 EXTERNL int 01021 ncattinq(int ncid, int varid, const char *name, nc_type *xtypep, int *lenp); 01022 01023 EXTERNL int 01024 ncattget(int ncid, int varid, const char *name, void *ip); 01025 01026 EXTERNL int 01027 ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out, 01028 int varid_out); 01029 01030 EXTERNL int 01031 ncattname(int ncid, int varid, int attnum, char *name); 01032 01033 EXTERNL int 01034 ncattrename(int ncid, int varid, const char *name, const char *newname); 01035 01036 EXTERNL int 01037 ncattdel(int ncid, int varid, const char *name); 01038 01039 EXTERNL int 01040 ncvardef(int ncid, const char *name, nc_type xtype, 01041 int ndims, const int *dimidsp); 01042 01043 EXTERNL int 01044 ncvarid(int ncid, const char *name); 01045 01046 EXTERNL int 01047 ncvarinq(int ncid, int varid, char *name, nc_type *xtypep, 01048 int *ndimsp, int *dimidsp, int *nattsp); 01049 01050 EXTERNL int 01051 ncvarput1(int ncid, int varid, const long *indexp, const void *op); 01052 01053 EXTERNL int 01054 ncvarget1(int ncid, int varid, const long *indexp, void *ip); 01055 01056 EXTERNL int 01057 ncvarput(int ncid, int varid, const long *startp, const long *countp, 01058 const void *op); 01059 01060 EXTERNL int 01061 ncvarget(int ncid, int varid, const long *startp, const long *countp, 01062 void *ip); 01063 01064 EXTERNL int 01065 ncvarputs(int ncid, int varid, const long *startp, const long *countp, 01066 const long *stridep, const void *op); 01067 01068 EXTERNL int 01069 ncvargets(int ncid, int varid, const long *startp, const long *countp, 01070 const long *stridep, void *ip); 01071 01072 EXTERNL int 01073 ncvarputg(int ncid, int varid, const long *startp, const long *countp, 01074 const long *stridep, const long *imapp, const void *op); 01075 01076 EXTERNL int 01077 ncvargetg(int ncid, int varid, const long *startp, const long *countp, 01078 const long *stridep, const long *imapp, void *ip); 01079 01080 EXTERNL int 01081 ncvarrename(int ncid, int varid, const char *name); 01082 01083 EXTERNL int 01084 ncrecinq(int ncid, int *nrecvarsp, int *recvaridsp, long *recsizesp); 01085 01086 EXTERNL int 01087 ncrecget(int ncid, long recnum, void **datap); 01088 01089 EXTERNL int 01090 ncrecput(int ncid, long recnum, void *const *datap); 01091 01092 /* End v2.4 backward compatiblity */ 01093 #endif 01095 #if defined(__cplusplus) 01096 } 01097 #endif 01098 01099 #endif /* _NETCDF_ */
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: