11 & dims, dimsizes, longnames, units, xtypes, &
12 & institution, origin, interval, newest, oldest, &
13 & conventions, gt_version, &
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
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(:)
76 character(STRING) :: url, cause_c
77 character(TOKEN) :: unknown_mes =
'unknown'
78 integer :: i, j, numdims, numvars, alldims, stat
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) )
then
193 if (
size(history % vars) < 1)
then
197 numvars =
size(history % vars)
198 allocate(varinfo(numvars))
200 call inquire(history % vars(i), alldims=alldims, &
201 & xtype=varinfo(i) % xtype, name=varinfo(i) % name)
202 call get_attr(history % vars(i),
'long_name', &
203 & varinfo(i) % longname,
'unknown')
204 call get_attr(history % vars(i),
'units', &
205 & varinfo(i) % units,
'unknown')
214 allocate(varinfo(i) % dims(alldims))
216 call open(var=dimvar, source_var=history % vars(i), &
217 & dimord=j, count_compact=.true.)
218 call inquire(dimvar, name=varinfo(i) % dims(j))
222 varinfo(i) % initialized = .true.
227 call storeerror(stat, subname, err, cause_c=cause_c)
234 & dims, dimsizes, longnames, units, xtypes, &
235 & institution, origin, interval, newest, oldest, &
236 & conventions, gt_version, &
256 use gtool_history_internal,
only:
default
257 use gtool_history_generic,
only: historyinquire
259 use dc_trace,
only: beginsub, endsub, dbgmessage
262 character(*),
intent(in):: history
263 logical,
intent(out),
optional :: err
264 character(*),
intent(out),
optional:: file, title, source, institution
265 real,
intent(out),
optional:: origin, interval, newest, oldest
266 character(*),
intent(out),
optional:: conventions, gt_version
267 character(*),
pointer,
optional:: dims(:)
268 integer,
pointer,
optional:: dimsizes(:)
269 character(*),
pointer,
optional:: longnames(:)
270 character(*),
pointer,
optional:: units(:)
271 character(*),
pointer,
optional:: xtypes(:)
275 character(STRING):: cause_c
276 character(*),
parameter:: subname =
"HistoryInquire2"
278 call beginsub(subname,
"history=%c", c1=trim(history))
281 if (trim(history) /=
'default')
then
283 cause_c =
'history="' // trim(history) //
'"'
286 call historyinquire(
default, err, file, title, source, &
287 & dims, dimsizes, longnames, units, xtypes, &
288 & institution, origin, interval, newest, oldest, &
289 & conventions, gt_version, &
292 call storeerror(stat, subname, cause_c=cause_c)
299 & dims, dimsizes, longnames, units, xtypes, &
300 & institution, origin, interval, newest, oldest, &
301 & conventions, gt_version, &
314 use gtool_history_generic,
only: historyinquire
315 use dc_trace,
only: beginsub, endsub, dbgmessage
318 logical,
intent(out),
optional :: err
319 character(*),
intent(out),
optional:: file, title, source, institution
320 real,
intent(out),
optional:: origin, interval
321 real,
intent(out),
optional:: newest
322 real,
intent(out),
optional:: oldest
323 character(*),
intent(out),
optional:: conventions, gt_version
324 character(*),
pointer,
optional:: dims(:)
325 integer,
pointer,
optional:: dimsizes(:)
326 character(*),
pointer,
optional:: longnames(:)
327 character(*),
pointer,
optional:: units(:)
328 character(*),
pointer,
optional:: xtypes(:)
332 character(*),
parameter:: subname =
"HistoryInquire3"
334 call beginsub(subname)
335 call historyinquire(history, err, file, title, source, &
336 & dims, dimsizes, longnames, units, xtypes, &
337 & institution, origin, interval, newest, oldest, &
338 & conventions, gt_version, &
346 & dims, dimsizes, longnames, units, xtypes, &
347 & institution, origin, interval, newest, oldest, &
348 & conventions, gt_version, &
361 use gtool_history_generic,
only: historyinquire
362 use dc_trace,
only: beginsub, endsub, dbgmessage
364 character(*),
intent(in):: history
365 logical,
intent(out),
optional :: err
366 character(*),
intent(out),
optional:: file, title, source, institution
367 real,
intent(out),
optional:: origin, interval, newest, oldest
368 character(*),
intent(out),
optional:: conventions, gt_version
369 character(*),
pointer,
optional:: dims(:)
370 integer,
pointer,
optional:: dimsizes(:)
371 character(*),
pointer,
optional:: longnames(:)
372 character(*),
pointer,
optional:: units(:)
373 character(*),
pointer,
optional:: xtypes(:)
376 character(*),
parameter:: subname =
"HistoryInquire4"
378 call beginsub(subname)
379 call historyinquire(history, err, file, title, source, &
380 & dims, dimsizes, longnames, units, xtypes, &
381 & institution, origin, interval, newest, oldest, &
382 & conventions, gt_version, &
subroutine historyinquire3(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)
subroutine historyinquire4(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)
subroutine historyinquire1(history, err, file, title, source, dims, dimsizes, longnames, units, xtypes, institution, origin, interval, newest, oldest, conventions, gt_version, axes, varinfo)