gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gtvarattrtrue.f90 File Reference

Logical type attribute input. More...

Go to the source code of this file.

Functions/Subroutines

logical function gtvarattrtrue (var, name, default)

Detailed Description

Logical type attribute input.

Author
Eizi TOYODA, Yasuhiro MORIKAWA

This function is provided through gtdata_generic.

Definition in file gtvarattrtrue.f90.

Function/Subroutine Documentation

◆ gtvarattrtrue()

logical function gtvarattrtrue ( type(gt_variable), intent(in) var,
character(len = *), intent(in) name,
logical, intent(in), optional default )

Get attribute as logical value

Returns the value of attribute name attached to variable var. Can only be used when the attribute value is a logical type attribute.

Returns .false. in the following cases:

  • Attribute value is character type and one of "", "0", "0.0", "0.", ".0", "FALSE", "false", ".FALSE.", ".false.", "F", "f", "0.0D0", "0.0d0"
  • Attribute value is a negative real number

If the attribute value cannot be retrieved normally and default is provided, that value is returned. If default is not provided, .false. is returned.

Parameters
[in]varVariable handle
[in]nameAttribute name
[in]defaultDefault value (optional)
Returns
Logical attribute value

Definition at line 62 of file gtvarattrtrue.f90.

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
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 gt_enotvar
Definition dc_error.f90:512
subroutine, public var_class(var, class, cid)

References dc_error::gt_enotvar, dc_error::storeerror(), and gtdata_internal_map::var_class().

Here is the call graph for this function: