netcdf.h 57 KB

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