File: netcdf_file.f90

package info (click to toggle)
netcdf-fortran 4.4.4%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,420 kB
  • ctags: 8,797
  • sloc: fortran: 51,087; f90: 20,357; sh: 11,601; ansic: 7,034; makefile: 548; pascal: 313; xml: 173
file content (155 lines) | stat: -rw-r--r-- 4,868 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
! This is part of the netCDF F90 API, or. Copyright 2006 UCAR. See COPYRIGHT file
! for details.

! This file contains the netcdf file functions that are shared by
! netcdf-3 and netcdf-4.

! $Id: netcdf4_constants.f90,v 1.14 2010/05/25 13:53:00 ed Exp $
! -------
function nf90_inq_libvers()
  character(len = 80) :: nf90_inq_libvers

  nf90_inq_libvers = nf_inq_libvers()
end function nf90_inq_libvers
! -------
function nf90_strerror(ncerr)
  integer, intent( in) :: ncerr
  character(len = 80)  :: nf90_strerror

  nf90_strerror = nf_strerror(ncerr)
end function nf90_strerror
! -------
!
! File level control routines:
!
function nf90_inq_base_pe(ncid, pe)
  integer, intent( in) :: ncid
  integer, intent(out) :: pe
  integer              :: nf90_inq_base_pe

  nf90_inq_base_pe = nf_inq_base_pe(ncid, pe)
end function nf90_inq_base_pe
! -------
function nf90_set_base_pe(ncid, pe)
  integer, intent( in) :: ncid, pe
  integer              :: nf90_set_base_pe

  nf90_set_base_pe = nf_set_base_pe(ncid, pe)
end function nf90_set_base_pe
! -------
function nf90_create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
  character (len = *), intent( in) :: path
  integer,             intent( in) :: cmode, initalsz, basepe, chunksizehint
  integer,             intent(out) :: ncid
  integer                          :: nf90_create_mp

  nf90_create_mp = nf__create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
end function nf90_create_mp
! -------
function nf90_open_mp(path, mode, basepe, chunksizeint, ncid)
  character (len = *), intent( in) :: path
  integer,             intent( in) :: mode, basepe, chunksizeint
  integer,             intent(out) :: ncid
  integer                          :: nf90_open_mp

  nf90_open_mp = nf__open_mp(path, mode, basepe, chunksizeint, ncid)
end function nf90_open_mp
! -------
function nf90_set_fill(ncid, fillmode, old_mode)
  integer, intent( in) :: ncid, fillmode 
  integer, intent(out) :: old_mode
  integer              :: nf90_set_fill

  nf90_set_fill = nf_set_fill(ncid, fillmode, old_mode)
end function nf90_set_fill
! -------
function nf90_redef(ncid)
  integer, intent( in) :: ncid
  integer              :: nf90_redef

  nf90_redef = nf_redef(ncid)
end function nf90_redef
! -------
function nf90_enddef(ncid, h_minfree, v_align, v_minfree, r_align)
  integer,           intent( in) :: ncid
  integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align
  integer                        :: nf90_enddef

  integer :: hMinFree, VAlign, VMinFree, RAlign

  if(.not. any( (/ present(h_minfree), present(v_align), &
       present(v_minfree), present(r_align) /) ) )then
     nf90_enddef = nf_enddef(ncid)
  else 
     ! Default values per the man page
     hMinFree = 0; VMinFree = 0
     VAlign   = 4; RAlign   = 4
     if(present(h_minfree)) HMinFree = h_minfree
     if(present(v_align  )) VAlign   = v_align
     if(present(v_minfree)) VMinFree = v_minfree
     if(present(r_align  )) RAlign   = r_align
     nf90_enddef = nf__enddef(ncid, hMinFree, VAlign, VMinFree, RAlign)
  end if
end function nf90_enddef
! -------
function nf90_sync(ncid)
  integer, intent( in) :: ncid
  integer              :: nf90_sync

  nf90_sync = nf_sync(ncid)
end function nf90_sync
! -------
function nf90_abort(ncid)
  integer, intent( in) :: ncid
  integer              :: nf90_abort

  nf90_abort = nf_abort(ncid)
end function nf90_abort
! -------
function nf90_close(ncid)
  integer, intent( in) :: ncid
  integer              :: nf90_close

  nf90_close = nf_close(ncid)
end function nf90_close
! -------
function nf90_delete(name)
  character(len = *), intent( in) :: name
  integer                         :: nf90_delete

  nf90_delete = nf_delete(name)
end function nf90_delete

!
! A single file level inquiry routine 
! 
function nf90_inquire(ncid, nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum)
  integer,           intent( in) :: ncid
  integer, optional, intent(out) :: nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum
  integer                        :: nf90_inquire

  integer :: nDims, nVars, nGAtts, unlimDimId, frmt

  nf90_inquire = nf_inq(ncid, nDims, nVars, nGAtts, unlimDimId)
  if(present(nDimensions))    nDimensions    = nDims 
  if(present(nVariables))     nVariables     = nVars
  if(present(nAttributes))    nAttributes    = nGAtts
  if(present(unlimitedDimId)) unlimitedDimId = unlimDimId
  if(present(formatNum)) then
     nf90_inquire = nf_inq_format(ncid, frmt)
     formatNum = frmt
  endif
end function nf90_inquire

function nf90_inq_path(ncid, pathlen, path)

  integer,            intent(in)    :: ncid
  integer,            intent(inout) :: pathlen
  character(len = *), intent(inout) :: path

  integer                           :: nf90_inq_path

  nf90_inq_path = nf_inq_path(ncid, pathlen, path)

end function nf90_inq_path