1NETCDF(3) UNIDATA LIBRARY FUNCTIONS NETCDF(3)
2
3
4
6 netcdf - Unidata Network Common Data Form (netCDF) library, version 3
7 interface
8
10 include netcdf.inc
11
12
13 Most Systems:
14 f77 ... -lnetcdf
15
16
17 CRAY PVP Systems:
18 f90 -dp -i64 ... -lnetcdf
19
20
22 This document describes version 3 of Unidata netCDF data-access inter‐
23 face for the FORTRAN programming language.
24
25 character*80 nf_inq_libvers(void)
26
27 Returns a string identifying the version of the netCDF library,
28 and when it was built, like: "3.1a of Aug 22 1996 12:57:47 $".
29
30 The RCS ident(1) command will find a string like "$Id: @(#) netcdf li‐
31 brary version 3.1a of Sep 6 1996 15:56:26 $" in the library. The SCCS
32 what(1) command will find a string like "netcdf library version 3.1a of
33 Aug 23 1996 16:07:40 $".
34
36 All netCDF functions (except nf_inq_libvers() and nf_strerror()) return
37 an integer status. This behavior replaces the rcode argument used in
38 previous versions of the library. If this returned status value is not
39 equal to NF_NOERR (zero), it indicates that an error occurred. The pos‐
40 sible status values are defined in netcdf.inc.
41
42 character*80 nf_strerror(integer status)
43
44 Returns a string textual translation of the status value, like
45 "Attribute or variable name contains illegal characters" or "No
46 such file or directory".
47
48 integer function nf_create(character*(*) path, integer cmode, integer
49 ncid)
50
51 (Corresponds to nccre() in version 2)
52
53 Creates a new netCDF dataset at path, returning a netCDF ID in
54 ncid. The argument cmode may include the bitwise-or of the fol‐
55 lowing flags: NF_NOCLOBBER to protect existing datasets (default
56 silently blows them away), NF_SHARE for synchronous dataset up‐
57 dates (default is to buffer accesses), and NF_LOCK (not yet im‐
58 plemented). When a netCDF dataset is created, is is opened
59 NF_WRITE. The new netCDF dataset is in define mode.
60 NF_64BIT_OFFSET. to create a file in the 64-bit offset (as op‐
61 posed to classic , the default). 64-bit offset allows the cre‐
62 ation of very large files with far fewer restrictions than
63 netCDF classic , but can only be read by the netCDF library ver‐
64 sion 3.6 or greater. Users are cautioned that files that use the
65 64-bit offset will not be recognized by netCDF applications
66 linked to an earlier version of the netCDF library than 3.6.
67 Applications linked to version 3.6 or later will be able to
68 transparently access either the classic or 64-bit offset .
69
70 integer function nf__create(character*(*) path, integer cmode, integer
71 initialsize, integer chunksize, integer ncid)
72
73 Like nf_create() but has additional performance tuning parame‐
74 ters.
75
76 The argument initialsize sets the initial size of the file at
77 creation time.
78
79 See nf__open() below for an explanation of the chunksize parame‐
80 ter.
81
82 integer function nf_open(character*(*) path, integer mode, integer
83 ncid)
84
85 (Corresponds to ncopn() in version 2)
86
87 Opens a existing netCDF dataset at path returning a netCDF ID in
88 ncid. The type of access is described by the mode parameter,
89 which may include the bitwise-or of the following flags:
90 NF_WRITE for read-write access (default read-only), NF_SHARE for
91 synchronous dataset updates (default is to buffer accesses), and
92 NF_LOCK (not yet implemented).
93
94 integer function nf__open(character*(*) path, integer mode, integer
95 chunksize, integer ncid)
96
97 Like nf_open() but has an additional performance tuning parame‐
98 ter.
99
100 The argument referenced by chunksize controls a space versus
101 time tradeoff, memory allocated in the netcdf library versus
102 number of system calls. Because of internal requirements, the
103 value may not be set to exactly the value requested. The actual
104 value chosen is returned by reference. Using the value NF_SIZE‐
105 HINT_DEFAULT causes the library to choose a default. How the
106 system choses the default depends on the system. On many sys‐
107 tems, the "preferred I/O block size" is available from the
108 stat() system call, struct stat member st_blksize. If this is
109 available it is used. Lacking that, twice the system pagesize is
110 used. Lacking a call to discover the system pagesize, we just
111 set default chunksize to 8192.
112
113 The chunksize is a property of a given open netcdf descriptor
114 ncid, it is not a persistent property of the netcdf dataset.
115
116 integer function nf_redef(integer ncid)
117
118 (Corresponds to ncredf() in version 2)
119
120 Puts an open netCDF dataset into define mode, so dimensions,
121 variables, and attributes can be added or renamed and attributes
122 can be deleted.
123
124 integer function nf_enddef(integer ncid)
125
126 (Corresponds to ncendf() in version 2)
127
128 Takes an open netCDF dataset out of define mode. The changes
129 made to the netCDF dataset while it was in define mode are
130 checked and committed to disk if no problems occurred. Some da‐
131 ta values may be written as well, see "VARIABLE PREFILLING" be‐
132 low. After a successful call, variable data can be read or
133 written to the dataset.
134
135 integer function nf__enddef(integer ncid, integer h_minfree, integer
136 v_align, integer v_minfree, integer r_align)
137
138 Like nf_enddef() but has additional performance tuning parame‐
139 ters.
140
141 Caution: this function exposes internals of the netcdf version 1
142 file format. It may not be available on future netcdf implemen‐
143 tations.
144
145 The current netcdf file format has three sections, the "header"
146 section, the data section for fixed size variables, and the data
147 section for variables which have an unlimited dimension (record
148 variables). The header begins at the beginning of the file. The
149 index (offset) of the beginning of the other two sections is
150 contained in the header. Typically, there is no space between
151 the sections. This causes copying overhead to accrue if one
152 wishes to change the size of the sections, as may happen when
153 changing names of things, text attribute values, adding at‐
154 tributes or adding variables. Also, for buffered i/o, there may
155 be advantages to aligning sections in certain ways.
156
157 The minfree parameters allow one to control costs of future
158 calls to nf_redef(), nf_enddef() by requesting that minfree
159 bytes be available at the end of the section. The h_minfree pa‐
160 rameter sets the pad at the end of the "header" section. The
161 v_minfree parameter sets the pad at the end of the data section
162 for fixed size variables.
163
164 The align parameters allow one to set the alignment of the be‐
165 ginning of the corresponding sections. The beginning of the sec‐
166 tion is rounded up to an index which is a multiple of the align
167 parameter. The flag value NF_ALIGN_CHUNK tells the library to
168 use the chunksize (see above) as the align parameter. The
169 v_align parameter controls the alignment of the beginning of the
170 data section for fixed size variables. The r_align parameter
171 controls the alignment of the beginning of the data section for
172 variables which have an unlimited dimension (record variables).
173
174 The file format requires mod 4 alignment, so the align parame‐
175 ters are silently rounded up to multiples of 4. The usual call,
176 nf_enddef(ncid) is equivalent to nf__enddef(ncid, 0, 4, 0, 4).
177
178 The file format does not contain a "record size" value, this is
179 calculated from the sizes of the record variables. This unfortu‐
180 nate fact prevents us from providing minfree and alignment con‐
181 trol of the "records" in a netcdf file. If you add a variable
182 which has an unlimited dimension, the third section will always
183 be copied with the new variable added.
184
185 integer function nf_sync(integer ncid)
186
187 (Corresponds to ncsnc() in version 2)
188
189 Unless the NF_SHARE bit is set in nf_open() or nf_create(), ac‐
190 cesses to the underlying netCDF dataset are buffered by the li‐
191 brary. This function synchronizes the state of the underlying
192 dataset and the library. This is done automatically by
193 nf_close() and nf_enddef().
194
195 integer function nf_abort(integer ncid)
196
197 (Corresponds to ncabor() in version 2)
198
199 You don't need to call this function. This function is called
200 automatically by nf_close() if the netCDF was in define mode and
201 something goes wrong with the commit. If the netCDF dataset
202 isn't in define mode, then this function is equivalent to
203 nf_close(). If it is called after nf_redef(), but before
204 nf_enddef(), the new definitions are not committed and the
205 dataset is closed. If it is called after nf_create() but before
206 nf_enddef(), the dataset disappears.
207
208 integer function nf_close(integer ncid)
209
210 (Corresponds to ncclos() in version 2)
211
212 Closes an open netCDF dataset. If the dataset is in define
213 mode, nf_enddef() will be called before closing. After a
214 dataset is closed, its ID may be reassigned to another dataset.
215
216 integer function nf_inq(integer ncid, integer ndims, integer nvars, in‐
217 teger natts, integer unlimdimid)
218
219 integer function nf_inq_ndims(integer ncid, integer ndims)
220
221 integer function nf_inq_nvars(integer ncid, integer nvars)
222
223 integer function nf_inq_natts(integer ncid, integer natts)
224
225 integer function nf_inq_unlimdim(integer ncid, integer unlimdimid)
226
227 integer function nf_inq_format(integer ncid, integer formatn)
228
229 (Replace ncinq() in version 2)
230
231 Use these functions to find out what is in a netCDF dataset.
232 Upon successful return, ndims will contain the number of dimen‐
233 sions defined for this netCDF dataset, nvars will contain the
234 number of variables, natts will contain the number of at‐
235 tributes, and unlimdimid will contain the dimension ID of the
236 unlimited dimension if one exists, or 0 otherwise. formatn will
237 contain the version number of the dataset <>, one of NF_FOR‐
238 MAT_CLASSIC, NF_FORMAT_64BIT, NF_FORMAT_NETCDF4, or NF_FOR‐
239 MAT_NETCDF4_CLASSIC.
240
241
242 integer function nf_def_dim(integer ncid, character*(*) name, integer
243 len, integer dimid)
244
245 (Corresponds to ncddef() in version 2)
246
247 Adds a new dimension to an open netCDF dataset, which must be in
248 define mode. name is the dimension name. dimid will contain
249 the dimension ID of the newly created dimension.
250
251 integer function nf_inq_dimid(integer ncid, character*(*) name, integer
252 dimid)
253
254 (Corresponds to ncdid() in version 2)
255
256 Given a dimension name, returns the ID of a netCDF dimension in
257 dimid.
258
259 integer function nf_inq_dim(integer ncid, integer dimid, character*(*)
260 name, integer len)
261
262 integer function nf_inq_dimname(integer ncid, integer dimid, charac‐
263 ter*(*) name)
264
265 integer function nf_inq_dimlen(integer ncid, integer dimid, integer
266 len)
267
268 (Replace ncdinq() in version 2)
269
270 Use these functions to find out about a dimension.
271
272 name should be big enough (NF_MAX_NAME) to hold the dimension
273 name as the name will be copied into your storage. The length
274 return parameter, len will contain the size of the dimension.
275 For the unlimited dimension, the returned length is the current
276 maximum value used for writing into any of the variables which
277 use the dimension.
278
279 integer function nf_rename_dim(integer ncid, integer dimid, charac‐
280 ter*(*) name)
281
282 (Corresponds to ncdren() in version 2)
283
284 Renames an existing dimension in an open netCDF dataset. If the
285 new name is longer than the old name, the netCDF dataset must be
286 in define mode. You cannot rename a dimension to have the same
287 name as another dimension.
288
289 integer function nf_def_var(integer ncid, character*(*) name, integer
290 xtype, integer ndims, integer dimids[1m(1), integer varid)
291
292 (Corresponds to ncvdef() in version 2)
293
294 Adds a new variable to a netCDF dataset. The netCDF must be in
295 define mode. varid will be set to the netCDF variable ID.
296
297 integer function nf_inq_varid(integer ncid, character*(*) name, integer
298 varid)
299
300 (Corresponds to ncvid() in version 2)
301
302 Returns the ID of a netCDF variable in varid given its name.
303
304 integer function nf_inq_var(integer ncid, integer varid, character*(*)
305 name, integer xtype, integer ndims, integer dimids[1m(1), integer
306 natts)
307
308 integer function nf_inq_varname(integer ncid, integer varid, charac‐
309 ter*(*) name)
310
311 integer function nf_inq_vartype(integer ncid, integer varid, integer
312 xtype)
313
314 integer function nf_inq_varndims(integer ncid, integer varid, integer
315 ndims)
316
317 integer function nf_inq_vardimid(integer ncid, integer varid, integer
318 dimids[1m(1))
319
320 integer function nf_inq_varnatts(integer ncid, integer varid, integer
321 natts)
322
323 (Replace ncvinq() in version 2)
324
325 Returns information about a netCDF variable, given its ID.
326
327
328 integer function nf_rename_var(integer ncid, integer varid, charac‐
329 ter*(*) name)
330
331 (Corresponds to ncvren() in version 2)
332
333 Changes the name of a netCDF variable. If the new name is
334 longer than the old name, the netCDF must be in define mode.
335 You cannot rename a variable to have the name of any existing
336 variable.
337
338 integer function nf_put_var_text(integer ncid, integer varid, charac‐
339 ter*(*) out)
340
341
342 integer function nf_put_var_int1(integer ncid, integer varid, integer*1
343 out[1m(1))
344
345 integer function nf_put_var_int2(integer ncid, integer varid, integer*2
346 out[1m(1))
347
348 integer function nf_put_var_int(integer ncid, integer varid, integer
349 out[1m(1))
350
351
352 integer function nf_put_var_real(integer ncid, integer varid, real
353 out[1m(1))
354
355 integer function nf_put_var_double(integer ncid, integer varid, double‐
356 precision out[1m(1))
357
358 (Replace ncvpt() in version 2)
359
360 Writes an entire netCDF variable (i.e. all the values). The
361 netCDF dataset must be open and in data mode. The type of the
362 data is specified in the function name, and it is converted to
363 the external type of the specified variable, if possible, other‐
364 wise an NF_ERANGE error is returned. Note that rounding is not
365 performed during the conversion. Floating point numbers are
366 truncated when converted to integers.
367
368 integer function nf_get_var_text(integer ncid, integer varid, charac‐
369 ter*(*) in)
370
371
372 integer function nf_get_var_int1(integer ncid, integer varid, integer*1
373 in[1m(1))
374
375 integer function nf_get_var_int2(integer ncid, integer varid, integer*2
376 in[1m(1))
377
378 integer function nf_get_var_int(integer ncid, integer varid, integer
379 in[1m(1))
380
381
382 integer function nf_get_var_real(integer ncid, integer varid, real
383 in[1m(1))
384
385 integer function nf_get_var_double(integer ncid, integer varid, double‐
386 precision in[1m(1))
387
388 (Replace ncvgt() in version 2)
389
390 Reads an entire netCDF variable (i.e. all the values). The
391 netCDF dataset must be open and in data mode. The data is con‐
392 verted from the external type of the specified variable, if nec‐
393 essary, to the type specified in the function name. If conver‐
394 sion is not possible, an NF_ERANGE error is returned.
395
396 integer function nf_put_var1_text(integer ncid, integer varid, integer
397 index[1m(1), character*1 *out)
398
399
400 integer function nf_put_var1_int1(integer ncid, integer varid, integer
401 index[1m(1), integer*1 *out)
402
403 integer function nf_put_var1_int2(integer ncid, integer varid, integer
404 index[1m(1), integer*2 *out)
405
406 integer function nf_put_var1_int(integer ncid, integer varid, integer
407 index[1m(1), integer *out)
408
409
410 integer function nf_put_var1_real(integer ncid, integer varid, integer
411 index[1m(1), real *out)
412
413 integer function nf_put_var1_double(integer ncid, integer varid, inte‐
414 ger index[1m(1), doubleprecision *out)
415
416 (Replace ncvpt1() in version 2)
417
418 Puts a single data value into a variable at the position index
419 of an open netCDF dataset that is in data mode. The type of the
420 data is specified in the function name, and it is converted to
421 the external type of the specified variable, if possible, other‐
422 wise an NF_ERANGE error is returned.
423
424 integer function nf_get_var1_text(integer ncid, integer varid, integer
425 index[1m(1), character*1 in)
426
427
428 integer function nf_get_var1_int1(integer ncid, integer varid, integer
429 index[1m(1), integer*1 in)
430
431 integer function nf_get_var1_int2(integer ncid, integer varid, integer
432 index[1m(1), integer*2 in)
433
434 integer function nf_get_var1_int(integer ncid, integer varid, integer
435 index[1m(1), integer in)
436
437
438 integer function nf_get_var1_real(integer ncid, integer varid, integer
439 index[1m(1), real in)
440
441 integer function nf_get_var1_double(integer ncid, integer varid, inte‐
442 ger index[1m(1), doubleprecision in)
443
444 (Replace ncvgt1() in version 2)
445
446 Gets a single data value from a variable at the position index
447 of an open netCDF dataset that is in data mode. The data is
448 converted from the external type of the specified variable, if
449 necessary, to the type specified in the function name. If con‐
450 version is not possible, an NF_ERANGE error is returned.
451
452 integer function nf_put_vara_text(integer ncid, integer varid, integer
453 start[1m(1), integer count[1m(1), character*(*) out)
454
455
456 integer function nf_put_vara_int1(integer ncid, integer varid, integer
457 start[1m(1), integer count[1m(1), integer*1 out[1m(1))
458
459 integer function nf_put_vara_int2(integer ncid, integer varid, integer
460 start[1m(1), integer count[1m(1), integer*2 out[1m(1))
461
462 integer function nf_put_vara_int(integer ncid, integer varid, integer
463 start[1m(1), integer count[1m(1), integer out[1m(1))
464
465
466 integer function nf_put_vara_real(integer ncid, integer varid, integer
467 start[1m(1), integer count[1m(1), real out[1m(1))
468
469 integer function nf_put_vara_double(integer ncid, integer varid, inte‐
470 ger start[1m(1), integer count[1m(1), doubleprecision out[1m(1))
471
472 (Replace ncvpt() in version 2)
473
474 Writes an array section of values into a netCDF variable of an
475 open netCDF dataset, which must be in data mode. The array sec‐
476 tion is specified by the start and count vectors, which give the
477 starting index and count of values along each dimension of the
478 specified variable. The type of the data is specified in the
479 function name and is converted to the external type of the spec‐
480 ified variable, if possible, otherwise an NF_ERANGE error is re‐
481 turned.
482
483 integer function nf_get_vara_text(integer ncid, integer varid, integer
484 start[1m(1), integer count[1m(1), character*(*) in)
485
486
487 integer function nf_get_vara_int1(integer ncid, integer varid, integer
488 start[1m(1), integer count[1m(1), integer*1 in[1m(1))
489
490 integer function nf_get_vara_int2(integer ncid, integer varid, integer
491 start[1m(1), integer count[1m(1), integer*2 in[1m(1))
492
493 integer function nf_get_vara_int(integer ncid, integer varid, integer
494 start[1m(1), integer count[1m(1), integer in[1m(1))
495
496
497 integer function nf_get_vara_real(integer ncid, integer varid, integer
498 start[1m(1), integer count[1m(1), real in[1m(1))
499
500 integer function nf_get_vara_double(integer ncid, integer varid, inte‐
501 ger start[1m(1), integer count[1m(1), doubleprecision in[1m(1))
502
503 (Corresponds to ncvgt() in version 2)
504
505 Reads an array section of values from a netCDF variable of an
506 open netCDF dataset, which must be in data mode. The array sec‐
507 tion is specified by the start and count vectors, which give the
508 starting index and count of values along each dimension of the
509 specified variable. The data is converted from the external
510 type of the specified variable, if necessary, to the type speci‐
511 fied in the function name. If conversion is not possible, an
512 NF_ERANGE error is returned.
513
514 integer function nf_put_vars_text(integer ncid, integer varid, integer
515 start[1m(1), integer count[1m(1), integer stride[1m(1), character*(*)
516 out)
517
518
519 integer function nf_put_vars_int1(integer ncid, integer varid, integer
520 start[1m(1), integer count[1m(1), integer stride[1m(1), integer*1 out[1m(1))
521
522 integer function nf_put_vars_int2(integer ncid, integer varid, integer
523 start[1m(1), integer count[1m(1), integer stride[1m(1), integer*2 out[1m(1))
524
525 integer function nf_put_vars_int(integer ncid, integer varid, integer
526 start[1m(1), integer count[1m(1), integer stride[1m(1), integer out[1m(1))
527
528
529 integer function nf_put_vars_real(integer ncid, integer varid, integer
530 start[1m(1), integer count[1m(1), integer stride[1m(1), real out[1m(1))
531
532 integer function nf_put_vars_double(integer ncid, integer varid, inte‐
533 ger start[1m(1), integer count[1m(1), integer stride[1m(1), doublepreci‐
534 sion out[1m(1))
535
536 (Corresponds to ncvptg() in version 2)
537
538 These functions are used for strided output, which is like the
539 array section output described above, except that the sampling
540 stride (the interval between accessed values) is specified for
541 each dimension. For an explanation of the sampling stride vec‐
542 tor, see COMMON ARGUMENTS DESCRIPTIONS below.
543
544 integer function nf_get_vars_text(integer ncid, integer varid, integer
545 start[1m(1), integer count[1m(1), integer stride[1m(1), character*(*) in)
546
547
548 integer function nf_get_vars_int1(integer ncid, integer varid, integer
549 start[1m(1), integer count[1m(1), integer stride[1m(1), integer*1 in[1m(1))
550
551 integer function nf_get_vars_int2(integer ncid, integer varid, integer
552 start[1m(1), integer count[1m(1), integer stride[1m(1), integer*2 in[1m(1))
553
554 integer function nf_get_vars_int(integer ncid, integer varid, integer
555 start[1m(1), integer count[1m(1), integer stride[1m(1), integer in[1m(1))
556
557
558 integer function nf_get_vars_real(integer ncid, integer varid, integer
559 start[1m(1), integer count[1m(1), integer stride[1m(1), real in[1m(1))
560
561 integer function nf_get_vars_double(integer ncid, integer varid, inte‐
562 ger start[1m(1), integer count[1m(1), integer stride[1m(1), doublepreci‐
563 sion in[1m(1))
564
565 (Corresponds to ncvgtg() in version 2)
566
567 These functions are used for strided input, which is like the
568 array section input described above, except that the sampling
569 stride (the interval between accessed values) is specified for
570 each dimension. For an explanation of the sampling stride vec‐
571 tor, see COMMON ARGUMENTS DESCRIPTIONS below.
572
573 integer function nf_put_varm_text(integer ncid, integer varid, integer
574 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, charac‐
575 ter*(*) out)
576
577
578 integer function nf_put_varm_int1(integer ncid, integer varid, integer
579 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer*1
580 out[1m(1))
581
582 integer function nf_put_varm_int2(integer ncid, integer varid, integer
583 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer*2
584 out[1m(1))
585
586 integer function nf_put_varm_int(integer ncid, integer varid, integer
587 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer
588 out[1m(1))
589
590
591 integer function nf_put_varm_real(integer ncid, integer varid, integer
592 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, real
593 out[1m(1))
594
595 integer function nf_put_varm_double(integer ncid, integer varid, inte‐
596 ger start[1m(1), integer count[1m(1), integer stride[1m(1), imap, double‐
597 precision out[1m(1))
598
599 (Corresponds to ncvptg() in version 2)
600
601 These functions are used for mapped output, which is like strid‐
602 ed output described above, except that an additional index map‐
603 ping vector is provided to specify the in-memory arrangement of
604 the data values. For an explanation of the index mapping vec‐
605 tor, see COMMON ARGUMENTS DESCRIPTIONS below.
606
607 integer function nf_get_varm_text(integer ncid, integer varid, integer
608 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, charac‐
609 ter*(*) in)
610
611
612 integer function nf_get_varm_int1(integer ncid, integer varid, integer
613 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer*1
614 in[1m(1))
615
616 integer function nf_get_varm_int2(integer ncid, integer varid, integer
617 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer*2
618 in[1m(1))
619
620 integer function nf_get_varm_int(integer ncid, integer varid, integer
621 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, integer
622 in[1m(1))
623
624
625 integer function nf_get_varm_real(integer ncid, integer varid, integer
626 start[1m(1), integer count[1m(1), integer stride[1m(1), imap, real in[1m(1))
627
628 integer function nf_get_varm_double(integer ncid, integer varid, inte‐
629 ger start[1m(1), integer count[1m(1), integer stride[1m(1), imap, double‐
630 precision in[1m(1))
631
632 (Corresponds to ncvgtg() in version 2)
633
634 These functions are used for mapped input, which is like strided
635 input described above, except that an additional index mapping
636 vector is provided to specify the in-memory arrangement of the
637 data values. For an explanation of the index mapping vector,
638 see COMMON ARGUMENTS DESCRIPTIONS below.
639
640 integer function nf_put_att_text(integer ncid, integer varid, charac‐
641 ter*(*) name, integer xtype, integer len, character*(*) out)
642
643
644 integer function nf_put_att_int1(integer ncid, integer varid, charac‐
645 ter*(*) name, integer xtype, integer len, integer*1 out[1m(1))
646
647 integer function nf_put_att_int2(integer ncid, integer varid, charac‐
648 ter*(*) name, integer xtype, integer len, integer*2 out[1m(1))
649
650 integer function nf_put_att_int(integer ncid, integer varid, charac‐
651 ter*(*) name, integer xtype, integer len, integer out[1m(1))
652
653
654 integer function nf_put_att_real(integer ncid, integer varid, charac‐
655 ter*(*) name, integer xtype, integer len, real out[1m(1))
656
657 integer function nf_put_att_double(integer ncid, integer varid, charac‐
658 ter*(*) name, integer xtype, integer len, doubleprecision
659 out[1m(1))
660
661 (Replace ncapt() in version 2)
662
663 Unlike variables, attributes do not have separate functions for
664 defining and writing values. This family of functions defines a
665 new attribute with a value or changes the value of an existing
666 attribute. If the attribute is new, or if the space required to
667 store the attribute value is greater than before, the netCDF
668 dataset must be in define mode. The parameter len is the number
669 of values from out to transfer. It is often one, except that
670 for nf_put_att_text() it will usually be len_trim(out).
671
672 For these functions, the type component of the function name
673 refers to the in-memory type of the value, whereas the xtype ar‐
674 gument refers to the external type for storing the value. An
675 NF_ERANGE error results if a conversion between these types is
676 not possible. In this case the value is represented with the
677 appropriate fill-value for the associated external type.
678
679 integer function nf_inq_attname(integer ncid, integer varid, integer
680 attnum, character*(*) name)
681
682 (Corresponds to ncanam() in version 2)
683
684 Gets the name of an attribute, given its variable ID and at‐
685 tribute number. This function is useful in generic applications
686 that need to get the names of all the attributes associated with
687 a variable, since attributes are accessed by name rather than
688 number in all other attribute functions. The number of an at‐
689 tribute is more volatile than the name, since it can change when
690 other attributes of the same variable are deleted. The at‐
691 tributes for each variable are numbered from 1 (the first at‐
692 tribute) to nvatts, where nvatts is the number of attributes for
693 the variable, as returned from a call to nf_inq_varnatts().
694
695
696 integer function nf_inq_att(integer ncid, integer varid, character*(*)
697 name, integer xtype, integer len)
698
699 integer function nf_inq_attid(integer ncid, integer varid, charac‐
700 ter*(*) name, integer attnum)
701
702 integer function nf_inq_atttype(integer ncid, integer varid, charac‐
703 ter*(*) name, integer xtype)
704
705 integer function nf_inq_attlen(integer ncid, integer varid, charac‐
706 ter*(*) name, integer len)
707
708 (Corresponds to ncainq() in version 2)
709
710 These functions return information about a netCDF attribute,
711 given its variable ID and name. The information returned is the
712 external type in xtype and the number of elements in the at‐
713 tribute as len.
714
715
716 integer function nf_copy_att(integer ncid, integer varid_in, charac‐
717 ter*(*) name, integer ncid_out, integer varid_out)
718
719 (Corresponds to ncacpy() in version 2)
720
721 Copies an attribute from one netCDF dataset to another. It can
722 also be used to copy an attribute from one variable to another
723 within the same netCDF. ncid_in is the netCDF ID of an input
724 netCDF dataset from which the attribute will be copied.
725 varid_in is the ID of the variable in the input netCDF dataset
726 from which the attribute will be copied, or NF_GLOBAL for a
727 global attribute. name is the name of the attribute in the in‐
728 put netCDF dataset to be copied. ncid_out is the netCDF ID of
729 the output netCDF dataset to which the attribute will be copied.
730 It is permissible for the input and output netCDF ID's to be the
731 same. The output netCDF dataset should be in define mode if the
732 attribute to be copied does not already exist for the target
733 variable, or if it would cause an existing target attribute to
734 grow. varid_out is the ID of the variable in the output netCDF
735 dataset to which the attribute will be copied, or NF_GLOBAL to
736 copy to a global attribute.
737
738 integer function nf_rename_att(integer ncid, integer varid, charac‐
739 ter*(*) name, character*(*) newname)
740
741 (Corresponds to ncaren()
742
743 Changes the name of an attribute. If the new name is longer
744 than the original name, the netCDF must be in define mode. You
745 cannot rename an attribute to have the same name as another at‐
746 tribute of the same variable. name is the original attribute
747 name. newname is the new name to be assigned to the specified
748 attribute. If the new name is longer than the old name, the
749 netCDF dataset must be in define mode.
750
751 integer function nf_del_att(integer ncid, integer varid, character*(*)
752 name)
753
754 (Corresponds to ncadel() in version 2)
755
756 Deletes an attribute from a netCDF dataset. The dataset must be
757 in define mode.
758
759 integer function nf_get_att_text(integer ncid, integer varid, charac‐
760 ter*(*) name, character*(*) in)
761
762
763 integer function nf_get_att_int1(integer ncid, integer varid, charac‐
764 ter*(*) name, integer*1 in[1m(1))
765
766 integer function nf_get_att_int2(integer ncid, integer varid, charac‐
767 ter*(*) name, integer*2 in[1m(1))
768
769 integer function nf_get_att_int(integer ncid, integer varid, charac‐
770 ter*(*) name, integer in[1m(1))
771
772
773 integer function nf_get_att_real(integer ncid, integer varid, charac‐
774 ter*(*) name, real in[1m(1))
775
776 integer function nf_get_att_double(integer ncid, integer varid, charac‐
777 ter*(*) name, doubleprecision in[1m(1))
778
779 (Replace ncagt() in version 2)
780
781 Gets the value(s) of a netCDF attribute, given its variable ID
782 and name. Converts from the external type to the type specified
783 in the function name, if possible, otherwise returns an
784 NF_ERANGE error. All elements of the vector of attribute values
785 are returned, so you must allocate enough space to hold them.
786 If you don't know how much space to reserve, call nf_inq_at‐
787 tlen() first to find out the length of the attribute.
788
790 In this section we define some common arguments which are used in the
791 "FUNCTION DESCRIPTIONS" section.
792
793 integer ncid
794 is the netCDF ID returned from a previous, successful call to
795 nf_open() or nf_create()
796
797 character*(*) name
798 is the name of a dimension, variable, or attribute. The names of
799 dimensions, variables and attributes consist of arbitrary se‐
800 quences of alphanumeric characters (as well as underscore '_',
801 period '.' and hyphen '-'), beginning with a letter or under‐
802 score. (However names commencing with underscore are reserved
803 for system use.) Case is significant in netCDF names. A zero-
804 length name is not allowed.
805
806 The maximum allowable number of characters
807 is NF_MAX_NAME.
808
809 integer xtype
810 specifies the external data type of a netCDF variable or at‐
811 tribute and is one of the following: NF_BYTE, NF_CHAR, NF_SHORT,
812 NF_INT, NF_FLOAT, or NF_DOUBLE. These are used to specify 8-bit
813 integers, characters, 16-bit integers, 32-bit integers, 32-bit
814 IEEE floating point numbers, and 64-bit IEEE floating-point num‐
815 bers, respectively.
816
817
818 integer dimids(1)
819 is a vector of dimension ID's and defines the shape of a netCDF
820 variable. The size of the vector shall be greater than or equal
821 to the rank (i.e. the number of dimensions) of the variable
822 (ndims). The vector shall be ordered by the speed with which a
823 dimension varies: dimids(1) shall be the dimension ID of the
824 most rapidly varying dimension and dimids(ndims) shall be the
825 dimension ID of the most slowly varying dimension. The maximum
826 possible number of dimensions for a variable is given by the
827 symbolic constant NF_MAX_VAR_DIMS.
828
829 integer dimid
830 is the ID of a netCDF dimension. netCDF dimension ID's are al‐
831 located sequentially from the positive integers beginning with
832 1.
833
834 integer ndims
835 is either the total number of dimensions in a netCDF dataset or
836 the rank (i.e. the number of dimensions) of a netCDF variable.
837 The value shall not be negative or greater than the symbolic
838 constant NF_MAX_VAR_DIMS.
839
840 integer varid
841 is the ID of a netCDF variable or (for the attribute-access
842 functions) the symbolic constant NF_GLOBAL, which is used to
843 reference global attributes. netCDF variable ID's are allocated
844 sequentially from the positive integers beginning with 1.
845
846 integer natts
847 is the number of global attributes in a netCDF dataset for the
848 nf_inquire() function or the number of attributes associated
849 with a netCDF variable for the nf_varinq() function.
850
851 integer index(1)
852 specifies the indicial coordinates of the netCDF data value to
853 be accessed. The indices start at 1; thus, for example, the
854 first data value of a two-dimensional variable is (1,1). The
855 size of the vector shall be at least the rank of the associated
856 netCDF variable and its elements shall correspond, in order, to
857 the variable's dimensions.
858
859 integer start(1)
860 specifies the starting point for accessing a netCDF variable's
861 data values in terms of the indicial coordinates of the corner
862 of the array section. The indices start at 1; thus, the first
863 data value of a variable is (1, 1, ..., 1). The size of the
864 vector shall be at least the rank of the associated netCDF vari‐
865 able and its elements shall correspond, in order, to the vari‐
866 able's dimensions.
867
868 integer count(1)
869 specifies the number of indices selected along each dimension of
870 the array section. Thus, to access a single value, for example,
871 specify count as (1, 1, ..., 1). Note that, for strided I/O,
872 this argument must be adjusted to be compatible with the stride
873 and start arguments so that the interaction of the three does
874 not attempt to access an invalid data co-ordinate. The elements
875 of the count vector correspond, in order, to the variable's di‐
876 mensions.
877
878 integer stride(1)
879 specifies the sampling interval along each dimension of the
880 netCDF variable. The elements of the stride vector correspond,
881 in order, to the netCDF variable's dimensions (stride(1)) gives
882 the sampling interval along the most rapidly varying dimension
883 of the netCDF variable). Sampling intervals are specified in
884 type-independent units of elements (a value of 1 selects consec‐
885 utive elements of the netCDF variable along the corresponding
886 dimension, a value of 2 selects every other element, etc.).
887
888
889 imap specifies the mapping between the dimensions of a netCDF vari‐
890 able and the in-memory structure of the internal data array.
891 The elements of the index mapping vector correspond, in order,
892 to the netCDF variable's dimensions (imap(1) gives the distance
893 between elements of the internal array corresponding to the most
894 rapidly varying dimension of the netCDF variable). Distances
895 between elements are specified in type-independent units of ele‐
896 ments (the distance between internal elements that occupy adja‐
897 cent memory locations is 1 and not the element's byte-length as
898 in netCDF 2).
899
900
902 By default, the netCDF interface sets the values of all newly-defined
903 variables of finite length (i.e. those that do not have an unlimited,
904 dimension) to the type-dependent fill-value associated with each vari‐
905 able. This is done when nf_enddef() is called. The fill-value for a
906 variable may be changed from the default value by defining the at‐
907 tribute `_FillValue' for the variable. This attribute must have the
908 same type as the variable and be of length one.
909
910 Variables with an unlimited dimension are also prefilled, but on an `as
911 needed' basis. For example, if the first write of such a variable is
912 to position 5, then positions 1 through 4 (and no others) would be set
913 to the fill-value at the same time.
914
915 This default prefilling of data values may be disabled by or'ing the
916 NF_NOFILL flag into the mode parameter of nf_open() or nf_create(), or,
917 by calling the function nf_set_fill() with the argument NF_NOFILL. For
918 variables that do not use the unlimited dimension, this call must be
919 made before nf_enddef(). For variables that use the unlimited dimen‐
920 sion, this call may be made at any time.
921
922 One can obtain increased performance of the netCDF interface by using
923 this feature, but only at the expense of requiring the application to
924 set every single data value. The performance enhancing behavior of
925 this function is dependent on the particulars of the implementation and
926 dataset format. The flag value controlled by nf_set_fill() is per
927 netCDF ID, not per variable or per write. Allowing this to change af‐
928 fects the degree to which a program can be effectively parallelized.
929 Given all of this, we state that the use of this feature may not be
930 available (or even needed) in future releases. Programmers are cau‐
931 tioned against heavy reliance upon this feature.
932
933 integer function nf_setfill(integer ncid, integer fillmode, integer
934 old_fillemode)
935
936
937 Determines whether or not variable prefilling will be done (see
938 above). The netCDF dataset shall be writable. fillmode is ei‐
939 ther NF_FILL to enable prefilling (the default) or NF_NOFILL to
940 disable prefilling. This function returns the previous setting
941 in old_fillmode.
942
944 Additional functions for use on SGI/Cray MPP machines (_CRAYMPP).
945 These are used to set and inquire which PE is the base for MPP for a
946 particular netCDF. These are only relevant when using the SGI/Cray
947 ``global'' Flexible File I/O layer and desire to have only a subset of
948 PEs to open the specific netCDF file. For technical reasons, these
949 functions are available on all platforms. On a platform other than
950 SGI/Cray MPP, it is as if only processor available were processor 0.
951
952 To use this feature, you need to specify a communicator group and call
953 glio_group_mpi() or glio_group_shmem() prior to the netCDF nf_open()
954 and nf_create() calls.
955
956 integer function nf__create_mp(character*(*) path, integer cmode, inte‐
957 ger initialsize, integer pe, integer chunksize, integer ncid)
958
959 Like nf__create() but allows the base PE to be set.
960
961 The argument pe sets the base PE at creation time. In the MPP
962 environment, nf__create() and nf_create() set the base PE to
963 processor zero by default.
964
965 integer function nf__open_mp(character*(*) path, integer mode, integer
966 pe, integer chunksize, integer ncid)
967
968 Like nf__open() but allows the base PE to be set. The argument
969 pe sets the base PE at creation time. In the MPP environment,
970 nf__open() and nf_open() set the base PE to processor zero by
971 default.
972
973 integer function nf_inq_base_pe(integer ncid, integer pe)
974
975 Inquires of the netCDF dataset which PE is being used as the
976 base for MPP use. This is safe to use at any time.
977
978 integer function nf_set_base_pe(integer ncid, integer pe)
979
980 Resets the base PE for the netCDF dataset. Only perform this
981 operation when the affected communicator group synchronizes be‐
982 fore and after the call. This operation is very risky and
983 should only be contemplated under only the most extreme cases.
984
986 NETCDF_FFIOSPEC
987 Specifies the Flexible File I/O buffers for netCDF I/O when execut‐
988 ing under the UNICOS operating system (the variable is ignored on
989 other operating systems). An appropriate specification can greatly
990 increase the efficiency of netCDF I/O -- to the extent that it can
991 actually surpass FORTRAN binary I/O. This environment variable has
992 been made a little more generalized, such that other FFIO option
993 specifications can now be added. The default specification is bu‐
994 fa:336:2, unless a current FFIO specification is in operation,
995 which will be honored. See UNICOS Flexible File I/O for more in‐
996 formation.
997
999 Both a mailing list and a digest are available for discussion of the
1000 netCDF interface and announcements about netCDF bugs, fixes, and en‐
1001 hancements. To begin or change your subscription to either the mail‐
1002 ing-list or the digest, send one of the following in the body (not the
1003 subject line) of an email message to "majordomo@unidata.ucar.edu". Use
1004 your email address in place of jdoe@host.inst.domain.
1005
1006 To subscribe to the netCDF mailing list:
1007 subscribe netcdfgroup jdoe@host.inst.domain
1008 To unsubscribe from the netCDF mailing list:
1009 unsubscribe netcdfgroup jdoe@host.inst.domain
1010 To subscribe to the netCDF digest:
1011 subscribe netcdfdigest jdoe@host.inst.domain
1012 To unsubscribe from the netCDF digest:
1013 unsubscribe netcdfdigest jdoe@host.inst.domain
1014 To retrieve the general introductory information for the mailing list:
1015 info netcdfgroup
1016 To get a synopsis of other majordomo commands:
1017 help
1018
1020 ncdump(1), ncgen(1), netcdf(3), netcdf_f77(3), netcdf_f90(3)).
1021
1022 netCDF User's Guide, published by the Unidata Program Center, Universi‐
1023 ty Corporation for Atmospheric Research, located in Boulder, Colorado.
1024
1025
1026
1027Printed: 2019-06-22 1997-04-18 NETCDF(3)