1#![allow(clippy::unreadable_literal)]
2#![allow(non_snake_case)]
3#![allow(clippy::excessive_precision)]
4
5use ::std::os::raw::c_int;
6
7use super::nc_type;
8
9pub const NC_NAT: nc_type = 0;
10pub const NC_BYTE: nc_type = 1;
11pub const NC_CHAR: nc_type = 2;
12pub const NC_SHORT: nc_type = 3;
13pub const NC_INT: nc_type = 4;
14pub const NC_LONG: nc_type = 4;
15pub const NC_FLOAT: nc_type = 5;
16pub const NC_DOUBLE: nc_type = 6;
17pub const NC_UBYTE: nc_type = 7;
18pub const NC_USHORT: nc_type = 8;
19pub const NC_UINT: nc_type = 9;
20pub const NC_INT64: nc_type = 10;
21pub const NC_UINT64: nc_type = 11;
22pub const NC_STRING: nc_type = 12;
23
24pub const NC_MAX_ATOMIC_TYPE: nc_type = 12;
25
26pub const NC_VLEN: nc_type = 13;
27pub const NC_OPAQUE: nc_type = 14;
28pub const NC_ENUM: nc_type = 15;
29pub const NC_COMPOUND: nc_type = 16;
30
31pub const NC_FIRSTUSERTYPEID: nc_type = 32;
32
33pub const NC_FILL_BYTE: i8 = -127;
34pub const NC_FILL_CHAR: u8 = 0;
35pub const NC_FILL_SHORT: i16 = -32767;
36pub const NC_FILL_INT: i32 = -2147483647;
37pub const NC_FILL_FLOAT: f32 = 9.9692099683868690e+36;
38pub const NC_FILL_DOUBLE: f64 = 9.9692099683868690e+36;
39pub const NC_FILL_UBYTE: u8 = 255;
40pub const NC_FILL_USHORT: u16 = 65535;
41pub const NC_FILL_UINT: u32 = 4294967295;
42pub const NC_FILL_INT64: i64 = -9223372036854775806;
43pub const NC_FILL_UINT64: u64 = 18446744073709551614;
44pub const NC_FILL_STRING: &[u8] = b"\0";
45
46pub const NC_MAX_BYTE: i8 = 127;
47pub const NC_MIN_BYTE: i8 = -NC_MAX_BYTE - 1;
48pub const NC_MAX_CHAR: u8 = 255;
49pub const NC_MAX_SHORT: i16 = 32767;
50pub const NC_MIN_SHORT: i16 = -NC_MAX_SHORT - 1;
51pub const NC_MAX_INT: i32 = 2147483647;
52pub const NC_MIN_INT: i32 = -NC_MAX_INT - 1;
53pub const NC_MAX_FLOAT: f32 = 3.402823466e+38;
54pub const NC_MIN_FLOAT: f32 = -NC_MAX_FLOAT;
55pub const NC_MAX_DOUBLE: f64 = 1.7976931348623157e+308;
56pub const NC_MIN_DOUBLE: f64 = -NC_MAX_DOUBLE;
57pub const NC_MAX_UBYTE: u8 = 255;
58pub const NC_MAX_USHORT: u16 = 65535;
59pub const NC_MAX_UINT: u32 = 4294967295;
60pub const NC_MAX_INT64: i64 = 9223372036854775807;
61pub const NC_MIN_INT64: i64 = -9223372036854775808;
62pub const NC_MAX_UINT64: u64 = 18446744073709551615;
63
64pub const _FillValue: &[u8] = b"_FillValue\0";
65
66pub const NC_FILL: c_int = 0x000;
67pub const NC_NOFILL: c_int = 0x100;
68
69pub const NC_NOWRITE: c_int = 0x0000;
70pub const NC_WRITE: c_int = 0x0001;
71
72pub const NC_CLOBBER: c_int = 0x0000;
73pub const NC_NOCLOBBER: c_int = 0x0004;
74
75pub const NC_DISKLESS: c_int = 0x0008;
76pub const NC_MMAP: c_int = 0x0010;
77
78#[cfg(feature = "4.4.0")]
79pub const NC_64BIT_DATA: c_int = 0x0020;
80#[cfg(feature = "4.4.0")]
81pub const NC_CDF5: c_int = NC_64BIT_DATA;
82
83#[cfg(feature = "4.6.2")]
84pub const NC_UDF0: c_int = 0x0040;
85#[cfg(feature = "4.6.2")]
86pub const NC_UDF1: c_int = 0x0080;
87
88pub const NC_CLASSIC_MODEL: c_int = 0x0100;
89pub const NC_64BIT_OFFSET: c_int = 0x0200;
90
91pub const NC_LOCK: c_int = 0x0400;
92
93pub const NC_SHARE: c_int = 0x0800;
94
95pub const NC_NETCDF4: c_int = 0x1000;
96
97#[cfg_attr(
98 feature = "4.6.2",
99 deprecated(note = "Parallel I/O is initiated by calling nc_create_par and nc_open_par")
100)]
101pub const NC_MPIIO: c_int = 0x2000;
102#[cfg_attr(
103 feature = "4.6.2",
104 deprecated(note = "Parallel I/O is initiated by calling nc_create_par and nc_open_par"),
105 allow(deprecated)
106)]
107pub const NC_PNETCDF: c_int = NC_MPIIO;
108#[cfg_attr(
109 feature = "4.6.2",
110 deprecated(note = "Parallel I/O is initiated by calling nc_create_par and nc_open_par")
111)]
112pub const NC_MPIPOSIX: c_int = {
113 #[cfg(feature = "4.6.2")]
114 {
115 0x4000
116 }
117 #[cfg(not(feature = "4.6.2"))]
118 {
119 NC_MPIIO
120 }
121};
122
123#[cfg(feature = "4.6.2")]
124pub const NC_PERSIST: c_int = 0x4000;
125pub const NC_INMEMORY: c_int = 0x8000;
126
127#[cfg(feature = "4.9.0")]
128pub const NC_NOATTCREORD: c_int = 0x20000;
129#[cfg(feature = "4.9.0")]
130pub const NC_NODIMSCALE_ATTACH: c_int = 0x40000;
131
132#[cfg(feature = "4.6.2")]
133pub const NC_MAX_MAGIC_NUMBER_LEN: usize = 8;
134
135pub const NC_FORMAT_CLASSIC: c_int = 1;
136pub const NC_FORMAT_64BIT_OFFSET: c_int = 2;
137pub const NC_FORMAT_64BIT: c_int = NC_FORMAT_64BIT_OFFSET;
138pub const NC_FORMAT_NETCDF4: c_int = 3;
139pub const NC_FORMAT_NETCDF4_CLASSIC: c_int = 4;
140pub const NC_FORMAT_64BIT_DATA: c_int = 5;
141pub const NC_FORMAT_CDF5: c_int = NC_FORMAT_64BIT_DATA;
142
143#[cfg(feature = "4.7.0")]
144pub const NC_FORMAT_ALL: c_int =
145 NC_64BIT_OFFSET | NC_64BIT_DATA | NC_CLASSIC_MODEL | NC_NETCDF4 | NC_UDF0 | NC_UDF1;
146
147#[deprecated(note = "Use NC_FORMATX_NC3")]
148pub const NC_FORMAT_NC3: c_int = NC_FORMATX_NC3;
149#[deprecated(note = "Use NC_FORMATX_HDF5")]
150pub const NC_FORMAT_NC_HDF5: c_int = NC_FORMATX_NC_HDF5;
151#[deprecated(note = "Use NC_FORMATX_NC4")]
152pub const NC_FORMAT_NC4: c_int = NC_FORMATX_NC4;
153#[deprecated(note = "Use NC_FORMATX_HDF4")]
154pub const NC_FORMAT_NC_HDF4: c_int = NC_FORMATX_NC_HDF4;
155#[deprecated(note = "Use NC_FORMATX_PNETCDF")]
156pub const NC_FORMAT_PNETCDF: c_int = NC_FORMATX_PNETCDF;
157#[deprecated(note = "Use NC_FORMATX_DAP2")]
158pub const NC_FORMAT_DAP2: c_int = NC_FORMATX_DAP2;
159#[deprecated(note = "Use NC_FORMATX_DAP4")]
160pub const NC_FORMAT_DAP4: c_int = NC_FORMATX_DAP4;
161#[deprecated(note = "Use NC_FORMATX_UNDEFINED")]
162pub const NC_FORMAT_UNDEFINED: c_int = NC_FORMATX_UNDEFINED;
163
164pub const NC_FORMATX_NC3: c_int = 1;
165pub const NC_FORMATX_NC_HDF5: c_int = 2;
166pub const NC_FORMATX_NC4: c_int = NC_FORMATX_NC_HDF5;
167pub const NC_FORMATX_NC_HDF4: c_int = 3;
168pub const NC_FORMATX_PNETCDF: c_int = 4;
169pub const NC_FORMATX_DAP2: c_int = 5;
170pub const NC_FORMATX_DAP4: c_int = 6;
171#[cfg(feature = "4.6.2")]
172pub const NC_FORMATX_UDF0: c_int = 8;
173#[cfg(feature = "4.6.2")]
174pub const NC_FORMATX_UDF1: c_int = 9;
175#[cfg(feature = "4.7.0")]
176pub const NC_FORMATX_NCZARR: c_int = 10;
177pub const NC_FORMATX_UNDEFINED: c_int = 0;
178
179pub const NC_SIZEHINT_DEFAULT: c_int = 0;
180
181pub const NC_ALIGN_CHUNK: usize = !0;
182
183pub const NC_UNLIMITED: usize = 0;
184
185pub const NC_GLOBAL: c_int = -1;
186
187#[cfg_attr(feature = "4.5.0", deprecated(note = "Not enforced"))]
188pub const NC_MAX_DIMS: c_int = 1024;
189#[cfg_attr(feature = "4.5.0", deprecated(note = "Not enforced"))]
190pub const NC_MAX_ATTRS: c_int = 8192;
191#[cfg_attr(feature = "4.5.0", deprecated(note = "Not enforced"))]
192pub const NC_MAX_VARS: c_int = 8192;
193pub const NC_MAX_NAME: c_int = 256;
194pub const NC_MAX_VAR_DIMS: c_int = 1024;
195
196pub const NC_MAX_HDF4_NAME: c_int = NC_MAX_NAME;
197
198pub const NC_ENDIAN_NATIVE: c_int = 0;
199pub const NC_ENDIAN_LITTLE: c_int = 1;
200pub const NC_ENDIAN_BIG: c_int = 2;
201
202pub const NC_CHUNKED: c_int = 0;
203pub const NC_CONTIGUOUS: c_int = 1;
204#[cfg(feature = "4.7.4")]
205pub const NC_COMPACT: c_int = 2;
206#[cfg(feature = "4.8.1")]
207pub const NC_UNKNOWN_STORAGE: c_int = 3;
208#[cfg(feature = "4.8.1")]
209pub const NC_VIRTUAL: c_int = 4;
210
211pub const NC_NOCHECKSUM: c_int = 0;
212pub const NC_FLETCHER32: c_int = 1;
213
214pub const NC_NOSHUFFLE: c_int = 0;
215pub const NC_SHUFFLE: c_int = 1;
216
217#[cfg(feature = "4.6.0")]
218pub const NC_MIN_DEFLATE_LEVEL: c_int = 0;
219#[cfg(feature = "4.6.0")]
220pub const NC_MAX_DEFLATE_LEVEL: c_int = 9;
221
222pub const fn NC_ISSYSERR(err: c_int) -> bool {
223 err > 0
224}
225
226pub const NC_NOERR: c_int = 0;
227pub const NC2_ERR: c_int = -1;
228
229pub const NC_EBADID: c_int = -33;
230pub const NC_ENFILE: c_int = -34;
231pub const NC_EEXIST: c_int = -35;
232pub const NC_EINVAL: c_int = -36;
233pub const NC_EPERM: c_int = -37;
234pub const NC_ENOTINDEFINE: c_int = -38;
235pub const NC_EINDEFINE: c_int = -39;
236pub const NC_EINVALCOORDS: c_int = -40;
237pub const NC_EMAXDIMS: c_int = -41;
238pub const NC_ENAMEINUSE: c_int = -42;
239pub const NC_ENOTATT: c_int = -43;
240pub const NC_EMAXATTS: c_int = -44;
241pub const NC_EBADTYPE: c_int = -45;
242pub const NC_EBADDIM: c_int = -46;
243pub const NC_EUNLIMPOS: c_int = -47;
244pub const NC_EMAXVARS: c_int = -48;
245pub const NC_ENOTVAR: c_int = -49;
246pub const NC_EGLOBAL: c_int = -50;
247pub const NC_ENOTNC: c_int = -51;
248pub const NC_ESTS: c_int = -52;
249pub const NC_EMAXNAME: c_int = -53;
250pub const NC_EUNLIMIT: c_int = -54;
251pub const NC_ENORECVARS: c_int = -55;
252pub const NC_ECHAR: c_int = -56;
253pub const NC_EEDGE: c_int = -57;
254pub const NC_ESTRIDE: c_int = -58;
255pub const NC_EBADNAME: c_int = -59;
256pub const NC_ERANGE: c_int = -60;
257pub const NC_ENOMEM: c_int = -61;
258pub const NC_EVARSIZE: c_int = -62;
259pub const NC_EDIMSIZE: c_int = -63;
260pub const NC_ETRUNC: c_int = -64;
261pub const NC_EAXISTYPE: c_int = -65;
262pub const NC_EDAP: c_int = -66;
263pub const NC_ECURL: c_int = -67;
264pub const NC_EIO: c_int = -68;
265pub const NC_ENODATA: c_int = -69;
266pub const NC_EDAPSVC: c_int = -70;
267pub const NC_EDAS: c_int = -71;
268pub const NC_EDDS: c_int = -72;
269pub const NC_EDMR: c_int = NC_EDDS;
270pub const NC_EDATADDS: c_int = -73;
271pub const NC_EDATADAP: c_int = NC_EDATADDS;
272pub const NC_EDAPURL: c_int = -74;
273pub const NC_EDAPCONSTRAINT: c_int = -75;
274pub const NC_ETRANSLATION: c_int = -76;
275pub const NC_EACCESS: c_int = -77;
276pub const NC_EAUTH: c_int = -78;
277pub const NC_ENOTFOUND: c_int = -90;
278pub const NC_ECANTREMOVE: c_int = -91;
279#[cfg(feature = "4.6.1")]
280pub const NC_EINTERNAL: c_int = -92;
281#[cfg(feature = "4.6.2")]
282pub const NC_EPNETCDF: c_int = -93;
283pub const NC4_FIRST_ERROR: c_int = -100;
284pub const NC_EHDFERR: c_int = -101;
285pub const NC_ECANTREAD: c_int = -102;
286pub const NC_ECANTWRITE: c_int = -103;
287pub const NC_ECANTCREATE: c_int = -104;
288pub const NC_EFILEMETA: c_int = -105;
289pub const NC_EDIMMETA: c_int = -106;
290pub const NC_EATTMETA: c_int = -107;
291pub const NC_EVARMETA: c_int = -108;
292pub const NC_ENOCOMPOUND: c_int = -109;
293pub const NC_EATTEXISTS: c_int = -110;
294pub const NC_ENOTNC4: c_int = -111;
295pub const NC_ESTRICTNC3: c_int = -112;
296pub const NC_ENOTNC3: c_int = -113;
297pub const NC_ENOPAR: c_int = -114;
298pub const NC_EPARINIT: c_int = -115;
299pub const NC_EBADGRPID: c_int = -116;
300pub const NC_EBADTYPID: c_int = -117;
301pub const NC_ETYPDEFINED: c_int = -118;
302pub const NC_EBADFIELD: c_int = -119;
303pub const NC_EBADCLASS: c_int = -120;
304pub const NC_EMAPTYPE: c_int = -121;
305pub const NC_ELATEFILL: c_int = -122;
306pub const NC_ELATEDEF: c_int = -123;
307pub const NC_EDIMSCALE: c_int = -124;
308pub const NC_ENOGRP: c_int = -125;
309pub const NC_ESTORAGE: c_int = -126;
310pub const NC_EBADCHUNK: c_int = -127;
311pub const NC_ENOTBUILT: c_int = -128;
312pub const NC_EDISKLESS: c_int = -129;
313pub const NC_ECANTEXTEND: c_int = -130;
314pub const NC_EMPI: c_int = -131;
315#[cfg(feature = "4.6.0")]
316pub const NC_EFILTER: c_int = -132;
317#[cfg(feature = "4.6.0")]
318pub const NC_ERCFILE: c_int = -133;
319#[cfg(feature = "4.6.0")]
320pub const NC_NULLPAD: c_int = -134;
321#[cfg(feature = "4.6.2")]
322pub const NC_EINMEMORY: c_int = -135;
323#[cfg(feature = "4.7.4")]
324pub const NC_ENOFILTER: c_int = -136;
325#[cfg(feature = "4.8.0")]
326pub const NC_ENCZARR: c_int = -137;
327#[cfg(feature = "4.8.0")]
328pub const NC_ES3: c_int = -138;
329#[cfg(feature = "4.8.0")]
330pub const NC_EEMPTY: c_int = -139;
331#[cfg(all(feature = "4.8.0", not(feature = "4.8.1")))]
332pub const NC_EFOUND: c_int = -140;
333#[cfg(feature = "4.8.1")]
334pub const NC_EOBJECT: c_int = -140;
335#[cfg(feature = "4.8.1")]
336pub const NC_ENOOBJECT: c_int = -141;
337#[cfg(feature = "4.8.1")]
338pub const NC_EPLUGIN: c_int = -142;
339
340#[rustfmt::skip]
341pub const NC4_LAST_ERROR: c_int = {
342 #[cfg(not(feature = "4.6.0"))]
343 { -131 }
344 #[cfg(not(feature = "4.6.2"))]
345 { -135 }
346 #[cfg(all(feature = "4.6.2", not(feature = "4.7.4")))]
347 { -136 }
348 #[cfg(all(feature = "4.7.4", not(feature = "4.8.0")))]
349 { -137 }
350 #[cfg(all(feature = "4.8.0", not(feature = "4.8.1")))]
351 { -140 }
352 #[cfg(feature = "4.8.1")]
353 { -142 }
354};
355
356pub const NC_EURL: c_int = NC_EDAPURL;
357pub const NC_ECONSTRAINT: c_int = NC_EDAPCONSTRAINT;
358
359pub const DIM_WITHOUT_VARIABLE: &[u8] = b"This is a netCDF dimension but not a netCDF variable.\0";
360
361mod netcdf_2 {
362 use super::*;
363
364 pub const FILL_BYTE: i8 = NC_FILL_BYTE;
365 pub const FILL_CHAR: u8 = NC_FILL_CHAR;
366 pub const FILL_SHORT: i16 = NC_FILL_SHORT;
367 pub const FILL_LONG: i32 = NC_FILL_INT;
368 pub const FILL_FLOAT: f32 = NC_FILL_FLOAT;
369 pub const FILL_DOUBLE: f64 = NC_FILL_DOUBLE;
370
371 #[cfg_attr(
372 feature = "4.5.0",
373 deprecated(note = "Not enforced"),
374 allow(deprecated)
375 )]
376 pub const MAX_NC_DIMS: c_int = NC_MAX_DIMS;
377 #[cfg_attr(
378 feature = "4.5.0",
379 deprecated(note = "Not enforced"),
380 allow(deprecated)
381 )]
382 pub const MAX_NC_ATTRS: c_int = NC_MAX_ATTRS;
383 #[cfg_attr(
384 feature = "4.5.0",
385 deprecated(note = "Not enforced"),
386 allow(deprecated)
387 )]
388 pub const MAX_NC_VARS: c_int = NC_MAX_VARS;
389 pub const MAX_NC_NAME: c_int = NC_MAX_NAME;
390 pub const MAX_VAR_DIMS: c_int = NC_MAX_VAR_DIMS;
391
392 pub const NC_ENTOOL: c_int = NC_EMAXNAME;
393 pub const NC_EXDR: c_int = -32;
394 pub const NC_SYSERR: c_int = -31;
395
396 pub const NC_FATAL: c_int = 1;
397 pub const NC_VERBOSE: c_int = 2;
398}
399
400pub use netcdf_2::*;
401
402pub const NC_TURN_OFF_LOGGING: c_int = -1;