56 use dc_trace
, only: beginsub, endsub
57 use dc_string
, only: putline, printf, split, strinclude, stoa, joinchar
59 use dc_present
, only: present_and_not_empty, present_and_true, present_select
60 use dc_message
, only: messagenotify
65 use netcdf
, only: nf90_max_dims
68 real(DP),
intent(in),
optional:: interval_value
74 character(*),
intent(in),
optional:: interval_unit
77 character(*),
intent(in),
optional:: precision
80 logical,
intent(in),
optional:: time_average
83 logical,
intent(in),
optional:: average
86 character(*),
intent(in),
optional:: fileprefix
89 real(DP),
intent(in),
optional:: origin_value
92 character(*),
intent(in),
optional:: origin_unit
95 real(DP),
intent(in),
optional:: terminus_value
98 character(*),
intent(in),
optional:: terminus_unit
101 integer,
intent(in),
optional:: slice_start(:)
104 integer,
intent(in),
optional:: slice_end(:)
107 integer,
intent(in),
optional:: slice_stride(:)
110 logical,
intent(in),
optional:: space_average(:)
113 integer,
intent(in),
optional:: newfile_intvalue
116 character(*),
intent(in),
optional:: newfile_intunit
119 logical,
intent(out),
optional:: err
137 type(dc_difftime):: interval_time
138 integer:: stat, ary_size
139 character(STRING):: cause_c
140 character(*),
parameter:: subname =
'HstNmlInfoCreate' 142 call beginsub( subname, &
143 & fmt =
'@interval_value=%r @interval_unit=%c @precision=%c @time_average=%y @fileprefix=%c', &
144 & d = (/ present_select(.true., -1.0_dp, interval_value) /), &
145 & c1 = trim( present_select(.true.,
'<no>', interval_unit) ), &
146 & c2 = trim( present_select(.true.,
'<no>', precision) ), &
147 & l = (/ present_and_true(time_average) /), &
148 & c3 = trim( present_select(.true.,
'<no>', fileprefix) ), &
157 if ( gthstnml % initialized )
then 159 cause_c =
'GTHST_NMLINFO' 167 allocate( gthstnml % gthstnml_list )
168 nullify( gthstnml % gthstnml_list % next )
174 gthstnml % gthstnml_list % name =
'' 175 gthstnml % gthstnml_list % file =
'' 177 allocate( gthstnml % gthstnml_list % interval_value )
178 allocate( gthstnml % gthstnml_list % interval_unit )
179 allocate( gthstnml % gthstnml_list % precision )
180 allocate( gthstnml % gthstnml_list % time_average )
181 allocate( gthstnml % gthstnml_list % fileprefix )
183 allocate( gthstnml % gthstnml_list % origin_value )
184 allocate( gthstnml % gthstnml_list % origin_unit )
185 allocate( gthstnml % gthstnml_list % terminus_value )
186 allocate( gthstnml % gthstnml_list % terminus_unit )
187 allocate( gthstnml % gthstnml_list % slice_start (1:nf90_max_dims) )
188 allocate( gthstnml % gthstnml_list % slice_end (1:nf90_max_dims) )
189 allocate( gthstnml % gthstnml_list % slice_stride (1:nf90_max_dims) )
190 allocate( gthstnml % gthstnml_list % space_average (1:nf90_max_dims) )
191 allocate( gthstnml % gthstnml_list % newfile_intvalue )
192 allocate( gthstnml % gthstnml_list % newfile_intunit )
195 gthstnml % gthstnml_list % interval_value = -1.0
196 gthstnml % gthstnml_list % interval_unit =
'sec' 197 gthstnml % gthstnml_list % precision =
'float' 198 gthstnml % gthstnml_list % time_average = .false.
199 gthstnml % gthstnml_list % fileprefix =
'' 201 gthstnml % gthstnml_list % origin_value = -1.0
202 gthstnml % gthstnml_list % origin_unit =
'sec' 203 gthstnml % gthstnml_list % terminus_value = -1.0
204 gthstnml % gthstnml_list % terminus_unit =
'sec' 205 gthstnml % gthstnml_list % slice_start = 1
206 gthstnml % gthstnml_list % slice_end = -1
207 gthstnml % gthstnml_list % slice_stride = 1
208 gthstnml % gthstnml_list % space_average = .false.
209 gthstnml % gthstnml_list % newfile_intvalue = -1
210 gthstnml % gthstnml_list % newfile_intunit =
'sec' 212 if (
present(interval_value) ) gthstnml % gthstnml_list % interval_value = interval_value
213 if (
present(interval_unit) ) gthstnml % gthstnml_list % interval_unit = interval_unit
214 if (
present(precision) ) gthstnml % gthstnml_list % precision = precision
216 if (
present(average) ) gthstnml % gthstnml_list % time_average = average
217 if (
present(time_average) ) gthstnml % gthstnml_list % time_average = time_average
218 if (
present(fileprefix) ) gthstnml % gthstnml_list % fileprefix = fileprefix
220 if (
present(origin_value ) ) gthstnml % gthstnml_list % origin_value = origin_value
221 if (
present(origin_unit ) ) gthstnml % gthstnml_list % origin_unit = origin_unit
222 if (
present(terminus_value ) ) gthstnml % gthstnml_list % terminus_value = terminus_value
223 if (
present(terminus_unit ) ) gthstnml % gthstnml_list % terminus_unit = terminus_unit
224 if (
present(slice_start ) )
then 225 ary_size =
size(slice_start)
226 gthstnml % gthstnml_list % slice_start(1:ary_size) = slice_start
228 if (
present(slice_end ) )
then 229 ary_size =
size(slice_end)
230 gthstnml % gthstnml_list % slice_end(1:ary_size) = slice_end
232 if (
present(slice_stride ) )
then 233 ary_size =
size(slice_stride)
234 gthstnml % gthstnml_list % slice_stride(1:ary_size) = slice_stride
236 if (
present(space_average ) )
then 237 ary_size =
size(space_average)
238 gthstnml % gthstnml_list % space_average(1:ary_size) = space_average
240 if (
present(newfile_intvalue) ) gthstnml % gthstnml_list % newfile_intvalue = newfile_intvalue
241 if (
present(newfile_intunit ) ) gthstnml % gthstnml_list % newfile_intunit = newfile_intunit
248 & diff = interval_time, &
250 &
real( gthstnml % gthstnml_list % interval_value, DP ), &
251 & unit = gthstnml % gthstnml_list % interval_unit, &
253 if ( present_and_true( err ) ) then
262 gthstnml % initialized = .true.
263 gthstnml % define_mode = .true.
265 call storeerror( stat, subname, err, cause_c )
266 call endsub( subname )
integer, parameter, public dc_earglack
integer, parameter, public usr_errno
integer, parameter, public dc_enofileread
integer, parameter, public token
Character length for word, token.
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
character(*), parameter, public version
integer, parameter, public dp
Double Precision Real number.
integer, parameter, public stdout
Unit number for Standard OUTPUT.
Provides kind type parameter values.
integer, parameter, public dc_ealreadyinit
integer, parameter, public dc_enegative
integer, parameter, public string
Character length for string.