gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
historyaddattr.f90
Go to the documentation of this file.
1!--
2! *** Caution!! ***
3!
4! This file is generated from "historyaddattr.rb2f90" by Ruby 3.3.8.
5! Please do not edit this file directly.
6!
7! [JAPANESE]
8!
9! ※※※ 注意!!! ※※※
10!
11! このファイルは "historyaddattr.rb2f90" から Ruby 3.3.8
12! によって自動生成されたファイルです.
13! このファイルを直接編集しませんようお願い致します.
14!
15!
16!++
17!> @file historyaddattr.F
18!>
19!> @author Yasuhiro MORIKAWA, Eizi TOYODA
20!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
21!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
22!>
23!> @en
24!> @brief Add attributes to a variable in gtool4 data
25!> @enden
26!>
27!> @ja
28!> @brief gtool4 データ内の変数への属性付加
29!> @endja
30 subroutine historyaddattrchar0( &
31 & varname, attrname, value, history, err)
32 !
33 !
34 !> @brief gtool4 データ内の変数への属性付加
35 !>
36 !> gtool4 データおよびそのデータ内の変数に属性を付加します。
37 !> このサブルーチンを用いる前に、 HistoryCreate による初期設定が
38 !> 必要です。
39 !>
40 !> 属性名 attrname の先頭にプラス "+" を付加する
41 !> 場合は、gtool4 データ自体の属性 (大域属性) として属性が付加されます。
42 !> この場合、varname は無視されますが、
43 !> その場合でも varname へはデータ内に存在する変数名を与えてください。
44 !>
45 !> HistoryAddAttr は複数のサブルーチンの総称名です。value には
46 !> いくつかの型を与えることが可能です。
47 !> 下記のサブルーチンを参照ください。
48 !
49 !
52 use gtdata_generic, only: put_attr
53 use gtdata_types, only: gt_variable
54 use dc_string, only: tochar
55 use dc_url, only: gt_plus
56 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
57 use dc_message, only: messagenotify
58 use dc_trace, only: beginsub, endsub
59 use dc_types, only: string
60 implicit none
61 character(*), intent(in):: varname
62 ! 変数の名前。
63 !
64 ! ここで指定するものは、
65 ! HistoryCreateの *dims* 、
66 ! または HistoryAddVariable の
67 ! *varname* で既に指定されてい
68 ! なければなりません。
69 !
70 character(*), intent(in):: attrname
71 ! 変数またはファイル全体に付
72 ! 加する属性の名前
73 !
74 ! "<b><tt>+</tt></b>" (プラ
75 ! ス) を属性名の先頭につける
76 ! 場合には、ファイル全体に属
77 ! 性を付加します。
78 ! ファイル全体へ属性を付加
79 ! する場合でも、 HistoryCreate
80 ! の *dims* 、または
81 ! HistoryAddVariable の
82 ! *varname* で既に指定されてい
83 ! る変数を *varname* に指定する
84 ! 必要があります。
85 !
86 character(*), intent(in):: value
87 ! 属性の値
88 !
89 type(gt_history), intent(inout), target, optional:: history
90 ! 出力ファイルの設定に関する情報を
91 ! 格納した構造体
92 !
93 ! ここに指定するものは、
94 ! HistoryCreate によって初期設定
95 ! されていなければなりません。
96 !
97 logical, intent(out), optional:: err
98 ! 例外処理用フラグ.
99 ! デフォルトでは, この手続き内でエラーが
100 ! 生じた場合, プログラムは強制終了します.
101 ! 引数 *err* が与えられる場合,
102 ! プログラムは強制終了せず, 代わりに
103 ! *err* に .true. が代入されます.
104 !
105 ! Exception handling flag.
106 ! By default, when error occur in
107 ! this procedure, the program aborts.
108 ! If this *err* argument is given,
109 ! .true. is substituted to *err* and
110 ! the program does not abort.
111 type(gt_history), pointer:: hst =>null()
112 type(gt_variable):: var
113 integer:: v_ord
114 logical:: err_not_found
115 integer:: stat
116 character(STRING):: cause_c
117 character(len = *), parameter:: subname = "HistoryAddAttrChar0"
118 continue
119 call beginsub(subname, &
120 & 'varname=<%c> attrname=<%c>, value=<%c>', &
121 & c1=trim(varname), c2=trim(attrname), c3=trim(value))
122 stat = dc_noerr
123 cause_c = ''
124 ! 操作対象決定
125 if (present(history)) then
126 hst => history
127 else
128 hst => default
129 endif
130 if (varname == "") then
131 ! とりあえず無駄だが大域属性を何度もつける
132 do, v_ord = 1, size(hst % vars)
133 call put_attr(hst % vars(v_ord), gt_plus // attrname, value)
134 enddo
135 else
136 call lookup_var_or_dim( hst, varname, var, err_not_found )
137 if ( .not. err_not_found ) then
138 call put_attr(var, attrname, value)
139 else
140 stat = nf90_enotvar
141 cause_c = 'varname="' // trim(varname) // '" is not found'
142 goto 999
143 endif
144 endif
145999 continue
146 call storeerror(stat, subname, err, cause_c=cause_c)
147 call endsub(subname)
148 end subroutine historyaddattrchar0
150 & varname, attrname, value, history, err)
151 !
152 !
155 use gtdata_generic, only: put_attr
156 use gtdata_types, only: gt_variable
157 use dc_string, only: tochar
158 use dc_url, only: gt_plus
159 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
160 use dc_message, only: messagenotify
161 use dc_trace, only: beginsub, endsub
162 use dc_types, only: string
163 implicit none
164 character(*), intent(in):: varname
165 character(*), intent(in):: attrname
166 logical, intent(in):: value
167 type(gt_history), intent(inout), target, optional:: history
168 logical, intent(out), optional:: err
169 type(gt_history), pointer:: hst =>null()
170 type(gt_variable):: var
171 integer:: v_ord
172 logical:: err_not_found
173 integer:: stat
174 character(STRING):: cause_c
175 character(len = *), parameter:: subname = "HistoryAddAttrLogical0"
176 continue
177 call beginsub(subname, &
178 & 'varname=<%c> attrname=<%c>, value=<%c>', &
179 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
180 stat = dc_noerr
181 cause_c = ''
182 ! 操作対象決定
183 if (present(history)) then
184 hst => history
185 else
186 hst => default
187 endif
188 if (varname == "") then
189 ! とりあえず無駄だが大域属性を何度もつける
190 do, v_ord = 1, size(hst % vars)
191 call put_attr(hst % vars(v_ord), gt_plus // attrname, value)
192 enddo
193 else
194 call lookup_var_or_dim( hst, varname, var, err_not_found )
195 if ( .not. err_not_found ) then
196 call put_attr(var, attrname, value)
197 else
198 stat = nf90_enotvar
199 cause_c = 'varname="' // trim(varname) // '" is not found'
200 goto 999
201 endif
202 endif
203999 continue
204 call storeerror(stat, subname, err, cause_c=cause_c)
205 call endsub(subname)
206 end subroutine historyaddattrlogical0
207 subroutine historyaddattrint0( &
208 & varname, attrname, value, history, err)
209 !
210 !
213 use gtdata_generic, only: put_attr
214 use gtdata_types, only: gt_variable
215 use dc_string, only: tochar
216 use dc_url, only: gt_plus
217 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
218 use dc_message, only: messagenotify
219 use dc_trace, only: beginsub, endsub
220 use dc_types, only: string
221 implicit none
222 character(*), intent(in):: varname
223 character(*), intent(in):: attrname
224 integer, intent(in):: value
225 type(gt_history), intent(inout), target, optional:: history
226 logical, intent(out), optional:: err
227 type(gt_history), pointer:: hst =>null()
228 type(gt_variable):: var
229 integer:: v_ord
230 logical:: err_not_found
231 integer:: stat
232 character(STRING):: cause_c
233 character(len = *), parameter:: subname = "HistoryAddAttrInt0"
234 continue
235 call beginsub(subname, &
236 & 'varname=<%c> attrname=<%c>, value=<%c>', &
237 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
238 stat = dc_noerr
239 cause_c = ''
240 ! 操作対象決定
241 if (present(history)) then
242 hst => history
243 else
244 hst => default
245 endif
246 if (varname == "") then
247 ! とりあえず無駄だが大域属性を何度もつける
248 do, v_ord = 1, size(hst % vars)
249 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
250 enddo
251 else
252 call lookup_var_or_dim( hst, varname, var, err_not_found )
253 if ( .not. err_not_found ) then
254 call put_attr(var, attrname, (/value/))
255 else
256 stat = nf90_enotvar
257 cause_c = 'varname="' // trim(varname) // '" is not found'
258 goto 999
259 endif
260 endif
261999 continue
262 call storeerror(stat, subname, err, cause_c=cause_c)
263 call endsub(subname)
264 end subroutine historyaddattrint0
265 subroutine historyaddattrint1( &
266 & varname, attrname, value, history, err)
267 !
268 !
271 use gtdata_generic, only: put_attr
272 use gtdata_types, only: gt_variable
273 use dc_string, only: tochar
274 use dc_url, only: gt_plus
275 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
276 use dc_message, only: messagenotify
277 use dc_trace, only: beginsub, endsub
278 use dc_types, only: string
279 implicit none
280 character(*), intent(in):: varname
281 character(*), intent(in):: attrname
282 integer, intent(in):: value(:)
283 type(gt_history), intent(inout), target, optional:: history
284 logical, intent(out), optional:: err
285 type(gt_history), pointer:: hst =>null()
286 type(gt_variable):: var
287 integer:: v_ord
288 logical:: err_not_found
289 integer:: stat
290 character(STRING):: cause_c
291 character(len = *), parameter:: subname = "HistoryAddAttrInt1"
292 continue
293 call beginsub(subname, &
294 & 'varname=<%c> attrname=<%c>, value=<%c>', &
295 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
296 stat = dc_noerr
297 cause_c = ''
298 ! 操作対象決定
299 if (present(history)) then
300 hst => history
301 else
302 hst => default
303 endif
304 if (varname == "") then
305 ! とりあえず無駄だが大域属性を何度もつける
306 do, v_ord = 1, size(hst % vars)
307 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
308 enddo
309 else
310 call lookup_var_or_dim( hst, varname, var, err_not_found )
311 if ( .not. err_not_found ) then
312 call put_attr(var, attrname, (/value/))
313 else
314 stat = nf90_enotvar
315 cause_c = 'varname="' // trim(varname) // '" is not found'
316 goto 999
317 endif
318 endif
319999 continue
320 call storeerror(stat, subname, err, cause_c=cause_c)
321 call endsub(subname)
322 end subroutine historyaddattrint1
324 & varname, attrname, value, history, err)
325 !
326 !
329 use gtdata_generic, only: put_attr
330 use gtdata_types, only: gt_variable
331 use dc_string, only: tochar
332 use dc_url, only: gt_plus
333 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
334 use dc_message, only: messagenotify
335 use dc_trace, only: beginsub, endsub
336 use dc_types, only: string
337 implicit none
338 character(*), intent(in):: varname
339 character(*), intent(in):: attrname
340 real, intent(in):: value
341 type(gt_history), intent(inout), target, optional:: history
342 logical, intent(out), optional:: err
343 type(gt_history), pointer:: hst =>null()
344 type(gt_variable):: var
345 integer:: v_ord
346 logical:: err_not_found
347 integer:: stat
348 character(STRING):: cause_c
349 character(len = *), parameter:: subname = "HistoryAddAttrReal0"
350 continue
351 call beginsub(subname, &
352 & 'varname=<%c> attrname=<%c>, value=<%c>', &
353 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
354 stat = dc_noerr
355 cause_c = ''
356 ! 操作対象決定
357 if (present(history)) then
358 hst => history
359 else
360 hst => default
361 endif
362 if (varname == "") then
363 ! とりあえず無駄だが大域属性を何度もつける
364 do, v_ord = 1, size(hst % vars)
365 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
366 enddo
367 else
368 call lookup_var_or_dim( hst, varname, var, err_not_found )
369 if ( .not. err_not_found ) then
370 call put_attr(var, attrname, (/value/))
371 else
372 stat = nf90_enotvar
373 cause_c = 'varname="' // trim(varname) // '" is not found'
374 goto 999
375 endif
376 endif
377999 continue
378 call storeerror(stat, subname, err, cause_c=cause_c)
379 call endsub(subname)
380 end subroutine historyaddattrreal0
382 & varname, attrname, value, history, err)
383 !
384 !
387 use gtdata_generic, only: put_attr
388 use gtdata_types, only: gt_variable
389 use dc_string, only: tochar
390 use dc_url, only: gt_plus
391 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
392 use dc_message, only: messagenotify
393 use dc_trace, only: beginsub, endsub
394 use dc_types, only: string
395 implicit none
396 character(*), intent(in):: varname
397 character(*), intent(in):: attrname
398 real, intent(in):: value(:)
399 type(gt_history), intent(inout), target, optional:: history
400 logical, intent(out), optional:: err
401 type(gt_history), pointer:: hst =>null()
402 type(gt_variable):: var
403 integer:: v_ord
404 logical:: err_not_found
405 integer:: stat
406 character(STRING):: cause_c
407 character(len = *), parameter:: subname = "HistoryAddAttrReal1"
408 continue
409 call beginsub(subname, &
410 & 'varname=<%c> attrname=<%c>, value=<%c>', &
411 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
412 stat = dc_noerr
413 cause_c = ''
414 ! 操作対象決定
415 if (present(history)) then
416 hst => history
417 else
418 hst => default
419 endif
420 if (varname == "") then
421 ! とりあえず無駄だが大域属性を何度もつける
422 do, v_ord = 1, size(hst % vars)
423 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
424 enddo
425 else
426 call lookup_var_or_dim( hst, varname, var, err_not_found )
427 if ( .not. err_not_found ) then
428 call put_attr(var, attrname, (/value/))
429 else
430 stat = nf90_enotvar
431 cause_c = 'varname="' // trim(varname) // '" is not found'
432 goto 999
433 endif
434 endif
435999 continue
436 call storeerror(stat, subname, err, cause_c=cause_c)
437 call endsub(subname)
438 end subroutine historyaddattrreal1
440 & varname, attrname, value, history, err)
441 !
442 !
445 use gtdata_generic, only: put_attr
446 use gtdata_types, only: gt_variable
447 use dc_string, only: tochar
448 use dc_url, only: gt_plus
449 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
450 use dc_message, only: messagenotify
451 use dc_trace, only: beginsub, endsub
452 use dc_types, only: string, dp
453 implicit none
454 character(*), intent(in):: varname
455 character(*), intent(in):: attrname
456 real(DP), intent(in):: value
457 type(gt_history), intent(inout), target, optional:: history
458 logical, intent(out), optional:: err
459 type(gt_history), pointer:: hst =>null()
460 type(gt_variable):: var
461 integer:: v_ord
462 logical:: err_not_found
463 integer:: stat
464 character(STRING):: cause_c
465 character(len = *), parameter:: subname = "HistoryAddAttrDouble0"
466 continue
467 call beginsub(subname, &
468 & 'varname=<%c> attrname=<%c>, value=<%c>', &
469 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
470 stat = dc_noerr
471 cause_c = ''
472 ! 操作対象決定
473 if (present(history)) then
474 hst => history
475 else
476 hst => default
477 endif
478 if (varname == "") then
479 ! とりあえず無駄だが大域属性を何度もつける
480 do, v_ord = 1, size(hst % vars)
481 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
482 enddo
483 else
484 call lookup_var_or_dim( hst, varname, var, err_not_found )
485 if ( .not. err_not_found ) then
486 call put_attr(var, attrname, (/value/))
487 else
488 stat = nf90_enotvar
489 cause_c = 'varname="' // trim(varname) // '" is not found'
490 goto 999
491 endif
492 endif
493999 continue
494 call storeerror(stat, subname, err, cause_c=cause_c)
495 call endsub(subname)
496 end subroutine historyaddattrdouble0
498 & varname, attrname, value, history, err)
499 !
500 !
503 use gtdata_generic, only: put_attr
504 use gtdata_types, only: gt_variable
505 use dc_string, only: tochar
506 use dc_url, only: gt_plus
507 use dc_error, only: storeerror, dc_noerr, nf90_enotvar, hst_empinoaxisdata
508 use dc_message, only: messagenotify
509 use dc_trace, only: beginsub, endsub
510 use dc_types, only: string, dp
511 implicit none
512 character(*), intent(in):: varname
513 character(*), intent(in):: attrname
514 real(DP), intent(in):: value(:)
515 type(gt_history), intent(inout), target, optional:: history
516 logical, intent(out), optional:: err
517 type(gt_history), pointer:: hst =>null()
518 type(gt_variable):: var
519 integer:: v_ord
520 logical:: err_not_found
521 integer:: stat
522 character(STRING):: cause_c
523 character(len = *), parameter:: subname = "HistoryAddAttrDouble1"
524 continue
525 call beginsub(subname, &
526 & 'varname=<%c> attrname=<%c>, value=<%c>', &
527 & c1=trim(varname), c2=trim(attrname), c3=trim(tochar(value)))
528 stat = dc_noerr
529 cause_c = ''
530 ! 操作対象決定
531 if (present(history)) then
532 hst => history
533 else
534 hst => default
535 endif
536 if (varname == "") then
537 ! とりあえず無駄だが大域属性を何度もつける
538 do, v_ord = 1, size(hst % vars)
539 call put_attr(hst % vars(v_ord), gt_plus // attrname, (/value/))
540 enddo
541 else
542 call lookup_var_or_dim( hst, varname, var, err_not_found )
543 if ( .not. err_not_found ) then
544 call put_attr(var, attrname, (/value/))
545 else
546 stat = nf90_enotvar
547 cause_c = 'varname="' // trim(varname) // '" is not found'
548 goto 999
549 endif
550 endif
551999 continue
552 call storeerror(stat, subname, err, cause_c=cause_c)
553 call endsub(subname)
554 end subroutine historyaddattrdouble1
555!--
556! vi:set readonly sw=4 ts=8:
557!
558!Local Variables:
559!mode: f90
560!buffer-read-only: t
561!End:
562!
563!++
subroutine historyaddattrreal0(varname, attrname, value, history, err)
subroutine historyaddattrdouble1(varname, attrname, value, history, err)
subroutine historyaddattrlogical0(varname, attrname, value, history, err)
subroutine historyaddattrchar0(varname, attrname, value, history, err)
gtool4 データ内の変数への属性付加
subroutine historyaddattrint0(varname, attrname, value, history, err)
subroutine historyaddattrdouble0(varname, attrname, value, history, err)
subroutine historyaddattrreal1(varname, attrname, value, history, err)
subroutine historyaddattrint1(varname, attrname, value, history, err)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public hst_empinoaxisdata
Definition dc_error.f90:574
Message output module.
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
Variable URL string parser.
Definition dc_url.f90:61
character, parameter, public gt_plus
Definition dc_url.f90:109
type(gt_history), target, save, public default