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