11 & dims, dimsizes, longnames, units, xtypes, &
12 & institution, origin, interval, newest, oldest, &
13 & conventions, gt_version, &
50 use gtool_history_types, only: gt_history, gt_history_axis, gt_history_varinfo, gt_history_attr
51 use gtool_history_internal
, only: default
52 use gtdata_generic
, only: inquire, get_attr, open, close
57 use dc_trace
, only: beginsub, endsub, dbgmessage
60 type(gt_history),
intent(in):: history
61 logical,
intent(out),
optional :: err
62 character(*),
intent(out),
optional:: file, title, source, institution
63 real,
intent(out),
optional:: origin, interval
64 real,
intent(out),
optional:: newest
65 real,
intent(out),
optional:: oldest
66 character(*),
intent(out),
optional:: conventions, gt_version
67 character(*),
pointer,
optional:: dims(:)
68 integer,
pointer,
optional:: dimsizes(:)
69 character(*),
pointer,
optional:: longnames(:)
70 character(*),
pointer,
optional:: units(:)
71 character(*),
pointer,
optional:: xtypes(:)
72 type(gt_history_axis),
pointer,
optional :: axes(:)
73 type(gt_history_varinfo),
pointer,
optional :: varinfo(:)
76 character(STRING) :: url, cause_c
77 character(TOKEN) :: unknown_mes =
'unknown' 78 integer :: i, j, numdims, numvars, alldims, stat
80 type(gt_variable) :: dimvar
81 character(*),
parameter:: subname =
"HistoryInquire1" 83 call beginsub(subname)
86 if (.not.
associated(history % dimvars) .or. &
87 &
size(history % dimvars) < 1)
then 92 if (
present(file))
then 93 call inquire(history % dimvars(1), url=url)
94 call urlsplit(fullname=url, file=file)
96 if (
present(title))
then 97 call get_attr(history % dimvars(1),
'+title', title, trim(unknown_mes))
99 if (
present(source))
then 100 call get_attr(history % dimvars(1),
'+source', source, trim(unknown_mes))
102 if (
present(institution))
then 103 call get_attr(history % dimvars(1),
'+institution', institution, trim(unknown_mes))
106 if (
present(origin))
then 107 origin = history % origin
110 if (
present(interval))
then 111 interval = history % interval
114 if (
present(newest))
then 115 newest = history % newest
118 if (
present(oldest))
then 119 oldest = history % oldest
122 if (
present(conventions))
then 123 call get_attr(history % dimvars(1),
'+Conventions', conventions, trim(unknown_mes))
125 if (
present(gt_version))
then 126 call get_attr(history % dimvars(1),
'+gt_version', gt_version, trim(unknown_mes))
128 if (
present(dims))
then 129 numdims =
size(history % dimvars)
130 allocate(dims(numdims))
132 call inquire(history % dimvars(i), name=dims(i))
135 if (
present(dimsizes))
then 136 numdims =
size(history % dimvars)
137 allocate(dimsizes(numdims))
139 call inquire(history % dimvars(i), size=dimsizes(i), growable=growable)
140 if (growable) dimsizes(i) = 0
143 if (
present(longnames))
then 144 numdims =
size(history % dimvars)
145 allocate(longnames(numdims))
147 call get_attr(history % dimvars(i),
'long_name', &
148 & longnames(i),
'unknown')
151 if (
present(units))
then 152 numdims =
size(history % dimvars)
153 allocate(units(numdims))
155 call get_attr(history % dimvars(i),
'units', &
156 & units(i),
'unknown')
159 if (
present(xtypes))
then 160 numdims =
size(history % dimvars)
161 allocate(xtypes(numdims))
163 call inquire(history % dimvars(i), xtype=xtypes(i))
166 if (
present(axes))
then 167 numvars =
size(history % dimvars)
168 allocate(axes(numvars))
170 call inquire(history % dimvars(i), &
171 & allcount=axes(i) % length, &
172 & xtype=axes(i) % xtype, name=axes(i) % name)
173 call get_attr(history % dimvars(i),
'long_name', &
174 & axes(i) % longname,
'unknown')
175 call get_attr(history % dimvars(i),
'units', &
176 & axes(i) % units,
'unknown')
188 if (
present(varinfo))
then 189 if (.not.
associated(history % vars) .or. &
190 &
size(history % vars) < 1)
then 195 numvars =
size(history % vars)
196 allocate(varinfo(numvars))
198 call inquire(history % vars(i), alldims=alldims, &
199 & xtype=varinfo(i) % xtype, name=varinfo(i) % name)
200 call get_attr(history % vars(i),
'long_name', &
201 & varinfo(i) % longname,
'unknown')
202 call get_attr(history % vars(i),
'units', &
203 & varinfo(i) % units,
'unknown')
212 allocate(varinfo(i) % dims(alldims))
214 call open(var=dimvar, source_var=history % vars(i), &
215 & dimord=j, count_compact=.true.)
216 call inquire(dimvar, name=varinfo(i) % dims(j))
220 varinfo(i) % initialized = .true.
225 call storeerror(stat, subname, err, cause_c=cause_c)
232 & dims, dimsizes, longnames, units, xtypes, &
233 & institution, origin, interval, newest, oldest, &
234 & conventions, gt_version, &
253 use gtool_history_types, only: gt_history, gt_history_axis, gt_history_varinfo, gt_history_attr
254 use gtool_history_internal
, only: default
255 use gtool_history_generic
, only: historyinquire
257 use dc_trace
, only: beginsub, endsub, dbgmessage
260 character(*),
intent(in):: history
261 logical,
intent(out),
optional :: err
262 character(*),
intent(out),
optional:: file, title, source, institution
263 real,
intent(out),
optional:: origin, interval, newest, oldest
264 character(*),
intent(out),
optional:: conventions, gt_version
265 character(*),
pointer,
optional:: dims(:)
266 integer,
pointer,
optional:: dimsizes(:)
267 character(*),
pointer,
optional:: longnames(:)
268 character(*),
pointer,
optional:: units(:)
269 character(*),
pointer,
optional:: xtypes(:)
270 type(gt_history_axis),
pointer,
optional :: axes(:)
271 type(gt_history_varinfo),
pointer,
optional :: varinfo(:)
273 character(STRING):: cause_c
274 character(*),
parameter:: subname =
"HistoryInquire2" 276 call beginsub(subname,
"history=%c", c1=trim(history))
279 if (trim(history) /=
'default')
then 281 cause_c =
'history="' // trim(history) //
'"' 284 call historyinquire(default, err, file, title, source, &
285 & dims, dimsizes, longnames, units, xtypes, &
286 & institution, origin, interval, newest, oldest, &
287 & conventions, gt_version, &
290 call storeerror(stat, subname, cause_c=cause_c)
297 & dims, dimsizes, longnames, units, xtypes, &
298 & institution, origin, interval, newest, oldest, &
299 & conventions, gt_version, &
311 use gtool_history_types, only: gt_history, gt_history_axis, gt_history_varinfo, gt_history_attr
312 use gtool_history_generic
, only: historyinquire
313 use dc_trace
, only: beginsub, endsub, dbgmessage
315 type(gt_history),
intent(in):: history
316 logical,
intent(out),
optional :: err
317 character(*),
intent(out),
optional:: file, title, source, institution
318 real,
intent(out),
optional:: origin, interval
319 real,
intent(out),
optional:: newest
320 real,
intent(out),
optional:: oldest
321 character(*),
intent(out),
optional:: conventions, gt_version
322 character(*),
pointer,
optional:: dims(:)
323 integer,
pointer,
optional:: dimsizes(:)
324 character(*),
pointer,
optional:: longnames(:)
325 character(*),
pointer,
optional:: units(:)
326 character(*),
pointer,
optional:: xtypes(:)
327 type(gt_history_axis),
pointer,
optional :: axes(:)
328 type(gt_history_varinfo),
pointer,
optional :: varinfo(:)
330 character(*),
parameter:: subname =
"HistoryInquire3" 332 call beginsub(subname)
333 call historyinquire(history, err, file, title, source, &
334 & dims, dimsizes, longnames, units, xtypes, &
335 & institution, origin, interval, newest, oldest, &
336 & conventions, gt_version, &
344 & dims, dimsizes, longnames, units, xtypes, &
345 & institution, origin, interval, newest, oldest, &
346 & conventions, gt_version, &
358 use gtool_history_types, only: gt_history, gt_history_axis, gt_history_varinfo, gt_history_attr
359 use gtool_history_generic
, only: historyinquire
360 use dc_trace
, only: beginsub, endsub, dbgmessage
362 character(*),
intent(in):: history
363 logical,
intent(out),
optional :: err
364 character(*),
intent(out),
optional:: file, title, source, institution
365 real,
intent(out),
optional:: origin, interval, newest, oldest
366 character(*),
intent(out),
optional:: conventions, gt_version
367 character(*),
pointer,
optional:: dims(:)
368 integer,
pointer,
optional:: dimsizes(:)
369 character(*),
pointer,
optional:: longnames(:)
370 character(*),
pointer,
optional:: units(:)
371 character(*),
pointer,
optional:: xtypes(:)
372 type(gt_history_axis),
pointer,
optional :: axes(:)
373 type(gt_history_varinfo),
pointer,
optional :: varinfo(:)
374 character(*),
parameter:: subname =
"HistoryInquire4" 376 call beginsub(subname)
377 call historyinquire(history, err, file, title, source, &
378 & dims, dimsizes, longnames, units, xtypes, &
379 & institution, origin, interval, newest, oldest, &
380 & conventions, gt_version, &
integer, parameter, public token
Character length for word, token.
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
subroutine historyinquire1(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)
subroutine historyinquire2(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)
integer, parameter, public dp
Double Precision Real number.
subroutine historyinquire3(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)
Provides kind type parameter values.
integer, parameter, public gt_ebadhistory
subroutine historyinquire4(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)
integer, parameter, public string
Character length for string.