1  !
2  ! external netcdf data types:
3  !
4  integer, parameter, public :: &
5    nf90_byte   = 1,            &
6    nf90_int1   = nf90_byte,    &
7    nf90_char   = 2,            &
8    nf90_short  = 3,            &
9    nf90_int2   = nf90_short,   &
10    nf90_int    = 4,            &
11    nf90_int4   = nf90_int,     &
12    nf90_float  = 5,            &
13    nf90_real   = nf90_float,   &
14    nf90_real4  = nf90_float,   &
15    nf90_double = 6,            &
16    nf90_real8  = nf90_double
17
18  !
19  ! default fill values:
20  !
21  character (len = 1),           parameter, public :: &
22    nf90_fill_char  = achar(0)
23  integer (kind =  OneByteInt),  parameter, public :: &
24    nf90_fill_byte  = -127,                           &
25    nf90_fill_int1  = nf90_fill_byte
26  integer (kind =  TwoByteInt),  parameter, public :: &
27    nf90_fill_short = -32767,                         &
28    nf90_fill_int2  = nf90_fill_short
29  integer (kind = FourByteInt),  parameter, public :: &
30    nf90_fill_int   = -2147483647
31  real   (kind =  FourByteReal), parameter, public :: &
32    nf90_fill_float = 9.9692099683868690e+36,         &
33    nf90_fill_real  = nf90_fill_float,                &
34    nf90_fill_real4 = nf90_fill_float
35  real   (kind = EightByteReal), parameter, public :: &
36    nf90_fill_double = 9.9692099683868690e+36,        &
37    nf90_fill_real8  = nf90_fill_double
38
39  !
40  ! mode flags for opening and creating a netcdf dataset:
41  !
42  integer, parameter, public :: &
43    nf90_nowrite   = 0,         &
44    nf90_write     = 1,         &
45    nf90_clobber   = 0,         &
46    nf90_noclobber = 4,         &
47    nf90_fill      = 0,         &
48    nf90_nofill    = 256,       &
49    nf90_64bit_offset = 512,              &
50    nf90_64bit_data   = 32,               &
51    nf90_cdf5         = nf90_64bit_data,  &
52    nf90_lock      = 1024,      &
53    nf90_share     = 2048,      &
54    nf90_diskless  = 8,         &
55    nf90_mmap      = 16
56
57  integer, parameter, public ::  &
58    nf90_sizehint_default = 0,   &
59    nf90_align_chunk      = -1
60
61  !
62  ! size argument for defining an unlimited dimension:
63  !
64  integer, parameter, public :: nf90_unlimited = 0
65
66  !
67  ! global attribute id:
68  !
69  integer, parameter, public :: nf90_global = 0
70
71  !
72  ! implementation limits:
73  !
74  integer, parameter, public :: &
75    nf90_max_dims     = 1024,    &
76    nf90_max_attrs    = 8192,   &
77    nf90_max_vars     = 8192,   &
78    nf90_max_name     = 256,    &
79    nf90_max_var_dims = 1024
80
81  !
82  ! error codes:
83  !
84  integer, parameter, public :: &
85    nf90_noerr        = 0,      & ! No Error
86    nf90_ebadid       = -33,    & ! Not a valid ID
87    nf90_eexist       = -35,    & ! netcdf file exists && NF90_NOCLOBBER
88    nf90_einval       = -36,    & ! Invalid Argument
89    nf90_eperm        = -37,    & ! Write to read only
90    nf90_enotindefine = -38,    & ! Operation not allowed in data mode
91    nf90_eindefine    = -39,    & ! Operation not allowed in define mode
92    nf90_einvalcoords = -40,    & ! Index exceeds dimension bound
93    nf90_emaxdims     = -41,    & ! nf90_max_dims exceeded
94    nf90_enameinuse   = -42,    & ! String match to name in use
95    nf90_enotatt      = -43,    & ! Attribute not found
96    nf90_emaxatts     = -44,    & ! nf90_max_attrs exceeded
97    nf90_ebadtype     = -45,    & ! Not a netcdf data type
98    nf90_ebaddim      = -46,    & ! Invalid dimension id or name
99    nf90_eunlimpos    = -47,    & ! nf90_unlimited in the wrong index
100    nf90_emaxvars     = -48,    & ! nf90_max_vars exceeded
101    nf90_enotvar      = -49,    & ! The variable ID is invalid for the specified netCDF dataset.
102    nf90_eglobal      = -50,    & ! Action prohibited on nf90_global varid
103    nf90_enotnc       = -51,    & ! Not a netcdf file
104    nf90_ests         = -52,    & ! In Fortran, string too short
105    nf90_emaxname     = -53,    & ! nf90_max_name exceeded
106    nf90_eunlimit     = -54,    & ! nf90_unlimited size already in use
107    nf90_enorecvars   = -55,    & ! nc_rec op when there are no record vars
108    nf90_echar        = -56,    & ! Attempt to convert between text & numbers
109    nf90_eedge        = -57,    & ! Start+count exceeds dimension bound
110    nf90_estride      = -58,    & ! Illegal stride
111    nf90_ebadname     = -59,    & ! Attribute or variable name contains illegal characters
112    nf90_erange       = -60,    & ! Math result not representable
113    nf90_enomem       = -61,    & ! Memory allocation (malloc) failure
114    nf90_evarsize     = -62,    & ! One or more variable sizes violate format constraints
115    nf90_edimsize     = -63,    & ! Invalid dimension size
116    nf90_etrunc       = -64,    & ! File likely truncated or possibly corrupted
117    nf90_eaxistype    = -65       ! Unknown axis type.
118  !
119  ! more error codes for DAP
120  !
121  integer, parameter, public :: &
122    nf90_edap         = -66,    & ! Generic DAP error
123    nf90_ecurl        = -67,    & ! Generic libcurl error
124    nf90_eio          = -68,    & ! Generic IO error
125    nf90_enodata      = -69,    & ! Attempt to access variable with no data
126    nf90_edapsvc      = -70,    & ! DAP server error
127    nf90_edas         = -71,    & ! Malformed or inaccessible DAS
128    nf90_edds         = -72,    & ! Malformed or inaccessible DDS
129    nf90_edatadds     = -73,    & ! Malformed or inaccessible DATADDS
130    nf90_edapurl      = -74,    & ! Malformed DAP URL
131    nf90_edapconstraint = -75,  & ! Malformed DAP Constrain
132    nf90_etranslation = -76,    & ! Untranslatable construct
133    nf904_first_error = -100
134  !
135  ! error codes for netCDF-4
136  !
137integer, parameter, public :: &
138    nf90_ehdferr      = -101,    & ! Error at HDF5 layer.
139    nf90_ecantread    = -102,    & ! Can't read.
140    nf90_ecantwrite   = -103,    & ! Can't write.
141    nf90_ecantcreate  = -104,    & ! Can't create.
142    nf90_efilemeta    = -105,    & ! Problem with file metadata.
143    nf90_edimmeta     = -106,    & ! Problem with dimension metadata.
144    nf90_eattmeta     = -107,    & ! Problem with attribute metadata.
145    nf90_evarmeta     = -108,    & ! Problem with variable metadata.
146    nf90_enocompound  = -109,    & ! Not a compound type.
147    nf90_eattexists   = -110,    & ! Attribute already exists.
148    nf90_enotnc4      = -111,    & ! Attempting netcdf-4 operation on netcdf-3 file.
149    nf90_estrictnc3   = -112,    & ! Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
150    nf90_enotnc3      = -113,    & ! Attempting netcdf-3 operation on netcdf-4 file.
151    nf90_enopar       = -114,    & ! Parallel operation on file opened for non-parallel access.
152    nf90_eparinit     = -115,    & ! Error initializing for parallel access.
153    nf90_ebadgrpid    = -116,    & ! Bad group ID.
154    nf90_ebadtypid    = -117,    & ! Bad type ID.
155    nf90_etypdefined  = -118,    & ! Type has already been defined and may not be edited.
156    nf90_ebadfield    = -119,    & ! Bad field ID.
157    nf90_ebadclass    = -120,    & ! Bad class.
158    nf90_emaptype     = -121,    & ! Mapped access for atomic types only.
159    nf90_elatefill    = -122,    & ! Attempt to define fill value when data already exists.
160    nf90_elatedef     = -123,    & ! Attempt to define var properties, like deflate, after enddef.
161    nf90_edimscale    = -124,    & ! Probem with HDF5 dimscales.
162    nf90_enogrp       = -125,    & ! No group found.
163    nf90_estorage     = -126,    & ! Can't specify both contiguous and chunking.
164    nf90_ebadchunk    = -127,    & ! Bad chunksize.
165    nf90_enotbuilt    = -128,    & ! Attempt to use feature that was not turned on when netCDF was built.
166    nf90_ediskless    = -129,    & ! Error in using diskless  access.
167    nf90_ecantextend  = -130,    & ! Attempt to extend dataset during ind. I/O operation.
168    nf90_empi         = -131,    & ! MPI operation failed.
169    nf904_last_error  = -131
170
171  !
172  ! error handling modes:
173  !
174  integer, parameter, public :: &
175    nf90_fatal   = 1,           &
176    nf90_verbose = 2
177
178  !
179  ! format version numbers:
180  !
181  integer, parameter, public :: &
182    nf90_format_classic = 1,    &
183    nf90_format_64bit = 2,      &
184    nf90_format_64bit_offset = nf90_format_64bit, &
185    nf90_format_64bit_data = 5,                   &
186    nf90_format_cdf5 = nf90_format_64bit_data,    &
187    nf90_format_netcdf4 = 3,    &
188    nf90_format_netcdf4_classic = 4
189
190! extra data types:
191integer, parameter, public :: &
192     nf90_ubyte = 7, &
193     nf90_ushort = 8, &
194     nf90_uint = 9, &
195     nf90_int64 = 10, &
196     nf90_uint64 = 11, &
197     nf90_string = 12, &
198     nf90_vlen = 13, &
199     nf90_opaque = 14, &
200     nf90_enum = 15, &
201     nf90_compound = 16
202
203
204! extra default fill values:
205integer (kind =  TwoByteInt),  parameter, public :: &
206     nf90_fill_ubyte  = 255,                        &
207     nf90_fill_uint1  = nf90_fill_ubyte
208integer (kind =  FourByteInt),  parameter, public :: &
209     nf90_fill_ushort = 65535,                      &
210     nf90_fill_uint2  = nf90_fill_ushort
211integer (kind = EightByteInt),  parameter, public :: &
212     nf90_fill_uint   = 4294967295_EightByteInt
213
214! Extra file create mode flags.
215integer, parameter, public :: &
216     nf90_netcdf4 = 4096, &
217     nf90_hdf5 = 4096, & ! deprecated
218     nf90_classic_model = 256
219
220! Flags for parallel access.
221integer, parameter, public :: nf90_independent = 0, nf90_collective = 1
222
223! Flags for parallel I/O.
224integer, parameter, public :: nf90_mpiio = 8192, nf90_mpiposix = 16384, &
225     nf90_pnetcdf = 32768
226
227! Extra variable flags.
228integer, parameter, public :: &
229     nf90_chunk_seq = 0, &
230     nf90_chunk_sub = 1, &
231     nf90_chunk_sizes = 2, &
232     nf90_endian_native = 0, &
233     nf90_endian_little = 1, &
234     nf90_endian_big = 2, &
235     nf90_chunked = 0, &
236     nf90_notcontiguous = 0, &
237     nf90_contiguous = 1, &
238     nf90_compact = 2, &
239     nf90_nochecksum = 0, &
240     nf90_fletcher32 = 1, &
241     nf90_noshuffle = 0, &
242     nf90_shuffle = 1, &
243     nf90_szip_ec_option_mask = 4, &
244     nf90_szip_nn_option_mask = 32
245
246! This is the position of NC_NETCDF4 in cmode, counting from the
247! right, starting (uncharacteristically for fortran) at 0. It's needed
248! for the BTEST function calls.
249integer, parameter, private :: NETCDF4_BIT = 12
250