gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gtvarattrsearch.f90
Go to the documentation of this file.
1!> @file gtvarattrsearch.f90
2!>
3!> @author Eizi TOYODA, Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Variable attribute retrieval
9!>
10!> These subroutines are provided through gtdata_generic.
11!> @enden
12!>
13!> @ja
14!> @brief 変数の属性取得
15!>
16!> これらのサブルーチンは gtdata_generic から提供されます。
17!> @endja
18!>
19
20!>
21!> @en
22!> @brief Get attribute list from variable (initialization)
23!>
24!> Subroutine used to get a list of attribute names from var.
25!> You can get the attribute list using this subroutine and Attr_Next.
26!>
27!> To enumerate all attributes for a variable var, first call
28!> Attr_Rewind, then call Attr_Next. The first call returns the
29!> first attribute, the next call returns the next attribute name.
30!> After the last attribute, end == .true..
31!>
32!> Example:
33!> @code
34!> use gtool5
35!> type(GT_VARIABLE):: var
36!> character(len = STRING):: attrname
37!> logical:: end
38!>
39!> call Attr_Rewind(var)
40!> do
41!> call Attr_Next(var, attrname, end)
42!> if (end) exit
43!> write(*,*) trim(attrname)
44!> enddo
45!> @endcode
46!> @param[inout] var Variable handle
47!> @enden
48!>
49!> @ja
50!> @brief 変数からの属性リスト取得 (初期化用)
51!>
52!> var から属性名のリストを取得するために利用するサブルーチンです。
53!> このサブルーチンと Attr_Next によって属性リスト一覧を取得できます。
54!>
55!> ある変数 var について全ての属性を列挙するためには、まず
56!> Attr_Rewind を呼んだ後、Attr_Next を呼びます。最初の呼び出しで
57!> 最初の属性が、次の呼び出しで次の属性の名前が得られます。最後の
58!> 属性のあとでは end == .true. となります。
59!> @param[inout] var 変数ハンドル
60!> @endja
61!>
62subroutine gtvarattrrewind(var)
63 use gtdata_types, only: gt_variable
64 use gtdata_internal_map, only: var_class, vtb_class_netcdf
67 implicit none
68 type(gt_variable), intent(inout), target:: var
69 integer:: class, cid
70continue
71 call var_class(var, class, cid)
72 select case(class)
73 case(vtb_class_netcdf)
75 end select
76end subroutine gtvarattrrewind
77
78!>
79!> @en
80!> @brief Get attribute list from variable (get next)
81!>
82!> See Attr_Rewind.
83!> @param[inout] var Variable handle
84!> @param[out] name Attribute name
85!> @param[out] end .true. when all attributes have been enumerated (optional)
86!> @enden
87!>
88!> @ja
89!> @brief 変数からの属性リスト取得 (次を取得)
90!>
91!> Attr_Rewind を参照してください。
92!> @param[inout] var 変数ハンドル
93!> @param[out] name 属性名
94!> @param[out] end すべての属性を列挙し終えたとき .true. (省略可能)
95!> @endja
96!>
97subroutine gtvarattrnext(var, name, end)
98 use gtdata_types, only: gt_variable
99 use gtdata_internal_map, only: var_class, vtb_class_netcdf
102 implicit none
103 type(gt_variable), intent(inout), target:: var
104 character(len = *), intent(out):: name
105 logical, intent(out), optional:: end
106 integer:: class, cid
107continue
108 call var_class(var, class, cid)
109 select case(class)
110 case(vtb_class_netcdf)
111 call attr_next(gd_nc_variable(cid), name, end)
112 end select
113end subroutine gtvarattrnext
subroutine gtvarattrrewind(var)
subroutine gtvarattrnext(var, name, end)
subroutine, public var_class(var, class, cid)