gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gtvarattrtrue.f90
Go to the documentation of this file.
1!> @file gtvarattrtrue.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 Logical type attribute input
9!>
10!> This function is 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 as logical value
23!>
24!> Returns the value of attribute name attached to variable var.
25!> Can only be used when the attribute value is a logical type attribute.
26!>
27!> Returns .false. in the following cases:
28!> - Attribute value is character type and one of "", "0", "0.0", "0.",
29!> ".0", "FALSE", "false", ".FALSE.", ".false.", "F", "f", "0.0D0", "0.0d0"
30!> - Attribute value is a negative real number
31!>
32!> If the attribute value cannot be retrieved normally and default
33!> is provided, that value is returned. If default is not provided,
34!> .false. is returned.
35!> @param[in] var Variable handle
36!> @param[in] name Attribute name
37!> @param[in] default Default value (optional)
38!> @return Logical attribute value
39!> @enden
40!>
41!> @ja
42!> @brief 属性を論理値として取得
43!>
44!> 変数 var に付加されている属性 name の値を返します。
45!> 属性値が論理型属性の場合のみ用いることが出来ます。
46!>
47!> 以下の場合には .false. が返ります。
48!> - 属性の値が文字型で "", "0", "0.0", "0.", ".0", "FALSE",
49!> "false", ".FALSE.", ".false.", "F", "f", "0.0D0", "0.0d0"
50!> のいづれかであった場合
51!> - 属性の値が負の実数であった場合
52!>
53!> 属性の値が正常に取得できず、且つ default が与えられて
54!> いた場合、その値が返ります。default が与えられていなかった
55!> 場合には .false. が返ります。
56!> @param[in] var 変数ハンドル
57!> @param[in] name 属性名
58!> @param[in] default デフォルト値 (省略可能)
59!> @return 論理属性値
60!> @endja
61!>
62logical function gtvarattrtrue(var, name, default) result(result)
63 use gtdata_types, only: gt_variable
64 use gtdata_internal_map, only: var_class, vtb_class_netcdf
68 implicit none
69 type(gt_variable), intent(in):: var
70 character(len = *), intent(in):: name
71 logical, intent(in), optional:: default
72 integer:: class, cid
73continue
74 call var_class(var, class, cid)
75 if (class == vtb_class_netcdf) then
76 call get_attr(gd_nc_variable(cid), name, result, default)
77 else
78 call storeerror(gt_enotvar, "GTVarAttrTrue(NO VARIABLE)")
79 result = .false.
80 endif
81end function gtvarattrtrue
logical function gtvarattrtrue(var, name, default)
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public gt_enotvar
Definition dc_error.f90:512
subroutine, public var_class(var, class, cid)