Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(FileMetadataUtils), | intent(inout) | :: | this | |||
character(len=*), | intent(in) | :: | var_name | |||
character(len=*), | intent(in) | :: | attr_name | |||
integer, | intent(out), | optional | :: | rc |
function get_var_attr_real32(this,var_name,attr_name,rc) result(attr_real32) real(REAL32) :: attr_real32 class(FileMetadataUtils), intent(inout) :: this character(len=*), intent(in) :: var_name character(len=*), intent(in) :: attr_name integer, optional, intent(out) :: rc real(REAL32) :: tmp(1) real(REAL64) :: tmpd(1) integer :: status character(:), allocatable :: fname type(Attribute), pointer :: attr type(Variable), pointer :: var class(*), pointer :: attr_val(:) fname = this%get_file_name(_RC) var => this%get_variable(var_name,_RC) _ASSERT(associated(var),"no variable named "//var_name//" in "//fname) attr => var%get_attribute(attr_name,_RC) _ASSERT(associated(attr),"no attribute named "//attr_name//" in "//var_name//" in "//fname) attr_val => attr%get_values() select type(attr_val) type is(real(kind=REAL32)) tmp = attr_val attr_real32 = tmp(1) type is(real(kind=REAL64)) tmpd = attr_val attr_real32 = REAL(tmpd(1)) class default _FAIL('unsupported subclass (not real32) for units of attribute named '//attr_name//' in '//var_name//' in '//fname) end select _RETURN(_SUCCESS) end function get_var_attr_real32