NetCDF-Fortran  4.4.4
nf_nc4.f90
Go to the documentation of this file.
1 ! netCDF 4 specific FORTRAN functions
2 
3 ! Replacement for fort-nc4.c
4 
5 ! Written by: Richard Weed, Ph.D.
6 ! Center for Advanced Vehicular Systems
7 ! Mississippi State University
8 ! rweed@cavs.msstate.edu
9 
10 
11 ! License (and other Lawyer Language)
12 
13 ! This software is released under the Apache 2.0 Open Source License. The
14 ! full text of the License can be viewed at :
15 !
16 ! http:www.apache.org/licenses/LICENSE-2.0.html
17 !
18 ! The author grants to the University Corporation for Atmospheric Research
19 ! (UCAR), Boulder, CO, USA the right to revise and extend the software
20 ! without restriction. However, the author retains all copyrights and
21 ! intellectual property rights explicitly stated in or implied by the
22 ! Apache license
23 
24 ! Version 1.- June 2006 - Based on netCDF 3.6.2 beta code and 4.0 alpha code
25 ! Version 2.- July 2007 - Based on netCDF 3.6.2 snapshot and 4.0 beta code
26 ! Version 3.- April 2009 - Based on NetCDF 4.0.1 release
27 ! Version 4.- April 2010 - Based on NetCDF 4.1.1 release
28 ! Version 5.- Aug. 2013 - Added nf_rename_grp to align with netCDF-C 4.3.1
29 ! Version 6.- Sep. 2013 - Changed fill routines to support different types
30 ! Version 7.- May 2014 - Ensure return error status checked from C API calls
31 ! Version 8.- Jan. 2016 - General code cleanup. Replaced automatic arrays
32 ! sized with NC_MAX_DIMS with allocatable arrays.
33 ! Changed name processing to reflect change in
34 ! addCNullChar
35 
36 !-------------------------------- nf_create_par -------------------------------
37  Function nf_create_par (path, cmode, comm, info, ncid) RESULT(status)
38 
39 ! create parallel file
40 
42 
43  Implicit NONE
44 
45  Integer, Intent(IN) :: cmode, comm, info
46  Character(LEN=*), Intent(IN) :: path
47  Integer, Intent(OUT) :: ncid
48 
49  Integer :: status
50 
51  Integer(C_INT) :: ccmode, ccomm, cinfo, cncid, cstatus
52  Character(LEN=(LEN(path)+1)) :: cpath
53  Integer :: ie
54 
55  ccmode = cmode
56  ccomm = comm
57  cinfo = info
58  cncid = 0
59  cpath = addcnullchar(path, ie) ! add a C Null char and strip trailing blanks
60 
61  cstatus = nc_create_par_fortran(cpath(1:ie), ccmode, ccomm, cinfo, cncid)
62 
63  If (cstatus == nc_noerr) Then
64  ncid = cncid
65  EndIf
66  status = cstatus
67 
68  End Function nf_create_par
69 !-------------------------------- nf_open_par --------------------------------
70  Function nf_open_par (path, mode, comm, info, ncid) RESULT(status)
71 
72 ! open a parallel file
73 
75 
76  Implicit NONE
77 
78  Integer, Intent(IN) :: mode, comm, info
79  Character(LEN=*), Intent(IN) :: path
80  Integer, Intent(OUT) :: ncid
81 
82  Integer :: status
83 
84  Integer(C_INT) :: cmode, ccomm, cinfo, cncid, cstatus
85  Character(LEN=(LEN(path)+1)) :: cpath
86  Integer :: ie
87 
88  cmode = mode
89  ccomm = comm
90  cinfo = info
91  cncid = 0
92  cpath = addcnullchar(path, ie)
93 
94  cstatus = nc_open_par_fortran(cpath(1:ie), cmode, ccomm, cinfo, cncid)
95 
96  If (cstatus == nc_noerr) Then
97  ncid = cncid
98  EndIf
99  status = cstatus
100 
101  End Function nf_open_par
102 !-------------------------------- nf_var_par_access -------------------------
103  Function nf_var_par_access( ncid, varid, iaccess) RESULT (status)
105 ! set parallel variable access
106 
108 
109  Implicit NONE
110 
111  Integer, Intent(IN) :: ncid, varid, iaccess
112 
113  Integer :: status
114 
115  Integer(C_INT) :: cncid, cvarid, caccess, cstatus
116 
117  cncid = ncid
118  cvarid = varid - 1
119  caccess = iaccess
120 
121  cstatus = nc_var_par_access(cncid, cvarid, caccess)
122 
123  status = cstatus
124 
125  End Function nf_var_par_access
126 !-------------------------------- nf_inq_ncid ---------------------------------
127  Function nf_inq_ncid(ncid, name, groupid) RESULT (status)
129 ! inquire ncid
130 
132 
133  Implicit NONE
134 
135  Integer, Intent(IN) :: ncid
136  Character(LEN=*), Intent(IN) :: name
137  Integer, Intent(OUT) :: groupid
138 
139  Integer :: status
140 
141  Integer(C_INT) :: cncid, cgroupid, cstatus
142  Character(LEN=LEN(name)+1) :: cname
143  Integer :: ie
144 
145  cncid = ncid
146  cgroupid = 0
147  cname = repeat(" ",len(cname))
148  cname = addcnullchar(name, ie)
149 
150  cstatus = nc_inq_ncid(cncid, cname(1:ie), cgroupid)
151 
152  If (cstatus == nc_noerr) Then
153  groupid = cgroupid
154  EndIf
155  status = cstatus
156 
157  End Function nf_inq_ncid
158 !-------------------------------- nf_inq_grps ---------------------------------
159  Function nf_inq_grps( ncid, numgrps, ncids) RESULT (status)
161 ! inquire number of grps and ncids
162 
164 
165  Implicit NONE
166 
167  Integer, Intent(IN) :: ncid
168  Integer, Intent(INOUT) :: ncids(*)
169  Integer, Intent(OUT) :: numgrps
170 
171  Integer :: status
172 
173  Integer(C_INT) :: cncid, cnumgrps, cstatus, cstatus1
174 
175  Integer(C_INT), ALLOCATABLE :: cncids(:)
176 
177  cncid = ncid
178  cnumgrps = 0
179  ncids(1) = 0
180  numgrps = 0
181 
182 ! Get cnumgrps first using utility from nc_lib.c which is not part
183 ! of netCDF C.
184 
185  cstatus1 = nc_inq_numgrps(cncid, cnumgrps)
186 
187  If (cnumgrps > 0) Then
188  ALLOCATE(cncids(cnumgrps))
189  Else
190  ALLOCATE(cncids(1))
191  EndIf
192 
193  cncids = 0
194 
195  cstatus = nc_inq_grps(cncid, cnumgrps, cncids)
196  If (cstatus == nc_noerr) Then
197  numgrps = cnumgrps
198  If (numgrps > 0) Then
199  ncids(1:numgrps) = cncids(1:numgrps)
200  EndIf
201  EndIf
202 
203  status = cstatus
204 
205  If (ALLOCATED(cncids)) DEALLOCATE (cncids)
206 
207  End Function nf_inq_grps
208 !-------------------------------- nf_inq_grpname ------------------------------
209  Function nf_inq_grpname( ncid, name) RESULT (status)
211 ! inquire group name
212 
214 
215  Implicit NONE
216 
217  Integer, Intent(IN) :: ncid
218  Character(LEN=*), Intent(OUT) :: name
219 
220  Integer :: status
221 
222  Integer(C_INT) :: cncid, cstatus
223  Character(LEN=NC_MAX_NAME) :: cname
224  Integer :: nlen
225 
226  cncid = ncid
227  nlen = len(name)
228  name = repeat(" ",len(name))
229  cname = repeat(" ",len(cname))
230 
231  cstatus = nc_inq_grpname(cncid, cname)
232 
233  If (cstatus == nc_noerr) Then
234  name = stripcnullchar(cname,nlen) ! Strip null char and trailing blanks
235  EndIf
236  status = cstatus
237 
238  End Function nf_inq_grpname
239 !-------------------------------- nf_inq_grpname_full -------------------------
240  Function nf_inq_grpname_full( ncid, nlen, name) RESULT (status)
242 ! inquire full group name and length
243 
245 
246  Implicit NONE
247 
248  Integer, Intent(IN) :: ncid
249  Character(LEN=*), Intent(OUT) :: name
250  Integer, Intent(OUT) :: nlen
251 
252  Integer :: status
253 
254  Integer(C_INT) :: cncid, cstatus
255  Integer(C_SIZE_T) :: clen
256  Character(LEN=LEN(name)+1) :: cname
257  Integer :: nl
258 
259  cncid = ncid
260  nl = len(name)
261  name = repeat(" ",len(name))
262  cname = repeat(" ",len(cname))
263 
264  cstatus = nc_inq_grpname_full(cncid, clen, cname)
265 
266  If (cstatus == nc_noerr) Then
267  nlen = clen
268  name = stripcnullchar(cname, nl)
269  EndIf
270  status = cstatus
271 
272  End Function nf_inq_grpname_full
273 !-------------------------------- nf_inq_grpname_len --------------------------
274  Function nf_inq_grpname_len( ncid, nlen) RESULT (status)
276 ! inquire length of full group name
277 
279 
280  Implicit NONE
281 
282  Integer, Intent(IN) :: ncid
283  Integer, Intent(OUT) :: nlen
284 
285  Integer :: status
286 
287  Integer(C_INT) :: cncid, cstatus
288  Integer(C_SIZE_T) :: clen
289 
290  cncid = ncid
291 
292  cstatus = nc_inq_grpname_len(cncid, clen)
293 
294  If (cstatus == nc_noerr) Then
295  ! Return name length
296  nlen = clen
297  EndIf
298  status = cstatus
299 
300  End Function nf_inq_grpname_len
301 !-------------------------------- nf_inq_grp_parent ---------------------------
302  Function nf_inq_grp_parent( ncid,parent_ncid) RESULT (status)
304 ! inquire group parent number
305 
307 
308  Implicit NONE
309 
310  Integer, Intent(IN) :: ncid
311  Integer, Intent(INOUT) :: parent_ncid
312 
313  Integer :: status
314 
315  Integer(C_INT) :: cncid, cparent_ncid, cstatus
316 
317  cncid = ncid
318 
319  cstatus = nc_inq_grp_parent(cncid, cparent_ncid)
320 
321  If (cstatus == nc_noerr) Then
322  parent_ncid = cparent_ncid
323  EndIf
324  status = cstatus
325 
326  End Function nf_inq_grp_parent
327 !-------------------------------- nf_inq_grp_ncid -----------------------------
328  Function nf_inq_grp_ncid( ncid, grp_name, parent_ncid) RESULT (status)
330 ! inquire parent_ncid given group name
331 
333 
334  Implicit NONE
335 
336  Integer, Intent(IN) :: ncid
337  Character(LEN=*), Intent(IN) :: grp_name
338  Integer, Intent(INOUT) :: parent_ncid
339 
340  Integer :: status
341 
342  Integer(C_INT) :: cncid, cstatus, cparent_ncid
343  Character(LEN=(LEN(grp_name)+1)) :: cgrp_name
344  Integer :: ie
345 
346  cgrp_name = repeat(" ",len(cgrp_name))
347  cgrp_name = addcnullchar(grp_name, ie)
348  cncid = ncid
349 
350  cstatus = nc_inq_grp_ncid(cncid, cgrp_name(1:ie), cparent_ncid)
351 
352  If (cstatus == nc_noerr) Then
353  parent_ncid = cparent_ncid
354  EndIf
355  status = cstatus
356 
357  End Function nf_inq_grp_ncid
358 !-------------------------------- nf_inq_grp_full_ncid ------------------------
359  Function nf_inq_grp_full_ncid( ncid, name, grp_ncid) RESULT (status)
361 ! inquire grp ncid given full group name
362 
364 
365  Implicit NONE
366 
367  Integer, Intent(IN) :: ncid
368  Character(LEN=*), Intent(INOUT) :: name
369  Integer, Intent(INOUT) :: grp_ncid
370 
371  Integer :: status
372 
373  Integer(C_INT) :: cncid, cstatus, cgrp_ncid
374  Character(LEN=(LEN(name)+1)) :: cgrp_name
375  Integer :: ie
376 
377  cncid = ncid
378  cgrp_name = repeat(" ",len(cgrp_name))
379  cgrp_name = addcnullchar(name, ie)
380 
381  cstatus = nc_inq_grp_full_ncid(cncid, cgrp_name(1:ie), cgrp_ncid)
382 
383  If (cstatus == nc_noerr) Then
384  grp_ncid = cgrp_ncid
385  EndIf
386  status = cstatus
387 
388  End Function nf_inq_grp_full_ncid
389 !-------------------------------- nf_inq_varids -------------------------------
390  Function nf_inq_varids( ncid, nvars, varids) RESULT (status)
392 ! inquire number of vars and varids
393 
395 
396  Implicit NONE
397 
398  Integer, Intent(IN) :: ncid
399  Integer, Intent(OUT) :: nvars
400  Integer, Intent(INOUT) :: varids(*)
401 
402  Integer :: status
403 
404  Integer(C_INT) :: cncid, cnvars, cstatus
405 
406  cncid = ncid
407  varids(1) = 0
408 
409  cstatus = nc_inq_varids_f(cncid, cnvars, varids)
410 
411  If (cstatus == nc_noerr) Then
412  nvars = cnvars
413  EndIf
414  status = cstatus
415 
416  End Function nf_inq_varids
417 !-------------------------------- nf_inq_dimids -------------------------------
418  Function nf_inq_dimids( ncid, ndims, dimids, parent) RESULT (status)
420 ! inquire number of dimids
421 
423 
424  Implicit NONE
425 
426  Integer, Intent(IN) :: ncid, parent
427  Integer, Intent(OUT) :: ndims
428  Integer, Intent(INOUT) :: dimids(*)
429 
430  Integer :: status
431 
432  Integer(C_INT) :: cncid, cndims, cparent, cstatus
433 
434  cncid = ncid
435  dimids(1) = 0
436 
437  cstatus = nc_inq_dimids_f(cncid, cndims, dimids, cparent)
438 
439  If (cstatus == nc_noerr) Then
440  ndims = cndims
441  EndIf
442  status = cstatus
443 
444  End Function nf_inq_dimids
445 !-------------------------------- nf_inq_typeids ------------------------------
446  Function nf_inq_typeids( ncid, ntypes, typeids) RESULT (status)
448 ! inquire number of types and typeids
449 
451 
452  Implicit NONE
453 
454  Integer, Intent(IN) :: ncid
455  Integer, Intent(OUT) :: ntypes
456  Integer, Intent(INOUT) :: typeids(*)
457 
458  Integer :: status
459 
460  Integer(C_INT) :: cncid, cntypes, cstatus, cstatus1
461 
462  Integer(C_INT), ALLOCATABLE :: ctypeids(:)
463 
464  cncid = ncid
465  typeids(1) = 0
466 
467  cstatus1 = 0
468  cstatus1 = nc_inq_numtypes(cncid, cntypes)
469 
470  If (cntypes > 0) Then
471  ALLOCATE(ctypeids(cntypes))
472  Else
473  ALLOCATE(ctypeids(1))
474  EndIf
475 
476  ctypeids = 0
477 
478  cstatus = nc_inq_typeids(cncid, cntypes, ctypeids)
479  If (cstatus == nc_noerr) Then
480  ntypes = cntypes
481  If (ntypes > 0) Then
482  typeids(1:ntypes) = ctypeids(1:ntypes)
483  EndIf
484  EndIf
485 
486  status = cstatus
487 
488  If(ALLOCATED(ctypeids)) DEALLOCATE(ctypeids)
489 
490  End Function nf_inq_typeids
491 !-------------------------------- nf_inq_typeid -------------------------------
492  Function nf_inq_typeid(ncid, name, typeid) RESULT (status)
494 ! inquire typeid for given name
495 
497 
498  Implicit NONE
499 
500  Integer, Intent(IN) :: ncid
501  Character(LEN=*), Intent(IN) :: name
502  Integer, Intent(OUT) :: typeid
503 
504  Integer :: status
505 
506  Integer(C_INT) :: cncid, ctypeid, cstatus
507  Character(LEN=LEN(name)+1) :: cname
508  Integer :: ie
509 
510  cncid = ncid
511  ctypeid = 0
512  cname = repeat(" ",len(cname))
513  cname = addcnullchar(name, ie)
514 
515  cstatus = nc_inq_typeid(cncid, cname(1:ie), ctypeid)
516 
517  If (cstatus == nc_noerr) Then
518  typeid = ctypeid
519  EndIf
520  status = cstatus
521 
522  End Function nf_inq_typeid
523 !-------------------------------- nf_def_grp ---------------------------------
524  Function nf_def_grp( parent_ncid, name, new_ncid) RESULT (status)
526 ! define new group given name
527 
529 
530  Implicit NONE
531 
532  Integer, Intent(IN) :: parent_ncid
533  Character(LEN=*), Intent(IN) :: name
534  Integer, Intent(OUT) :: new_ncid
535 
536  Integer :: status
537 
538  Integer(C_INT) :: cncid, cnew_ncid, cstatus
539  Character(LEN=(LEN(name)+1)) :: cname
540  Integer :: ie
541 
542  cncid = parent_ncid
543  cname = repeat(" ",len(cname))
544  cname = addcnullchar(name, ie)
545 
546  cstatus = nc_def_grp(cncid, cname(1:ie), cnew_ncid)
547 
548  If (cstatus == nc_noerr) Then
549  new_ncid = cnew_ncid
550  EndIf
551  status = cstatus
552 
553  End Function nf_def_grp
554 !-------------------------------- nf_rename_grp -------------------------------
555  Function nf_rename_grp( grpid, name) RESULT (status)
557 ! rename previously defined group
558 
560 
561  Implicit NONE
562 
563  Integer, Intent(IN) :: grpid
564  Character(LEN=*), Intent(IN) :: name
565 
566  Integer :: status
567 
568  Integer(C_INT) :: cgrpid, cstatus
569  Character(LEN=(LEN(name)+1)) :: cname
570  Integer :: ie
571 
572  cgrpid = grpid
573  cname = repeat(" ",len(cname))
574  cname = addcnullchar(name, ie)
575 
576  cstatus = nc_rename_grp(cgrpid, cname(1:ie))
577 
578  status = cstatus
579 
580  End Function nf_rename_grp
581 !-------------------------------- nf_def_compound -----------------------------
582  Function nf_def_compound( ncid, isize, name, typeid) RESULT (status)
584 ! define a compound variable given name and size
585 
587 
588  Implicit NONE
589 
590  Integer, Intent(IN) :: ncid, isize
591  Integer, Intent(OUT) :: typeid
592  Character(LEN=*), Intent(IN) :: name
593 
594  Integer :: status
595 
596  Integer(C_INT) :: cncid, ctypeid, cstatus
597  Integer(C_SIZE_T) :: csize
598  Character(LEN=(LEN(name)+1)) :: cname
599  Integer :: ie
600 
601  cncid = ncid
602  csize = isize
603  cname = repeat(" ",len(cname))
604  cname = addcnullchar(name, ie)
605 
606  cstatus = nc_def_compound(cncid, csize, cname(1:ie), ctypeid)
607 
608  If (cstatus == nc_noerr) Then
609  typeid = ctypeid
610  EndIf
611 
612  status = cstatus
613 
614  End Function nf_def_compound
615 !-------------------------------- nf_insert_compound --------------------------
616  Function nf_insert_compound( ncid, xtype, name, offset, field_typeid) &
617  result(status)
619 ! Insert compound name offset field_typeid etc
620 
622 
623  Implicit NONE
624 
625  Integer, Intent(IN) :: ncid, xtype, field_typeid, offset
626  Character(LEN=*), Intent(IN) :: name
627 
628  Integer :: status
629 
630  Integer(C_INT) :: cncid, cxtype, ctypeid, cstatus
631  Integer(C_SIZE_T) :: coffset
632  Character(LEN=(LEN(name)+1)) :: cname
633  Integer :: ie
634 
635  cncid = ncid
636  cxtype = xtype
637  ctypeid = field_typeid
638  coffset = offset
639  cname = repeat(" ",len(cname))
640  cname = addcnullchar(name, ie)
641 
642  cstatus = nc_insert_compound(cncid, cxtype, cname(1:ie), &
643  coffset, ctypeid)
644 
645  status = cstatus
646 
647  End Function nf_insert_compound
648 !-------------------------------- nf_insert_array_compound --------------------
649  Function nf_insert_array_compound( ncid, xtype, name, offset, field_typeid, &
650  ndims, dim_sizes) RESULT (status)
652 ! Insert name type fieldid and dim_sizes array into compound
653 
655 
656  Implicit NONE
657 
658  Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims
659  Character(LEN=*), Intent(IN) :: name
660  Integer, Intent(INOUT) :: dim_sizes(*)
661 
662  Integer :: status
663 
664  Integer(C_INT) :: cncid, cxtype, ctypeid, cndims, cstatus
665  Integer(C_SIZE_T) :: coffset
666  Character(LEN=(LEN(name)+1)) :: cname
667  Integer :: ie
668 
669  cncid = ncid
670  cxtype = xtype
671  ctypeid = field_typeid
672  coffset = offset
673  cndims = ndims
674  cname = repeat(" ",len(cname))
675  cname = addcnullchar(name, ie)
676 
677  cstatus = nc_insert_array_compound_f(cncid, cxtype, cname(1:ie), &
678  coffset, ctypeid, cndims, dim_sizes)
679 
680  status = cstatus
681 
682  End Function nf_insert_array_compound
683 !-------------------------------- nf_inq_type ---------------------------------
684  Function nf_inq_type( ncid, xtype, name, isize) RESULT (status)
686 ! Inquire type size for given name and type
687 
689 
690  Implicit NONE
691 
692  Integer, Intent(IN) :: ncid, xtype
693  Character(LEN=*), Intent(IN) :: name
694  Integer, Intent(OUT) :: isize
695 
696  Integer :: status
697 
698  Integer(C_INT) :: cncid, cxtype, cstatus
699  Integer(C_SIZE_T) :: csize
700  Character(LEN=(LEN(name)+1)) :: cname
701  Integer :: ie
702 
703  cncid = ncid
704  cxtype = xtype
705  cname = repeat(" ",len(cname))
706  cname = addcnullchar(name, ie)
707 
708  cstatus = nc_inq_type(cncid, cxtype, cname(1:ie), csize)
709 
710  If (cstatus == nc_noerr) Then
711  isize = csize
712  EndIf
713  status = cstatus
714 
715  End Function nf_inq_type
716 !-------------------------------- nf_inq_compound -----------------------------
717  Function nf_inq_compound( ncid, xtype, name, isize, nfields) RESULT (status)
719 ! return size and nfield for compound given ncid, xtype, and name
720 
722 
723  Implicit NONE
724 
725  Integer, Intent(IN) :: ncid, xtype
726  Character(LEN=*), Intent(INOUT) :: name
727  Integer, Intent(INOUT) :: isize, nfields
728 
729  Integer :: status
730 
731  Integer(C_INT) :: cncid, cxtype, cstatus
732  Integer(C_SIZE_T) :: csize, cnfieldsp
733  Character(LEN=NC_MAX_NAME+1) :: cname
734  Integer :: nlen
735 
736  cncid = ncid
737  cxtype = xtype
738  nlen = len(name)
739  name = repeat(" ", nlen)
740  cname = repeat(" ", len(cname))
741 
742  cstatus = nc_inq_compound(cncid, cxtype, cname, csize, cnfieldsp)
743 
744  If (cstatus == nc_noerr) Then
745  name = stripcnullchar(cname, nlen)
746  isize = csize
747  nfields = cnfieldsp
748  EndIf
749  status = cstatus
750 
751  End Function nf_inq_compound
752 !-------------------------------- nf_inq_compound_name ------------------------
753  Function nf_inq_compound_name( ncid, xtype, name) RESULT (status)
755 ! inquire compound name
756 
758 
759  Implicit NONE
760 
761  Integer, Intent(IN) :: ncid, xtype
762  Character(LEN=*), Intent(OUT) :: name
763 
764  Integer :: status
765 
766  Integer(C_INT) :: cncid, cxtype, cstatus
767  Character(LEN=NC_MAX_NAME+1) :: cname
768  Integer :: nlen
769 
770  cncid = ncid
771  cxtype = xtype
772  nlen = len(name)
773  name = repeat(" ",len(name))
774  cname = repeat(" ",len(cname))
775 
776  cstatus = nc_inq_compound_name(cncid, cxtype, cname)
777 
778  If (cstatus == nc_noerr) Then
779  name = stripcnullchar(cname, nlen)
780  EndIf
781  status = cstatus
782 
783  End Function nf_inq_compound_name
784 !-------------------------------- nf_inq_compound_size -------------------------
785  Function nf_inq_compound_size( ncid, xtype, isize) RESULT (status)
787 ! return size compound given ncid, xtype
788 
790 
791  Implicit NONE
792 
793  Integer, Intent(IN) :: ncid, xtype
794  Integer, Intent(INOUT) :: isize
795 
796  Integer :: status
797 
798  Integer(C_INT) :: cncid, cxtype, cstatus
799  Integer(C_SIZE_T) :: csize
800 
801  cncid = ncid
802  cxtype = xtype
803 
804  cstatus = nc_inq_compound_size(cncid, cxtype, csize)
805 
806  If (cstatus == nc_noerr) Then
807  isize = csize
808  EndIf
809 
810  status = cstatus
811 
812  End Function nf_inq_compound_size
813 !-------------------------------- nf_inq_compound_nfields ----------------------
814  Function nf_inq_compound_nfields( ncid, xtype, nfields) RESULT (status)
816 ! return number of fields for compound
817 
819 
820  Implicit NONE
821 
822  Integer, Intent(IN) :: ncid, xtype
823  Integer, Intent(INOUT) :: nfields
824 
825  Integer :: status
826 
827  Integer(C_INT) :: cncid, cxtype, cstatus
828  Integer(C_SIZE_T) :: cnfields
829 
830  cncid = ncid
831  cxtype = xtype
832 
833  cstatus = nc_inq_compound_nfields(cncid, cxtype, cnfields)
834 
835  If (cstatus == nc_noerr) Then
836  nfields = cnfields
837  EndIf
838 
839  status = cstatus
840 
841  End Function nf_inq_compound_nfields
842 !-------------------------------- nf_inq_compound_field -----------------------
843  Function nf_inq_compound_field( ncid, xtype, fieldid, name, offset, &
844  field_typeid, ndims, dim_sizes) RESULT (status)
846 ! inquire compound field info. Use Fortran specific version of C interface
847 
849 
850  Implicit NONE
851 
852  Integer, Intent(IN) :: ncid, xtype, fieldid
853  Character(LEN=*), Intent(OUT) :: name
854  Integer, Intent(OUT) :: offset, field_typeid, ndims
855  Integer, Intent(OUT) :: dim_sizes(*)
856 
857  Integer :: status
858 
859  Integer(C_INT) :: cncid, cxtype, cfieldid, cfield_typeid, &
860  cndims, cstatus, cstatus1
861  Integer(C_SIZE_T) :: coffset
862  Character(LEN=NC_MAX_NAME+1) :: cname
863  Integer :: nlen
864 
865  Integer(C_INT), ALLOCATABLE :: cdim_sizes(:)
866 
867  cncid = ncid
868  cxtype = xtype
869  cfieldid = fieldid-1
870  nlen = len(name)
871  name = repeat(" ",len(name))
872  cname = repeat(" ",len(cname))
873  dim_sizes(1) = 0
874 
875  cstatus1 = nc_inq_compound_field_ndims(cncid, cxtype, cfieldid, cndims)
876 
877  If (cndims > 0) Then
878  ALLOCATE(cdim_sizes(cndims))
879  Else
880  ALLOCATE(cdim_sizes(1))
881  EndIf
882 
883  cdim_sizes = 0
884 
885  cstatus = nc_inq_compound_field_f(cncid, cxtype, cfieldid, cname, coffset, &
886  cfield_typeid, cndims, cdim_sizes)
887  If (cstatus == nc_noerr) Then
888  name = stripcnullchar(cname, nlen)
889  offset = coffset
890  field_typeid = cfield_typeid
891  ndims = cndims
892  If (ndims > 0) Then
893  dim_sizes(1:ndims) = cdim_sizes(1:ndims)
894  EndIf
895  EndIf
896 
897  status = cstatus
898 
899  If (ALLOCATED(cdim_sizes)) DEALLOCATE(cdim_sizes)
900 
901  End Function nf_inq_compound_field
902 !-------------------------------- nf_inq_compound_fieldname -------------------
903  Function nf_inq_compound_fieldname(ncid, xtype, fieldid, name) RESULT(status)
905 ! inquire compound field name
906 
908 
909  Implicit NONE
910 
911  Integer, Intent(IN) :: ncid, xtype, fieldid
912  Character(LEN=*), Intent(OUT) :: name
913 
914  Integer :: status
915 
916  Integer(C_INT) :: cncid, cxtype, cfieldid, cstatus
917  Character(LEN=NC_MAX_NAME+1) :: cname
918  Integer :: nlen
919 
920  cncid = ncid
921  cxtype = xtype
922  cfieldid = fieldid - 1
923  nlen = len(name)
924  name = repeat(" ",len(name))
925  cname = repeat(" ",len(cname))
926 
927  cstatus = nc_inq_compound_fieldname(cncid, cxtype, cfieldid, cname)
928 
929  If (cstatus == nc_noerr) Then
930  name = stripcnullchar(cname, nlen)
931  EndIf
932 
933  status = cstatus
934 
935  End Function nf_inq_compound_fieldname
936 !-------------------------------- nf_inq_compound_fieldindex ------------------
937  Function nf_inq_compound_fieldindex( ncid, xtype, name, fieldid) RESULT (status)
939 ! inquire compound field index id
940 
942 
943  Implicit NONE
944 
945  Integer, Intent(IN) :: ncid, xtype
946  Character(LEN=*), Intent(IN) :: name
947  Integer, Intent(OUT) :: fieldid
948 
949  Integer :: status
950 
951  Integer(C_INT) :: cncid, cxtype, cfieldid, cstatus
952  Character(LEN=(LEN(name)+1)) :: cname
953  Integer :: ie
954 
955  cncid = ncid
956  cxtype = xtype
957  cname = repeat(" ",len(cname))
958  cname = addcnullchar(name, ie)
959 
960  cstatus = nc_inq_compound_fieldindex(cncid, cxtype, cname(1:ie), cfieldid)
961 
962  If (cstatus == nc_noerr) Then
963  fieldid = cfieldid + 1
964  EndIf
965 
966  status = cstatus
967 
968  End Function nf_inq_compound_fieldindex
969 !-------------------------------- nf_inq_compound_fieldoffset ----------------
970  Function nf_inq_compound_fieldoffset( ncid, xtype, fieldid, offset)&
971  result(status)
973 ! inquire compound field offset
974 
976 
977  Implicit NONE
978 
979  Integer, Intent(IN) :: ncid, xtype, fieldid
980  Integer, Intent(OUT) :: offset
981 
982  Integer :: status
983 
984  Integer(C_INT) :: cncid, cxtype, cfieldid, cstatus
985  Integer(C_SIZE_T) :: coffset
986 
987  cncid = ncid
988  cxtype = xtype
989  cfieldid = fieldid - 1
990 
991  cstatus = nc_inq_compound_fieldoffset(cncid, cxtype, cfieldid, coffset)
992 
993  If (cstatus == nc_noerr) Then
994  offset = coffset
995  EndIf
996 
997  status = cstatus
998 
999  End Function nf_inq_compound_fieldoffset
1000 !-------------------------------- nf_inq_compound_fieldtype -------------------
1001  Function nf_inq_compound_fieldtype( ncid, xtype, fieldid, field_typeid) &
1002  result(status)
1004 ! inquire compound field typeid
1005 
1007 
1008  Implicit NONE
1009 
1010  Integer, Intent(IN) :: ncid, xtype, fieldid
1011  Integer, Intent(OUT) :: field_typeid
1012 
1013  Integer :: status
1014 
1015  Integer(C_INT) :: cncid, cxtype, cfieldid, cfield_typeid, cstatus
1016 
1017  cncid = ncid
1018  cxtype = xtype
1019  cfieldid = fieldid -1
1020 
1021  cstatus = nc_inq_compound_fieldtype(cncid, cxtype, cfieldid, cfield_typeid)
1022 
1023  If (cstatus == nc_noerr) Then
1024  field_typeid = cfield_typeid
1025  EndIf
1026 
1027  status = cstatus
1028 
1029  End Function nf_inq_compound_fieldtype
1030 !-------------------------------- nf_inq_compound_fieldndims ------------------
1031  Function nf_inq_compound_fieldndims( ncid, xtype, fieldid, ndims) RESULT (status)
1033 ! Inquire compound field dim_size ndims
1034 
1036 
1037  Implicit NONE
1038 
1039  Integer, Intent(IN) :: ncid, xtype, fieldid
1040  Integer, Intent(OUT) :: ndims
1041 
1042  Integer :: status
1043 
1044  Integer(C_INT) :: cncid, cxtype, cfieldid, cndims, cstatus
1045 
1046  cncid = ncid
1047  cxtype = xtype
1048  cfieldid = fieldid -1
1049 
1050  cstatus = nc_inq_compound_fieldndims(cncid, cxtype, cfieldid, cndims)
1051 
1052  If (cstatus == nc_noerr) Then
1053  ndims = cndims
1054  EndIf
1055 
1056  status = cstatus
1057 
1058  End Function nf_inq_compound_fieldndims
1059 !-------------------------------- nf_inq_compound_fielddim_sizes --------------
1060  Function nf_inq_compound_fielddim_sizes( ncid, xtype, fieldid, dim_sizes) &
1061  result(status)
1063 ! inq compound field dimension sizes
1064 
1066 
1067  Implicit NONE
1068 
1069  Integer, Intent(IN) :: ncid, xtype, fieldid
1070  Integer, Intent(INOUT) :: dim_sizes(*)
1071 
1072  Integer :: status
1073 
1074  Integer(C_INT) :: cncid, cxtype, cfieldid, cstatus
1075 
1076  cncid = ncid
1077  cxtype = xtype
1078  cfieldid = fieldid - 1
1079 
1080  cstatus = nc_inq_compound_fielddim_sizes(cncid, cxtype, cfieldid, dim_sizes)
1081 
1082  status = cstatus
1083 
1084  End Function nf_inq_compound_fielddim_sizes
1085 !-------------------------------- nf_def_vlen ---------------------------------
1086  Function nf_def_vlen( ncid, name, base_typeid, xtype) RESULT (status)
1088 ! define variable length data
1089 
1091 
1092  Implicit NONE
1093 
1094  Integer, Intent(IN) :: ncid, base_typeid
1095  Character(LEN=*), Intent(IN) :: name
1096  Integer, Intent(OUT) :: xtype
1097 
1098  Integer :: status
1099 
1100  Integer(C_INT) :: cncid, cxtype, cbase_typeid, cstatus
1101  Character(LEN=(LEN(name)+1)) :: cname
1102  Integer :: ie
1103 
1104  cncid = ncid
1105  cxtype = xtype
1106  cbase_typeid = base_typeid
1107  cname = repeat(" ",len(cname))
1108  cname = addcnullchar(name, ie)
1109 
1110  cstatus = nc_def_vlen(cncid, cname(1:ie), cbase_typeid, cxtype)
1111 
1112  If (cstatus == nc_noerr) Then
1113  xtype = cxtype
1114  EndIf
1115 
1116  status = cstatus
1117 
1118  End Function nf_def_vlen
1119 !-------------------------------- nf_inq_vlen ---------------------------------
1120  Function nf_inq_vlen( ncid, xtype, name, datum_size, base_type) RESULT(status)
1122 ! inquire variable length array info
1123 
1125 
1126  Implicit NONE
1127 
1128  Integer, Intent(IN) :: ncid, xtype
1129  Character(LEN=*), Intent(OUT) :: name
1130  Integer, Intent(OUT) :: datum_size, base_type
1131 
1132  Integer :: status
1133 
1134  Integer(C_INT) :: cncid, cxtype, cbase_type, cstatus
1135  Integer(C_SIZE_T) :: cdatum_size
1136  Character(LEN=NC_MAX_NAME+1) :: cname
1137  Integer :: nlen
1138 
1139  cncid = ncid
1140  cxtype = xtype
1141  nlen = len(name)
1142  name = repeat(" ",len(name))
1143  cname = repeat(" ",len(cname))
1144 
1145  cstatus = nc_inq_vlen(cncid, cxtype, cname, cdatum_size, cbase_type)
1146 
1147  If (cstatus == nc_noerr) Then
1148  name = stripcnullchar(cname, nlen)
1149  datum_size = cdatum_size
1150  base_type = cbase_type
1151  EndIf
1152 
1153  status = cstatus
1154 
1155  End Function nf_inq_vlen
1156 !-------------------------------- nf_inq_user_type ----------------------------
1157  Function nf_inq_user_type( ncid, xtype, name, isize, base_type, nfields, &
1158  iclass) RESULT (status)
1160 ! return size and nfield, class, and base type for user type given
1161 ! ncid, xtype, and name
1162 
1164 
1165  Implicit NONE
1166 
1167  Integer, Intent(IN) :: ncid, xtype
1168  Character(LEN=*), Intent(INOUT) :: name
1169  Integer, Intent(OUT) :: isize, nfields, base_type, iclass
1170 
1171  Integer :: status
1172 
1173  Integer(C_INT) :: cncid, cxtype, cbase_type, cclass, cstatus
1174  Integer(C_SIZE_T) :: csize, cnfields
1175  Character(LEN=NC_MAX_NAME+1) :: cname
1176  Integer :: nlen
1177 
1178  cncid = ncid
1179  cxtype = xtype
1180  nlen = len(name)
1181  name = repeat(" ",len(name))
1182  cname = repeat(" ",len(cname))
1183 
1184 
1185  cstatus = nc_inq_user_type(cncid, cxtype, cname, csize, cbase_type, cnfields, &
1186  cclass)
1187 
1188  If (cstatus == nc_noerr) Then
1189  name = stripcnullchar(cname, nlen)
1190  isize = csize
1191  nfields = cnfields
1192  iclass = cclass
1193  base_type = cbase_type
1194  EndIf
1195 
1196  status = cstatus
1197 
1198  End Function nf_inq_user_type
1199 !-------------------------------- nf_def_enum ---------------------------------
1200  Function nf_def_enum( ncid, base_typeid, name, typeid) RESULT (status)
1202 ! define an enumerator typeid
1203 
1205 
1206  Implicit NONE
1207 
1208  Integer, Intent(IN) :: ncid, base_typeid
1209  Character(LEN=*), Intent(IN) :: name
1210  Integer, Intent(OUT) :: typeid
1211 
1212  Integer :: status
1213 
1214  Integer(C_INT) :: cncid, cbase_typeid, ctypeid, cstatus
1215  Character(LEN=(LEN(name)+1)) :: cname
1216  Integer :: ie
1217 
1218  cncid = ncid
1219  cbase_typeid = base_typeid
1220  cname = repeat(" ",len(cname))
1221  cname = addcnullchar(name, ie)
1222 
1223  cstatus = nc_def_enum(cncid, cbase_typeid, cname(1:ie), ctypeid)
1224 
1225  If (cstatus == nc_noerr) Then
1226  typeid = ctypeid
1227  EndIf
1228 
1229  status = cstatus
1230 
1231  End Function nf_def_enum
1232 !-------------------------------- nf_insert_enum -------------------------------
1233  Function nf_insert_enum( ncid, xtype, name, value) RESULT (status)
1235 ! define a value for an enum. We used a C_CHAR string to pass the data
1236 ! into nf_insert_enum and a C_PTR type to pass the address of value
1237 ! into nc_insert_enum which is expecting a void pointer. Don't use
1238 ! an explicit interface to nf_insert_enum in the calling program
1239 ! for any data type other than character. Just declare it external
1240 
1242 
1243  Implicit NONE
1244 
1245  Integer, Intent(IN) :: ncid, xtype
1246  Character(LEN=*), Intent(IN) :: name
1247  Character(KIND=C_CHAR), Intent(IN), TARGET :: value(*)
1248 
1249  Integer :: status
1250 
1251  Integer(C_INT) :: cncid, cxtype, cstatus
1252  Type(c_ptr) :: cvalueptr
1253  Character(LEN=(LEN(name)+1)) :: cname
1254  Integer :: ie
1255 
1256  cncid = ncid
1257  cxtype = xtype
1258  cname = repeat(" ",len(cname))
1259  cname = addcnullchar(name, ie)
1260 
1261  cvalueptr = c_loc(value)
1262 
1263  cstatus = nc_insert_enum(cncid, cxtype, cname(1:ie), cvalueptr)
1264 
1265  status = cstatus
1266 
1267  End Function nf_insert_enum
1268 !-------------------------------- nf_inq_enum ------------------------------
1269  Function nf_inq_enum( ncid, xtype, name, base_nf_type, base_size, &
1270  num_members) RESULT (status)
1272 ! get information about an enum.
1273 
1275 
1276  Implicit NONE
1277 
1278  Integer, Intent(IN) :: ncid, xtype
1279  Character(LEN=*), Intent(INOUT) :: name
1280  Integer, Intent(INOUT) :: base_nf_type, base_size, num_members
1281 
1282  Integer :: status
1283 
1284  Integer(C_INT) :: cncid, cxtype, c_base_nf_type, cstatus
1285  Integer(C_SIZE_T) :: c_base_size, c_num_members
1286  Character(LEN=NC_MAX_NAME+1) :: cname
1287  Integer :: nlen
1288 
1289  cncid = ncid
1290  cxtype = xtype
1291  nlen = len(name)
1292  name = repeat(" ",len(name))
1293  cname = repeat(" ",len(cname))
1294 
1295  cstatus = nc_inq_enum(cncid, cxtype, cname, c_base_nf_type, c_base_size, &
1296  c_num_members)
1297 
1298  If (cstatus == nc_noerr) Then
1299  name = stripcnullchar(cname, nlen)
1300  base_nf_type = c_base_nf_type
1301  base_size = c_base_size
1302  num_members = c_num_members
1303  EndIf
1304 
1305  status = cstatus
1306 
1307  End Function nf_inq_enum
1308 !-------------------------------- nf_inq_enum_member ---------------------------
1309  Function nf_inq_enum_member( ncid, xtype, idx, name, value) RESULT (status)
1311 ! Get name and value for an enum. We use a C_CHAR string to pass data
1312 ! from nc_inq_enum_member to the calling routine. Value is a void
1313 ! pointer in nc_inq_enum_member. Don't use an explicit interface in
1314 ! the calling program. Declare nf_inq_enum_member external
1315 
1317 
1318  Implicit NONE
1319 
1320  Integer, Intent(IN) :: ncid, xtype, idx
1321  Character(LEN=*), Intent(OUT) :: name
1322  Character(KIND=C_CHAR), Intent(OUT) :: value(*)
1323 
1324  Integer :: status
1325 
1326  Integer(C_INT) :: cncid, cxtype, cidx, cstatus
1327  Character(LEN=NC_MAX_NAME+1) :: cname
1328  Integer :: nlen
1329 
1330  cncid = ncid
1331  cxtype = xtype
1332  cidx = idx - 1
1333  nlen = len(name)
1334  name = repeat(" ",len(name))
1335  cname = repeat(" ",len(cname))
1336 
1337  cstatus = nc_inq_enum_member(cncid, cxtype, cidx, cname, value)
1338 
1339  If (cstatus == nc_noerr) Then
1340  name = stripcnullchar(cname, nlen)
1341  EndIf
1342 
1343  status = cstatus
1344 
1345  End Function nf_inq_enum_member
1346 !-------------------------------- nf_inq_enum_ident ---------------------------
1347  Function nf_inq_enum_ident( ncid, xtype, value, name) RESULT (status)
1349 ! get name of enum identifier given value, type.
1350 
1352 
1353  Implicit NONE
1354 
1355  Integer, Intent(IN) :: ncid, xtype, value
1356  Character(LEN=*), Intent(INOUT) :: name
1357 
1358  Integer :: status
1359 
1360  Integer(C_INT) :: cncid, cxtype, cstatus
1361  Integer(C_LONG_LONG) :: cvalue
1362  Character(LEN=NC_MAX_NAME+1) :: cname
1363  Integer :: nlen
1364 
1365  cncid = ncid
1366  cxtype = xtype
1367  cvalue = value
1368  nlen = len(name)
1369  name = repeat(" ",len(name))
1370  cname = repeat(" ",len(cname))
1371 
1372  cstatus = nc_inq_enum_ident(cncid, cxtype, cvalue, cname)
1373 
1374  If (cstatus == nc_noerr) Then
1375  name = stripcnullchar(cname, nlen)
1376  EndIf
1377 
1378  status = cstatus
1379 
1380  End Function nf_inq_enum_ident
1381 !-------------------------------- nf_def_opaque -------------------------------
1382  Function nf_def_opaque( ncid, isize, name, xtype) RESULT (status)
1384 ! define opaque type info
1385 
1387 
1388  Implicit NONE
1389 
1390  Integer, Intent(IN) :: ncid, isize
1391  Character(LEN=*), Intent(IN) :: name
1392  Integer, Intent(OUT) :: xtype
1393 
1394  Integer :: status
1395 
1396  Integer(C_INT) :: cncid, cxtype, cstatus
1397  Integer(C_SIZE_T) :: csize
1398  Character(LEN=(LEN(name)+1)) :: cname
1399  Integer :: ie
1400 
1401  cncid = ncid
1402  csize = isize
1403  cxtype = xtype
1404  cname = repeat(" ",len(cname))
1405  cname = addcnullchar(name, ie)
1406 
1407  cstatus = nc_def_opaque(cncid, csize, cname(1:ie), cxtype)
1408 
1409  If (cstatus == nc_noerr) Then
1410  xtype = cxtype
1411  EndIf
1412 
1413  status = cstatus
1414 
1415  End Function nf_def_opaque
1416 !-------------------------------- nf_inq_opaque -------------------------------
1417  Function nf_inq_opaque( ncid, xtype, name, isize) RESULT (status)
1419 ! Inquire about opaque type info
1420 
1422 
1423  Implicit NONE
1424 
1425  Integer, Intent(IN) :: ncid, xtype
1426  Character(LEN=*), Intent(INOUT) :: name
1427  Integer, Intent(OUT) :: isize
1428 
1429  Integer :: status
1430 
1431  Integer(C_INT) :: cncid, cxtype, cstatus
1432  Integer(C_SIZE_T) :: csize
1433  Character(LEN=NC_MAX_NAME+1) :: cname
1434  Integer :: nlen
1435 
1436  cncid = ncid
1437  cxtype = xtype
1438  nlen = len(name)
1439  name = repeat(" ",len(name))
1440  cname = repeat(" ",len(cname))
1441 
1442  cstatus = nc_inq_opaque(cncid, cxtype, cname, csize)
1443 
1444  If (cstatus == nc_noerr) Then
1445  name = stripcnullchar(cname, nlen)
1446  isize = csize
1447  EndIf
1448 
1449  status = cstatus
1450 
1451  End Function nf_inq_opaque
1452 !-------------------------------- nf_def_var_chunking -------------------------
1453  Function nf_def_var_chunking( ncid, varid, contiguous, chunksizes) &
1454  result(status)
1456 ! define variable chunking
1457 
1459 
1460  Implicit NONE
1461 
1462  Integer, Intent(IN) :: ncid, varid, contiguous
1463  Integer, Intent(INOUT) :: chunksizes(*)
1464 
1465  Integer :: status
1466 
1467  Integer(C_INT) :: cncid, cvarid, ccontiguous, cstat1, cstatus, &
1468  cndims
1469  Type(c_ptr) :: cchunksizeptr
1470  Integer :: i, ndims
1471 
1472  Integer(C_INT), ALLOCATABLE, TARGET :: cchunksizes(:)
1473 
1474  cncid = ncid
1475  cvarid = varid-1
1476  ccontiguous = contiguous
1477 
1478  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
1479 
1480  ndims = cndims
1481  cchunksizeptr = c_null_ptr
1482 
1483  If (cstat1 == nc_noerr) Then
1484  If (ndims > 0) Then
1485  ALLOCATE(cchunksizes(ndims))
1486  cchunksizes(1:ndims) = chunksizes(ndims:1:-1)
1487  cchunksizeptr = c_loc(cchunksizes)
1488  EndIf
1489  EndIf
1490 
1491  cstatus = nc_def_var_chunking_ints(cncid, cvarid, ccontiguous, cchunksizeptr)
1492 
1493  status = cstatus
1494 
1495 ! Make sure there are no dangling pointers or allocated arrays
1496 
1497  cchunksizeptr = c_null_ptr
1498  If (ALLOCATED(cchunksizes)) DEALLOCATE(cchunksizes)
1499 
1500  End Function nf_def_var_chunking
1501 !-------------------------------- nf_inq_var_chunking -------------------------
1502  Function nf_inq_var_chunking( ncid, varid, contiguous, chunksizes) RESULT(status)
1504 ! inquire variable chunking
1505 
1507 
1508  Implicit NONE
1509 
1510  Integer, Intent(IN) :: ncid, varid
1511  Integer, Intent(INOUT) :: contiguous
1512  Integer, Intent(INOUT) :: chunksizes(*)
1513 
1514  Integer :: status
1515 
1516  Integer(C_INT) :: cncid, cvarid, ccontiguous, cstatus, cstat1, cndims
1517  Integer :: ndims
1518 
1519  Integer(C_INT), ALLOCATABLE :: cchunksizes(:)
1520 
1521  cncid = ncid
1522  cvarid = varid-1
1523  chunksizes(1) = 0
1524  contiguous = 0
1525 
1526  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
1527  status = cstat1
1528 
1529  If (cndims > 0) Then
1530  ALLOCATE(cchunksizes(cndims))
1531  Else
1532  ALLOCATE(cchunksizes(1))
1533  EndIf
1534 
1535  cchunksizes = 0
1536 
1537  cstatus = nc_inq_var_chunking_ints(cncid, cvarid, ccontiguous, &
1538  cchunksizes)
1539  ndims = cndims
1540  If (cstatus == nc_noerr) Then
1541  If (ndims > 0) Then
1542  chunksizes(ndims:1:-1) = cchunksizes(1:ndims)
1543  EndIf
1544  contiguous = ccontiguous
1545  EndIf
1546 
1547  status = cstatus
1548 
1549  If (ALLOCATED(cchunksizes)) DEALLOCATE(cchunksizes)
1550 
1551  End Function nf_inq_var_chunking
1552 !-------------------------------- nf_def_var_deflate --------------------------
1553  Function nf_def_var_deflate( ncid, varid, shuffle, deflate, deflate_level) &
1554  result(status)
1556 ! define variable deflation
1557 
1559 
1560  Implicit NONE
1561 
1562  Integer, Intent(IN) :: ncid, varid, shuffle, deflate, deflate_level
1563 
1564  Integer :: status
1565 
1566  Integer(C_INT) :: cncid, cvarid, cshuffle, cdeflate, cdeflate_level, &
1567  cstatus
1568 
1569  cncid = ncid
1570  cvarid = varid-1
1571  cshuffle = shuffle
1572  cdeflate = deflate
1573  cdeflate_level = deflate_level
1574 
1575  cstatus = nc_def_var_deflate(cncid, cvarid, cshuffle, cdeflate, cdeflate_level)
1576  status = cstatus
1577 
1578  End Function nf_def_var_deflate
1579 !-------------------------------- nf_inq_var_deflate -------------------------
1580  Function nf_inq_var_deflate( ncid, varid, shuffle, deflate, deflate_level) &
1581  result(status)
1583 ! inquire variable deflation
1584 
1586 
1587  Implicit NONE
1588 
1589  Integer, Intent(IN) :: ncid, varid
1590  Integer, Intent(OUT) :: shuffle, deflate, deflate_level
1591 
1592  Integer :: status
1593 
1594  Integer(C_INT) :: cncid, cvarid, cshuffle, cdeflate, cdeflate_level, &
1595  cstatus
1596 
1597  cncid = ncid
1598  cvarid = varid-1
1599 
1600  cstatus = nc_inq_var_deflate(cncid, cvarid, cshuffle, cdeflate, cdeflate_level)
1601 
1602  If (cstatus == nc_noerr) Then
1603  shuffle = cshuffle
1604  deflate = cdeflate
1605  deflate_level = cdeflate_level
1606  EndIf
1607 
1608  status = cstatus
1609 
1610  End Function nf_inq_var_deflate
1611 
1612 !-------------------------------- nf_inq_var_szip -----------------------------
1613  Function nf_inq_var_szip(ncid, varid, options_mask, pixels_per_block) RESULT(status)
1615 ! get szip variables
1616 
1618 
1619  Implicit NONE
1620 
1621  Integer, Intent(IN) :: ncid, varid
1622  Integer, Intent(INOUT) :: options_mask, pixels_per_block
1623 
1624  Integer :: status
1625 
1626  Integer(C_INT) :: cncid, cvarid, coptions_mask, cpixels_per_block, cstatus
1627 
1628  cncid = ncid
1629  cvarid = varid-1
1630 
1631  cstatus = nc_inq_var_szip(cncid, cvarid, coptions_mask, cpixels_per_block)
1632 
1633  If (cstatus == nc_noerr) Then
1634  options_mask = coptions_mask
1635  pixels_per_block = cpixels_per_block
1636  EndIf
1637 
1638  status = cstatus
1639 
1640  End Function nf_inq_var_szip
1641 
1642 !-------------------------------- nf_def_var_fletcher32 -----------------------
1643  Function nf_def_var_fletcher32( ncid, varid, fletcher32) RESULT(status)
1645 ! define var for fletcher32
1646 
1648 
1649  Implicit NONE
1650 
1651  Integer, Intent(IN) :: ncid, varid, fletcher32
1652 
1653  Integer :: status
1654 
1655  Integer(C_INT) :: cncid, cvarid, cfletcher32, cstatus
1656 
1657  cncid = ncid
1658  cvarid = varid-1
1659  cfletcher32 = fletcher32
1660 
1661  cstatus = nc_def_var_fletcher32(cncid, cvarid, cfletcher32)
1662 
1663  status = cstatus
1664 
1665  End Function nf_def_var_fletcher32
1666 !-------------------------------- nf_inq_var_fletcher32 ------------------------
1667  Function nf_inq_var_fletcher32( ncid, varid, fletcher32) RESULT(status)
1669 ! get var for fletcher 32
1670 
1672 
1673  Implicit NONE
1674 
1675  Integer, Intent(IN) :: ncid, varid
1676  Integer, Intent(OUT) :: fletcher32
1677 
1678  Integer :: status
1679 
1680  Integer(C_INT) :: cncid, cvarid, cfletcher32, cstatus
1681 
1682  cncid = ncid
1683  cvarid = varid-1
1684 
1685  cstatus = nc_inq_var_fletcher32(cncid, cvarid, cfletcher32)
1686 
1687  If (cstatus == nc_noerr) Then
1688  fletcher32 = cfletcher32
1689  EndIf
1690 
1691  status = cstatus
1692 
1693  End Function nf_inq_var_fletcher32
1694 !-------------------------------- nf_def_var_fill -----------------------------
1695  Function nf_def_var_fill( ncid, varid, no_fill, fill_value) RESULT(status)
1697 ! define fill variable
1698 
1700 
1701  Implicit NONE
1702 
1703  Integer, Intent(IN) :: ncid, varid, no_fill
1704  Character(KIND=C_CHAR), Intent(IN), TARGET :: fill_value(*)
1705 
1706  Integer :: status
1707 
1708  Integer(C_INT) :: cncid, cvarid, cno_fill, cstatus
1709  Type(c_ptr) :: cfill_value_p
1710 
1711  cncid = ncid
1712  cvarid = varid-1
1713  cno_fill = no_fill
1714 
1715  cfill_value_p = c_loc(fill_value)
1716 
1717  cstatus = nc_def_var_fill(cncid, cvarid, cno_fill, cfill_value_p)
1718 
1719  status = cstatus
1720 
1721  End Function nf_def_var_fill
1722 !-------------------------------- nf_inq_var_fill -----------------------------
1723  Function nf_inq_var_fill( ncid, varid, no_fill, fill_value) RESULT(status)
1725 ! get fill variable
1726 
1728 
1729  Implicit NONE
1730 
1731  Integer, Intent(IN) :: ncid, varid
1732  Integer, Intent(OUT) :: no_fill
1733  Character(KIND=C_CHAR), Intent(INOUT) :: fill_value(*)
1734 
1735  Integer :: status
1736 
1737  Integer(C_INT) :: cncid, cvarid, cno_fill, cstatus
1738 
1739  cncid = ncid
1740  cvarid = varid-1
1741 
1742  cstatus = nc_inq_var_fill(cncid, cvarid, cno_fill, fill_value)
1743 
1744  If (cstatus == nc_noerr) Then
1745  no_fill = cno_fill
1746  EndIf
1747 
1748  status = cstatus
1749 
1750  End Function nf_inq_var_fill
1751 !-------------------------------- nf_def_var_endian ---------------------------
1752  Function nf_def_var_endian( ncid, varid, endiann) RESULT(status)
1754 ! define variable endian
1755 
1757 
1758  Implicit NONE
1759 
1760  Integer, Intent(IN) :: ncid, varid, endiann
1761 
1762  Integer :: status
1763 
1764  Integer(C_INT) :: cncid, cvarid, cendiann, cstatus
1765 
1766  cncid = ncid
1767  cvarid = varid-1
1768  cendiann = endiann
1769 
1770  cstatus = nc_def_var_endian(cncid, cvarid, cendiann)
1771 
1772  status = cstatus
1773 
1774  End Function nf_def_var_endian
1775 !-------------------------------- nf_inq_var_endian ---------------------------
1776  Function nf_inq_var_endian( ncid, varid, endiann) RESULT(status)
1778 ! get variable endian
1779 
1781 
1782  Implicit NONE
1783 
1784  Integer, Intent(IN) :: ncid, varid
1785  Integer, Intent(OUT) :: endiann
1786 
1787  Integer :: status
1788 
1789  Integer(C_INT) :: cncid, cvarid, cendiann, cstatus
1790 
1791  cncid = ncid
1792  cvarid = varid-1
1793 
1794  cstatus = nc_inq_var_endian(cncid, cvarid, cendiann)
1795 
1796  If (cstatus == nc_noerr) Then
1797  endiann = cendiann
1798  EndIf
1799 
1800  status = cstatus
1801 
1802  End Function nf_inq_var_endian
1803 !--------------------------------- nf_put_att --------------------------------
1804  Function nf_put_att(ncid, varid, name, xtype, nlen, value) RESULT(status)
1806 ! Write global attribute of any type. We use a C character
1807 ! string as the dummy arguments for the values
1808 
1810 
1811  Implicit NONE
1812 
1813  Integer, Intent(IN) :: ncid, varid, nlen, xtype
1814  Character(LEN=*), Intent(IN) :: name
1815  Character(KIND=C_CHAR), Intent(IN), TARGET :: value(*)
1816 
1817  Integer :: status
1818 
1819  Integer(C_INT) :: cncid, cvarid, cstatus, cxtype
1820  Integer(C_SIZE_T) :: cnlen
1821  Type(c_ptr) :: cvalueptr
1822  Character(LEN=(LEN(name)+1)) :: cname
1823  Integer :: ie
1824 
1825  cncid = ncid
1826  cvarid = varid -1 ! Subtract 1 to get C varid
1827  cxtype = xtype
1828  cnlen = nlen
1829  cvalueptr = c_loc(value)
1830  cname = repeat(" ",len(cname))
1831  cname = addcnullchar(name, ie)
1832 
1833  cstatus = nc_put_att(cncid, cvarid, cname(1:ie), cxtype, cnlen, cvalueptr)
1834 
1835  status = cstatus
1836 
1837  End Function nf_put_att
1838 !--------------------------------- nf_get_att --------------------------------
1839  Function nf_get_att(ncid, varid, name, value) RESULT(status)
1841 ! Get global attribute of any type. We use a C character
1842 ! string as the dummy arguments for the values. Don't supply calling
1843 ! program with an explicit interface. Just use external
1844 
1846 
1847  Implicit NONE
1848 
1849  Integer, Intent(IN) :: ncid, varid
1850  Character(LEN=*), Intent(IN) :: name
1851  Character(KIND=C_CHAR), Intent(INOUT) :: value(*)
1852 
1853  Integer :: status
1854 
1855  Integer(C_INT) :: cncid, cvarid, cstatus
1856  Character(LEN=(LEN(name)+1)) :: cname
1857  Integer :: ie
1858 
1859  cncid = ncid
1860  cvarid = varid -1 ! Subtract 1 to get C varid
1861  cname = repeat(" ",len(cname))
1862  cname = addcnullchar(name, ie)
1863 
1864  cstatus = nc_get_att(cncid, cvarid, cname(1:ie), value)
1865 
1866  status = cstatus
1867 
1868  End Function nf_get_att
1869 !--------------------------------- nf_put_vlen_element ------------------------
1870  Function nf_put_vlen_element(ncid, xtype, vlen_element, nlen, value) &
1871  result(status)
1873 ! Put in a variable length array element element for Netcdf . We use a C
1874 ! character string as the dummy arguments for the values. Don't supply calling
1875 ! program with an explicit interface. Just use external
1876 
1877 ! Note Users manual defines vlen_element to be a character string. We
1878 ! use the same here but pass it as a C_PTR type.
1879 
1881 
1882  Implicit NONE
1883 
1884  Integer, Intent(IN) :: ncid, xtype, nlen
1885  Character(KIND=C_CHAR), Intent(INOUT) :: vlen_element(*)
1886  Character(KIND=C_CHAR), Intent(IN), TARGET :: value(*)
1887 
1888  Integer :: status
1889 
1890  Integer(C_INT) :: cncid, cxtype, cstatus
1891  Integer(C_SIZE_T) :: cnlen
1892  Type(c_ptr) :: cvalueptr
1893 
1894  cncid = ncid
1895  cxtype = xtype
1896  cnlen = nlen
1897  cvalueptr = c_loc(value)
1898 
1899  cstatus = nc_put_vlen_element(cncid, cxtype, vlen_element, cnlen,&
1900  cvalueptr)
1901 
1902  status = cstatus
1903 
1904  End Function nf_put_vlen_element
1905 !--------------------------------- nf_get_vlen_element ------------------------
1906  Function nf_get_vlen_element(ncid, xtype, vlen_element, nlen, value) RESULT(status)
1908 ! Get a variable length array element element for Netcdf . We use a C
1909 ! character string as the dummy arguments for the values. Don't supply calling
1910 ! program with an explicit interface. Just use external
1911 
1912 ! Note Users manual defines vlen_element to be a character string. We
1913 ! use the same here but pass it as a C_PTR type.
1914 
1916 
1917  Implicit NONE
1918 
1919  Integer, Intent(IN) :: ncid, xtype
1920  Integer, Intent(INOUT) :: nlen
1921  Character(LEN=*), Intent(INOUT), TARGET :: vlen_element
1922  Character(KIND=C_CHAR), Intent(INOUT) :: value(*)
1923 
1924  Integer :: status
1925 
1926  Integer(C_INT) :: cncid, cxtype, cstatus
1927  Integer(C_SIZE_T) :: cnlen
1928 
1929  cncid = ncid
1930  cxtype = xtype
1931 
1932  cstatus = nc_get_vlen_element(cncid, cxtype, vlen_element, cnlen,&
1933  value)
1934 
1935  If (cstatus == nc_noerr) Then
1936  nlen = cnlen
1937  EndIf
1938 
1939  status = cstatus
1940 
1941  End Function nf_get_vlen_element
1942 !--------------------------------- nf_free_vlen --------------------------------
1943  Function nf_free_vlen(vl) RESULT(status)
1945 ! Free memory for vlen array
1946 ! C_CHAR string is used as the dummy arguments for vl. Don't supply calling
1947 ! program with an explicit interface. Just use external
1948 
1950 
1951  Implicit NONE
1952 
1953  Character(KIND=C_CHAR), Intent(IN), TARGET :: vl(*)
1954 
1955  Integer :: status
1956 
1957  Integer(C_INT) :: cstatus
1958  Type(c_ptr) :: cvl
1959 
1960  cvl = c_loc(vl) !void pointer in C interface
1961 
1962  cstatus = nc_free_vlen(cvl)
1963 
1964  status = cstatus
1965 
1966 End Function nf_free_vlen
1967 !--------------------------------- nf_free_vlens ------------------------------
1968  Function nf_free_vlens(ilen, vl) RESULT(status)
1970 ! Free memory for vlens array
1971 ! C_CHAR string is used as the dummy arguments for vl. Don't supply calling
1972 ! program with an explicit interface. Just use external
1973 
1975 
1976  Implicit NONE
1977 
1978  Integer, Intent(IN) :: ilen
1979  Character(KIND=C_CHAR), Intent(IN), TARGET :: vl(*)
1980 
1981  Integer :: status
1982 
1983  Integer(C_SIZE_T) :: clen
1984  Integer(C_INT) :: cstatus
1985  Type(c_ptr) :: cvl
1986 
1987  clen = ilen
1988  cvl = c_loc(vl) !void pointer in C interface
1989 
1990  cstatus = nc_free_vlens(clen, cvl)
1991 
1992  status = cstatus
1993 
1994 End Function nf_free_vlens
1995 !--------------------------------- nf_free_string -----------------------------
1996  Function nf_free_string(ilen, vl) RESULT(status)
1998 ! Free memory for string array
1999 ! C_CHAR string is used as the dummy arguments for vl. Don't supply calling
2000 ! program with an explicit interface. Just use external
2001 
2003 
2004  Implicit NONE
2005 
2006  Integer, Intent(IN) :: ilen
2007  Character(KIND=C_CHAR), Intent(IN), TARGET :: vl(*)
2008 
2009  Integer :: status
2010 
2011  Integer(C_SIZE_T) :: clen
2012  Integer(C_INT) :: cstatus
2013  Type(c_ptr) :: cvl
2014 
2015  clen = ilen
2016  cvl = c_loc(vl) !void pointer in C interface
2017 
2018  cstatus = nc_free_string(clen, cvl)
2019 
2020  status = cstatus
2021 
2022 End Function nf_free_string
2023 
2024 !--------------------------------- nf_put_var -------------------------------
2025  Function nf_put_var(ncid, varid, values) RESULT(status)
2027 ! Write out a variable of any type. We use a C_CHAR character string
2028 ! to hold values. Therefore, an explicit interface to nf_put_var should NOT
2029 ! be used in the calling routine. Use an external instead.
2030 ! Defined in fort-vario.c but only used in 4.0.1 for NETCDF4 builds
2031 
2033 
2034  Implicit NONE
2035 
2036  Integer, Intent(IN) :: ncid, varid
2037  Character(KIND=C_CHAR), Intent(IN), TARGET :: values(*)
2038 
2039  Integer :: status
2040 
2041  Integer(C_INT) :: cncid, cvarid, cstatus
2042  Type(c_ptr) :: cvaluesptr
2043 
2044  cncid = ncid
2045  cvarid = varid - 1 ! Subtract 1 to get C varid
2046 
2047  cvaluesptr = c_loc(values)
2048 
2049  cstatus = nc_put_var(cncid, cvarid, cvaluesptr)
2050 
2051  status = cstatus
2052 
2053  End Function nf_put_var
2054 !--------------------------------- nf_get_var ----------------------------
2055  Function nf_get_var(ncid, varid, values) RESULT(status)
2057 ! Read in a variable of any type. We use a C_CHAR character string
2058 ! to hold values. Therefore, an explicit interface to nf_get_var should NOT
2059 ! be used in the calling routine. Just use external
2060 ! Defined in fort-vario.c but only used in 4.0.1 for NETCDF4 builds
2061 
2063 
2064  Implicit NONE
2065 
2066  Integer, Intent(IN) :: ncid, varid
2067  Character(KIND=C_CHAR), Intent(INOUT) :: values(*)
2068 
2069  Integer :: status
2070 
2071  Integer(C_INT) :: cncid, cvarid, cstatus
2072 
2073  cncid = ncid
2074  cvarid = varid - 1 ! Subtract 1 to get C varid
2075 
2076  cstatus = nc_get_var(cncid, cvarid, values)
2077 
2078  status = cstatus
2079 
2080  End Function nf_get_var
2081 !--------------------------------- nf_put_var1_int64 --------------------------
2082  Function nf_put_var1_int64(ncid, varid, ndex, ival) RESULT(status)
2084 ! Write out a 64 bit integer variable to location vector ndex to dataset
2085 ! Note that the default fort interfaces pass ival as an integer to
2086 ! nc_put_var1_longlong which is expecting a longlong. We chose to
2087 ! pass ival as an integer of type SELECTED_INT_KIND(18) which is
2088 ! consistent with the f90 interfaces that call these routines
2089 
2091 
2092  Implicit NONE
2093 
2094  Integer, Intent(IN) :: ncid, varid
2095  Integer, Intent(IN) :: ndex(*)
2096  Integer(IK8), Intent(IN) :: ival
2097 
2098  Integer :: status
2099 
2100  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2101  Integer(C_LONG_LONG) :: cival
2102  Type(c_ptr) :: cndexptr
2103  Integer :: ndims
2104 
2105  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cndex(:)
2106 
2107  cncid = ncid
2108  cvarid = varid - 1 ! Subtract one to get C varid
2109  cival = ival
2110 
2111  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2112 
2113  cndexptr = c_null_ptr
2114  ndims = cndims
2115 
2116  If (cstat1 == nc_noerr) Then
2117  If (ndims > 0) Then ! reverse array order and subtract 1 to get C index
2118  ALLOCATE(cndex(ndims))
2119  cndex(1:ndims) = ndex(ndims:1:-1) - 1
2120  cndexptr = c_loc(cndex)
2121  EndIf
2122  EndIf
2123 
2124  cstatus = nc_put_var1_longlong(cncid, cvarid, cndexptr, cival)
2125 
2126  status = cstatus
2127 
2128 ! Make sure there are no dangling pointers and allocated values
2129 
2130  cndexptr = c_null_ptr
2131  If (ALLOCATED(cndex)) DEALLOCATE(cndex)
2132 
2133  End Function nf_put_var1_int64
2134 !--------------------------------- nf_put_vara_int64 --------------------------
2135  Function nf_put_vara_int64(ncid, varid, start, counts, ivals) RESULT(status)
2137 ! Write out 64 bit integer array to dataset for given start and count vectors
2138 
2140 
2141  Implicit NONE
2142 
2143  Integer, Intent(IN) :: ncid, varid
2144  Integer, Intent(IN) :: start(*), counts(*)
2145  Integer(IK8), Intent(IN) :: ivals(*)
2146 
2147  Integer :: status
2148 
2149  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2150  Type(c_ptr) :: cstartptr, ccountsptr
2151  Integer :: ndims
2152 
2153  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2154 
2155  cncid = ncid
2156  cvarid = varid - 1 ! Subtract 1 to get C varid
2157 
2158  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2159 
2160  cstartptr = c_null_ptr
2161  ccountsptr = c_null_ptr
2162  ndims = cndims
2163 
2164  If (cstat1 == nc_noerr) Then
2165  If (ndims > 0) Then ! flip array order for C and subtract 1 from start
2166  ALLOCATE(cstart(ndims))
2167  ALLOCATE(ccounts(ndims))
2168  cstart(1:ndims) = start(ndims:1:-1) - 1
2169  ccounts(1:ndims) = counts(ndims:1:-1)
2170  cstartptr = c_loc(cstart)
2171  ccountsptr = c_loc(ccounts)
2172  EndIf
2173  EndIf
2174 
2175  cstatus = nc_put_vara_longlong(cncid, cvarid, cstartptr, ccountsptr, ivals)
2176 
2177  status = cstatus
2178 
2179 ! Make sure there are no dangling pointers or allocated values
2180 
2181  cstartptr = c_null_ptr
2182  ccountsptr = c_null_ptr
2183  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2184  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2185 
2186  End Function nf_put_vara_int64
2187 !--------------------------------- nf_put_vars_int64 --------------------------
2188  Function nf_put_vars_int64(ncid, varid, start, counts, strides, ivals) &
2189  result(status)
2191 ! Write out 64 bit integer array given start, count, and stride
2192 
2194 
2195  Implicit NONE
2196 
2197  Integer, Intent(IN) :: ncid, varid
2198  Integer, Intent(IN) :: start(*), counts(*), strides(*)
2199  Integer(IK8), Intent(IN) :: ivals(*)
2200 
2201  Integer :: status
2202 
2203  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2204  Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr
2205  Integer :: ndims
2206 
2207  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2208  Integer(C_PTRDIFF_T), ALLOCATABLE, TARGET :: cstrides(:)
2209 
2210  cncid = ncid
2211  cvarid = varid - 1 ! Subtract 1 to get C varid
2212 
2213  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2214 
2215  cstartptr = c_null_ptr
2216  ccountsptr = c_null_ptr
2217  cstridesptr = c_null_ptr
2218  ndims = cndims
2219 
2220  If (cstat1 == nc_noerr) Then
2221  If (ndims > 0) Then ! Flip arrays to C order and subtract 1 from start
2222  ALLOCATE(cstart(ndims))
2223  ALLOCATE(ccounts(ndims))
2224  ALLOCATE(cstrides(ndims))
2225  cstart(1:ndims) = start(ndims:1:-1) - 1
2226  ccounts(1:ndims) = counts(ndims:1:-1)
2227  cstrides(1:ndims) = strides(ndims:1:-1)
2228  cstartptr = c_loc(cstart)
2229  ccountsptr = c_loc(ccounts)
2230  cstridesptr = c_loc(cstrides)
2231  EndIf
2232  EndIf
2233 
2234  cstatus = nc_put_vars_longlong(cncid, cvarid, cstartptr, ccountsptr, &
2235  cstridesptr, ivals)
2236 
2237  status = cstatus
2238 
2239 ! Make sure there are no dangling pointers or allocated values
2240 
2241  cstartptr = c_null_ptr
2242  ccountsptr = c_null_ptr
2243  cstridesptr = c_null_ptr
2244  If (ALLOCATED(cstrides)) DEALLOCATE(cstrides)
2245  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2246  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2247 
2248  End Function nf_put_vars_int64
2249 
2250 !--------------------------------- nf_put_varm_int64 -------------------------
2251  Function nf_put_varm_int64(ncid, varid, start, counts, strides, maps, &
2252  ivals) RESULT(status)
2254 ! Write out 64 bit integer array given start, count, stride and map
2255 
2257 
2258  Implicit NONE
2259 
2260  Integer, Intent(IN) :: ncid, varid
2261  Integer, Intent(IN) :: start(*), counts(*), strides(*), maps(*)
2262  Integer(IK8), Intent(IN) :: ivals(*)
2263 
2264  Integer :: status
2265 
2266  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2267  Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, cmapsptr
2268  Integer :: ndims
2269 
2270  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2271  Integer(C_PTRDIFF_T), ALLOCATABLE, TARGET :: cstrides(:), cmaps(:)
2272 
2273  cncid = ncid
2274  cvarid = varid -1 ! Subtract 1 to get C varid
2275 
2276  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2277 
2278  cstartptr = c_null_ptr
2279  ccountsptr = c_null_ptr
2280  cstridesptr = c_null_ptr
2281  cmapsptr = c_null_ptr
2282  ndims = cndims
2283 
2284  If (cstat1 == nc_noerr) Then
2285  If (ndims > 0) Then ! Flip arrays to C order and subtract 1 from start
2286  ALLOCATE(cstart(ndims))
2287  ALLOCATE(ccounts(ndims))
2288  ALLOCATE(cstrides(ndims))
2289  ALLOCATE(cmaps(ndims))
2290  cstart(1:ndims) = start(ndims:1:-1) - 1
2291  ccounts(1:ndims) = counts(ndims:1:-1)
2292  cstrides(1:ndims) = strides(ndims:1:-1)
2293  cmaps(1:ndims) = maps(ndims:1:-1)
2294  cstartptr = c_loc(cstart)
2295  ccountsptr = c_loc(ccounts)
2296  cstridesptr = c_loc(cstrides)
2297  cmapsptr = c_loc(cmaps)
2298  EndIf
2299  EndIf
2300 
2301  cstatus = nc_put_varm_longlong(cncid, cvarid, cstartptr, ccountsptr, &
2302  cstridesptr, cmapsptr, ivals)
2303 
2304  status = cstatus
2305 
2306 ! Make sure there are no dangling pointers or allocated values
2307 
2308  cstartptr = c_null_ptr
2309  ccountsptr = c_null_ptr
2310  cstridesptr = c_null_ptr
2311  cmapsptr = c_null_ptr
2312  If (ALLOCATED(cmaps)) DEALLOCATE(cmaps)
2313  If (ALLOCATED(cstrides)) DEALLOCATE(cstrides)
2314  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2315  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2316 
2317  End Function nf_put_varm_int64
2318 !--------------------------------- nf_put_var_int64 --------------------------
2319  Function nf_put_var_int64(ncid, varid, ivals) RESULT(status)
2321 ! Write out 64 bit integer array to dataset
2322 
2324 
2325  Implicit NONE
2326 
2327  Integer, Intent(IN) :: ncid, varid
2328  Integer(IK8), Intent(IN) :: ivals(*)
2329 
2330  Integer :: status
2331 
2332  Integer(C_INT) :: cncid, cvarid, cstatus
2333 
2334  cncid = ncid
2335  cvarid = varid - 1 ! Subtract 1 to get C varid
2336 
2337  cstatus = nc_put_var_longlong(cncid, cvarid, ivals)
2338 
2339  status = cstatus
2340 
2341  End Function nf_put_var_int64
2342 !--------------------------------- nf_get_var1_int64 -------------------------
2343  Function nf_get_var1_int64(ncid, varid, ndex, ival) RESULT(status)
2345 ! Read in 64 bit integer variable from location vector ndex in dataset
2346 
2348 
2349  Implicit NONE
2350 
2351  Integer, Intent(IN) :: ncid, varid
2352  Integer, Intent(IN) :: ndex(*)
2353  Integer(IK8), Intent(OUT) :: ival
2354 
2355  Integer :: status
2356 
2357  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2358  Integer(C_LONG_LONG) :: cival
2359  Type(c_ptr) :: cndexptr
2360  Integer :: ndims
2361 
2362  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cndex(:)
2363 
2364  cncid = ncid
2365  cvarid = varid - 1 ! Subtract one to get C varid
2366 
2367  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2368 
2369  cndexptr = c_null_ptr
2370  ndims = cndims
2371 
2372  If (cstat1 == nc_noerr) Then
2373  If (ndims > 0) Then ! reverse array order and subtract 1 to get C index
2374  ALLOCATE(cndex(ndims))
2375  cndex(1:ndims) = ndex(ndims:1:-1) - 1
2376  cndexptr = c_loc(cndex)
2377  EndIf
2378  EndIf
2379 
2380  cstatus = nc_get_var1_longlong(cncid, cvarid, cndexptr, cival)
2381 
2382  ival = cival
2383  status = cstatus
2384 
2385 ! Make sure there are no dangling pointers and allocated values
2386 
2387  cndexptr = c_null_ptr
2388  If (ALLOCATED(cndex)) DEALLOCATE(cndex)
2389 
2390  End Function nf_get_var1_int64
2391 !--------------------------------- nf_get_vara_int -------------------------
2392  Function nf_get_vara_int64(ncid, varid, start, counts, ivals) RESULT(status)
2394 ! Read in 64 bit integer array from dataset for given start and count vectors
2395 
2397 
2398  Implicit NONE
2399 
2400  Integer, Intent(IN) :: ncid, varid
2401  Integer, Intent(IN) :: start(*), counts(*)
2402  Integer(IK8), Intent(OUT) :: ivals(*)
2403 
2404  Integer :: status
2405 
2406  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2407  Type(c_ptr) :: cstartptr, ccountsptr
2408  Integer :: ndims
2409 
2410  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2411 
2412  cncid = ncid
2413  cvarid = varid - 1 ! Subtract 1 to get C varid
2414 
2415  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2416 
2417  cstartptr = c_null_ptr
2418  ccountsptr = c_null_ptr
2419  ndims = cndims
2420 
2421  If (cstat1 == nc_noerr) Then
2422  If (ndims > 0) Then ! flip array order for C and subtract 1 from start
2423  ALLOCATE(cstart(ndims))
2424  ALLOCATE(ccounts(ndims))
2425  cstart(1:ndims) = start(ndims:1:-1) - 1
2426  ccounts(1:ndims) = counts(ndims:1:-1)
2427  cstartptr = c_loc(cstart)
2428  ccountsptr = c_loc(ccounts)
2429  EndIf
2430  EndIf
2431 
2432  cstatus = nc_get_vara_longlong(cncid, cvarid, cstartptr, ccountsptr, ivals)
2433 
2434  status = cstatus
2435 
2436 ! Make sure there are no dangling pointers or allocated values
2437 
2438  cstartptr = c_null_ptr
2439  ccountsptr = c_null_ptr
2440  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2441  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2442 
2443  End Function nf_get_vara_int64
2444 
2445 !--------------------------------- nf_get_vars_int64 --------------------------
2446  Function nf_get_vars_int64(ncid, varid, start, counts, strides, ivals) &
2447  result(status)
2449 ! Read in 64 bit integer array given start, count, and stride
2450 
2452 
2453  Implicit NONE
2454 
2455  Integer, Intent(IN) :: ncid, varid
2456  Integer, Intent(IN) :: start(*), counts(*), strides(*)
2457  Integer(IK8), Intent(OUT) :: ivals(*)
2458 
2459  Integer :: status
2460 
2461  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2462  Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr
2463  Integer :: ndims
2464 
2465  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2466  Integer(C_PTRDIFF_T), ALLOCATABLE, TARGET :: cstrides(:)
2467 
2468  cncid = ncid
2469  cvarid = varid - 1 ! Subtract 1 to get C varid
2470 
2471  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2472 
2473  cstartptr = c_null_ptr
2474  ccountsptr = c_null_ptr
2475  cstridesptr = c_null_ptr
2476  ndims = cndims
2477 
2478  If (cstat1 == nc_noerr) Then
2479  If (ndims > 0) Then ! Flip arrays to C order and subtract 1 from start
2480  ALLOCATE(cstart(ndims))
2481  ALLOCATE(ccounts(ndims))
2482  ALLOCATE(cstrides(ndims))
2483  cstart(1:ndims) = start(ndims:1:-1) - 1
2484  ccounts(1:ndims) = counts(ndims:1:-1)
2485  cstrides(1:ndims) = strides(ndims:1:-1)
2486  cstartptr = c_loc(cstart)
2487  ccountsptr = c_loc(ccounts)
2488  cstridesptr = c_loc(cstrides)
2489  EndIf
2490  EndIf
2491 
2492  cstatus = nc_get_vars_longlong(cncid, cvarid, cstartptr, ccountsptr, &
2493  cstridesptr, ivals)
2494  status = cstatus
2495 
2496 ! Make sure there are no dangling pointers or allocated values
2497 
2498  cstartptr = c_null_ptr
2499  ccountsptr = c_null_ptr
2500  cstridesptr = c_null_ptr
2501  If (ALLOCATED(cstrides)) DEALLOCATE(cstrides)
2502  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2503  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2504 
2505  End Function nf_get_vars_int64
2506 !--------------------------------- nf_get_varm_int64 -------------------------
2507  Function nf_get_varm_int64(ncid, varid, start, counts, strides, maps, &
2508  ivals) RESULT(status)
2510 ! Read in 64 bit integer array given start, count, stride and map
2511 
2513 
2514  Implicit NONE
2515 
2516  Integer, Intent(IN) :: ncid, varid
2517  Integer, Intent(IN) :: start(*), counts(*), strides(*), maps(*)
2518  Integer(IK8), Intent(OUT) :: ivals(*)
2519 
2520  Integer :: status
2521 
2522  Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
2523  Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, cmapsptr
2524  Integer :: ndims
2525 
2526  Integer(C_SIZE_T), ALLOCATABLE, TARGET :: cstart(:), ccounts(:)
2527  Integer(C_PTRDIFF_T), ALLOCATABLE, TARGET :: cstrides(:), cmaps(:)
2528 
2529  cncid = ncid
2530  cvarid = varid -1 ! Subtract 1 to get C varid
2531 
2532  cstat1 = nc_inq_varndims(cncid, cvarid, cndims)
2533 
2534  cstartptr = c_null_ptr
2535  ccountsptr = c_null_ptr
2536  cstridesptr = c_null_ptr
2537  cmapsptr = c_null_ptr
2538  ndims = cndims
2539 
2540  If (cstat1 == nc_noerr) Then
2541  If (ndims > 0) Then ! Flip arrays to C order and subtract 1 from start
2542  ALLOCATE(cstart(ndims))
2543  ALLOCATE(ccounts(ndims))
2544  ALLOCATE(cstrides(ndims))
2545  ALLOCATE(cmaps(ndims))
2546  cstart(1:ndims) = start(ndims:1:-1) - 1
2547  ccounts(1:ndims) = counts(ndims:1:-1)
2548  cstrides(1:ndims) = strides(ndims:1:-1)
2549  cmaps(1:ndims) = maps(ndims:1:-1)
2550  cstartptr = c_loc(cstart)
2551  ccountsptr = c_loc(ccounts)
2552  cstridesptr = c_loc(cstrides)
2553  cmapsptr = c_loc(cmaps)
2554  EndIf
2555  EndIf
2556 
2557  cstatus = nc_get_varm_longlong(cncid, cvarid, cstartptr, ccountsptr, &
2558  cstridesptr, cmapsptr, ivals)
2559 
2560  status = cstatus
2561 
2562 ! Make sure there are no dangling pointers or allocated values
2563 
2564  cstartptr = c_null_ptr
2565  ccountsptr = c_null_ptr
2566  cstridesptr = c_null_ptr
2567  cmapsptr = c_null_ptr
2568  If (ALLOCATED(cmaps)) DEALLOCATE(cmaps)
2569  If (ALLOCATED(cstrides)) DEALLOCATE(cstrides)
2570  If (ALLOCATED(ccounts)) DEALLOCATE(ccounts)
2571  If (ALLOCATED(cstart)) DEALLOCATE(cstart)
2572 
2573  End Function nf_get_varm_int64
2574 !--------------------------------- nf_get_var_int64 --------------------------
2575  Function nf_get_var_int64(ncid, varid, ivals) RESULT(status)
2577 ! Read in 64 bit integer array from dataset
2578 
2580 
2581  Implicit NONE
2582 
2583  Integer, Intent(IN) :: ncid, varid
2584  Integer(IK8), Intent(OUT) :: ivals(*)
2585 
2586  Integer :: status
2587 
2588  Integer(C_INT) :: cncid, cvarid, cstatus
2589 
2590  cncid = ncid
2591  cvarid = varid - 1 ! Subtract 1 to get C varid
2592 
2593  cstatus = nc_get_var_longlong(cncid, cvarid, ivals)
2594 
2595  status = cstatus
2596 
2597  End Function nf_get_var_int64
2598 !--------------------------------- nf_set_chunk_cache ------------------------
2599  Function nf_set_chunk_cache(chunk_size, nelems, preemption) RESULT(status)
2601 ! Set chunk cache size. Note this follows the fort-nc4 version which uses
2602 ! uses nc_set_chunk_cache_ints to avoid size_t issues with fortran. F03
2603 ! does not have these issues so we could call nc_set_chunk_cache
2604 
2606 
2607  Implicit NONE
2608 
2609  Integer, Intent(IN) :: chunk_size, nelems, preemption
2610 
2611  Integer :: status
2612 
2613  Integer(C_INT) :: cchunk_size, cnelems, cpreemption, cstatus
2614 
2615  cchunk_size = chunk_size
2616  cnelems = nelems
2617  cpreemption = preemption
2618 
2619  cstatus = nc_set_chunk_cache_ints(cchunk_size, cnelems, cpreemption)
2620 
2621  status = cstatus
2622 
2623  End Function nf_set_chunk_cache
2624 !--------------------------------- nf_get_chunk_cache -------------------------
2625  Function nf_get_chunk_cache(chunk_size, nelems, preemption) RESULT(status)
2627 ! get chunk cache size. Note this follows the fort-nc4 version which uses
2628 ! uses nc_get_chunk_cache_ints to avoid size_t issues with fortran. F03
2629 ! does not have these issues so we could call nc_set_chunk_cache
2630 
2632 
2633  Implicit NONE
2634 
2635  Integer, Intent(INOUT) :: chunk_size, nelems, preemption
2636 
2637  Integer :: status
2638 
2639  Integer(C_INT) :: cchunk_size, cnelems, cpreemption, cstatus
2640 
2641  cstatus = nc_get_chunk_cache_ints(cchunk_size, cnelems, cpreemption)
2642 
2643  If (cstatus == nc_noerr) Then
2644  chunk_size = cchunk_size
2645  nelems = cnelems
2646  preemption = cpreemption
2647  EndIf
2648  status = cstatus
2649 
2650  End Function nf_get_chunk_cache
2651 !--------------------------------- nf_set_var_chunk_cache ---------------------
2652  Function nf_set_var_chunk_cache(ncid, varid, chunk_size, nelems, preemption) RESULT(status)
2654 ! Set chunk cache size. Note this follows the fort-nc4 version which uses
2655 ! uses nc_set_var_chunk_cache_ints to avoid size_t issues with fortran.
2656 
2658 
2659  Implicit NONE
2660 
2661  Integer, Intent(IN) :: ncid, varid, chunk_size, nelems, preemption
2662 
2663  Integer :: status
2664 
2665  Integer(C_INT) :: cncid, cvarid, cchunk_size, cnelems, cpreemption, &
2666  cstatus
2667 
2668  cncid = ncid
2669  cvarid = varid-1
2670  cchunk_size = chunk_size
2671  cnelems = nelems
2672  cpreemption = preemption
2673 
2674  cstatus = nc_set_var_chunk_cache_ints(cncid, cvarid, cchunk_size, cnelems, &
2675  cpreemption)
2676 
2677  status = cstatus
2678 
2679  End Function nf_set_var_chunk_cache
2680 !--------------------------------- nf_get_var_chunk_cache ---------------------
2681  Function nf_get_var_chunk_cache(ncid, varid, chunk_size, nelems, preemption) RESULT(status)
2683 ! get chunk cache size. Note this follows the fort-nc4 version which uses
2684 ! uses nc_get_var_chunk_cache_ints to avoid size_t issues with fortran.
2685 
2687 
2688  Implicit NONE
2689 
2690  Integer, Intent(IN) :: ncid, varid
2691  Integer, Intent(INOUT) :: chunk_size, nelems, preemption
2692 
2693  Integer :: status
2694 
2695  Integer(C_INT) :: cncid, cvarid, cchunk_size, cnelems, cpreemption, &
2696  cstatus
2697 
2698  cncid = ncid
2699  cvarid = varid-1
2700 
2701  cstatus = nc_get_var_chunk_cache_ints(cncid, cvarid, cchunk_size, cnelems, &
2702  cpreemption)
2703 
2704  If (cstatus == nc_noerr) Then
2705  chunk_size = cchunk_size
2706  nelems = cnelems
2707  preemption = cpreemption
2708  EndIf
2709  status = cstatus
2710 
2711  End Function nf_get_var_chunk_cache
integer function nf_free_string(ilen, vl)
Definition: nf_nc4.f90:1997
integer function nf_inq_grp_ncid(ncid, grp_name, parent_ncid)
Definition: nf_nc4.f90:329
integer function nf_free_vlens(ilen, vl)
Definition: nf_nc4.f90:1969
integer function nf_inq_compound_fieldoffset(ncid, xtype, fieldid, offset)
Definition: nf_nc4.f90:972
integer function nf_inq_ncid(ncid, name, groupid)
Definition: nf_nc4.f90:128
integer function nf_def_var_deflate(ncid, varid, shuffle, deflate, deflate_level)
Definition: nf_nc4.f90:1555
integer function nf_inq_var_fill(ncid, varid, no_fill, fill_value)
Definition: nf_nc4.f90:1724
integer function nf_inq_var_szip(ncid, varid, options_mask, pixels_per_block)
Definition: nf_nc4.f90:1614
integer function nf_inq_grp_full_ncid(ncid, name, grp_ncid)
Definition: nf_nc4.f90:360
integer function nf_inq_compound_field(ncid, xtype, fieldid, name, offset, field_typeid, ndims, dim_sizes)
Definition: nf_nc4.f90:845
integer function nf_def_grp(parent_ncid, name, new_ncid)
Definition: nf_nc4.f90:525
integer function nf_inq_grpname_len(ncid, nlen)
Definition: nf_nc4.f90:275
integer function nf_put_var1_int64(ncid, varid, ndex, ival)
Definition: nf_nc4.f90:2083
integer function nf_inq_compound_fieldndims(ncid, xtype, fieldid, ndims)
Definition: nf_nc4.f90:1032
integer function nf_rename_grp(grpid, name)
Definition: nf_nc4.f90:556
integer function nf_get_varm_int64(ncid, varid, start, counts, strides, maps, ivals)
Definition: nf_nc4.f90:2509
integer function nf_def_opaque(ncid, isize, name, xtype)
Definition: nf_nc4.f90:1383
integer function nf_get_var1_int64(ncid, varid, ndex, ival)
Definition: nf_nc4.f90:2344
integer function nf_insert_array_compound(ncid, xtype, name, offset, field_typeid, ndims, dim_sizes)
Definition: nf_nc4.f90:651
integer function nf_put_var_int64(ncid, varid, ivals)
Definition: nf_nc4.f90:2320
integer function nf_inq_compound_fielddim_sizes(ncid, xtype, fieldid, dim_sizes)
Definition: nf_nc4.f90:1062
integer function nf_inq_compound_fieldindex(ncid, xtype, name, fieldid)
Definition: nf_nc4.f90:938
integer function nf_inq_grpname(ncid, name)
Definition: nf_nc4.f90:210
integer function nf_inq_var_chunking(ncid, varid, contiguous, chunksizes)
Definition: nf_nc4.f90:1503
integer function nf_inq_var_fletcher32(ncid, varid, fletcher32)
Definition: nf_nc4.f90:1668
integer function nf_inq_compound_fieldtype(ncid, xtype, fieldid, field_typeid)
Definition: nf_nc4.f90:1003
integer function nf_inq_grps(ncid, numgrps, ncids)
Definition: nf_nc4.f90:160
integer function nf_inq_compound(ncid, xtype, name, isize, nfields)
Definition: nf_nc4.f90:718
integer function nf_get_vlen_element(ncid, xtype, vlen_element, nlen, value)
Definition: nf_nc4.f90:1907
integer function nf_inq_typeids(ncid, ntypes, typeids)
Definition: nf_nc4.f90:447
integer function nf_inq_compound_name(ncid, xtype, name)
Definition: nf_nc4.f90:754
integer function nf_inq_typeid(ncid, name, typeid)
Definition: nf_nc4.f90:493
integer function nf_inq_vlen(ncid, xtype, name, datum_size, base_type)
Definition: nf_nc4.f90:1121
integer function nf_def_var_chunking(ncid, varid, contiguous, chunksizes)
Definition: nf_nc4.f90:1455
integer function nf_inq_varids(ncid, nvars, varids)
Definition: nf_nc4.f90:391
integer function nf_inq_compound_size(ncid, xtype, isize)
Definition: nf_nc4.f90:786
integer function nf_inq_var_deflate(ncid, varid, shuffle, deflate, deflate_level)
Definition: nf_nc4.f90:1582
integer function nf_inq_enum(ncid, xtype, name, base_nf_type, base_size, num_members)
Definition: nf_nc4.f90:1271
integer function nf_def_var_fletcher32(ncid, varid, fletcher32)
Definition: nf_nc4.f90:1644
integer function nf_def_var_endian(ncid, varid, endiann)
Definition: nf_nc4.f90:1753
integer function nf_put_var(ncid, varid, values)
Definition: nf_nc4.f90:2026
module procedure interfaces for utility routines
integer function nf_put_vara_int64(ncid, varid, start, counts, ivals)
Definition: nf_nc4.f90:2136
integer function nf_put_vars_int64(ncid, varid, start, counts, strides, ivals)
Definition: nf_nc4.f90:2190
integer function nf_get_vars_int64(ncid, varid, start, counts, strides, ivals)
Definition: nf_nc4.f90:2448
integer function nf_free_vlen(vl)
Definition: nf_nc4.f90:1944
integer(c_int), parameter nc_noerr
integer function nf_def_enum(ncid, base_typeid, name, typeid)
Definition: nf_nc4.f90:1201
integer function nf_inq_compound_fieldname(ncid, xtype, fieldid, name)
Definition: nf_nc4.f90:904
integer function nf_insert_enum(ncid, xtype, name, value)
Definition: nf_nc4.f90:1234
integer function nf_inq_user_type(ncid, xtype, name, isize, base_type, nfields, iclass)
Definition: nf_nc4.f90:1159
integer function nf_put_vlen_element(ncid, xtype, vlen_element, nlen, value)
Definition: nf_nc4.f90:1872
integer function nf_get_var(ncid, varid, values)
Definition: nf_nc4.f90:2056
integer function nf_put_varm_int64(ncid, varid, start, counts, strides, maps, ivals)
Definition: nf_nc4.f90:2253
integer function nf_inq_type(ncid, xtype, name, isize)
Definition: nf_nc4.f90:685
integer function nf_set_chunk_cache(chunk_size, nelems, preemption)
Definition: nf_nc4.f90:2600
integer function nf_get_vara_int64(ncid, varid, start, counts, ivals)
Definition: nf_nc4.f90:2393
integer function nf_set_var_chunk_cache(ncid, varid, chunk_size, nelems, preemption)
Definition: nf_nc4.f90:2653
integer function nf_inq_enum_ident(ncid, xtype, value, name)
Definition: nf_nc4.f90:1348
integer function nf_inq_grpname_full(ncid, nlen, name)
Definition: nf_nc4.f90:241
integer function nf_create_par(path, cmode, comm, info, ncid)
Definition: nf_nc4.f90:38
integer function nf_var_par_access(ncid, varid, iaccess)
Definition: nf_nc4.f90:104
integer function nf_insert_compound(ncid, xtype, name, offset, field_typeid)
Definition: nf_nc4.f90:618
integer function nf_get_chunk_cache(chunk_size, nelems, preemption)
Definition: nf_nc4.f90:2626
integer function nf_def_var_fill(ncid, varid, no_fill, fill_value)
Definition: nf_nc4.f90:1696
integer function nf_inq_grp_parent(ncid, parent_ncid)
Definition: nf_nc4.f90:303
integer function nf_get_var_int64(ncid, varid, ivals)
Definition: nf_nc4.f90:2576
integer function nf_get_att(ncid, varid, name, value)
Definition: nf_nc4.f90:1840
integer function nf_open_par(path, mode, comm, info, ncid)
Definition: nf_nc4.f90:71
integer function nf_inq_compound_nfields(ncid, xtype, nfields)
Definition: nf_nc4.f90:815
integer function nf_def_compound(ncid, isize, name, typeid)
Definition: nf_nc4.f90:583
integer function nf_def_vlen(ncid, name, base_typeid, xtype)
Definition: nf_nc4.f90:1087
integer function nf_get_var_chunk_cache(ncid, varid, chunk_size, nelems, preemption)
Definition: nf_nc4.f90:2682
integer function nf_inq_dimids(ncid, ndims, dimids, parent)
Definition: nf_nc4.f90:419
integer function nf_inq_opaque(ncid, xtype, name, isize)
Definition: nf_nc4.f90:1418
integer function nf_put_att(ncid, varid, name, xtype, nlen, value)
Definition: nf_nc4.f90:1805
integer function nf_inq_var_endian(ncid, varid, endiann)
Definition: nf_nc4.f90:1777
integer function nf_inq_enum_member(ncid, xtype, idx, name, value)
Definition: nf_nc4.f90:1310

Return to the Main Unidata NetCDF page.
Generated on Thu Nov 9 2017 06:56:52 for NetCDF-Fortran. NetCDF is a Unidata library.