get_level_name Function

public function get_level_name(this, rc) result(lev_name)

Type Bound

FileMetadataUtils

Arguments

Type IntentOptional Attributes Name
class(FileMetadataUtils), intent(inout), target :: this
integer, intent(out), optional :: rc

Return Value character(len=:), allocatable


Calls

proc~~get_level_name~~CallsGraph proc~get_level_name FileMetadataUtils%get_level_name none~begin~2 StringVariableMap%begin proc~get_level_name->none~begin~2 none~get_coordinate_variable FileMetadata%get_coordinate_variable proc~get_level_name->none~get_coordinate_variable none~get_variables FileMetadata%get_variables proc~get_level_name->none~get_variables none~is_attribute_present Variable%is_attribute_present proc~get_level_name->none~is_attribute_present none~key~2 StringVariableMapIterator%key proc~get_level_name->none~key~2 none~next~2 StringVariableMapIterator%next proc~get_level_name->none~next~2 proc~get_variable_attribute FileMetadataUtils%get_variable_attribute proc~get_level_name->proc~get_variable_attribute proc~mapl_return MAPL_Return proc~get_level_name->proc~mapl_return none~get_coordinate_variable->proc~mapl_return interface~mapl_assert MAPL_Assert none~get_coordinate_variable->interface~mapl_assert none~at~5 StringVariableMap%at none~get_coordinate_variable->none~at~5 none~get_variables->proc~mapl_return none~is_attribute_present->proc~mapl_return none~at~140 StringAttributeMap%at none~is_attribute_present->none~at~140 proc~get_variable_attribute->none~is_attribute_present proc~get_variable_attribute->proc~mapl_return proc~get_variable_attribute->interface~mapl_assert none~get_attribute Variable%get_attribute proc~get_variable_attribute->none~get_attribute none~get_value UnlimitedEntity%get_value proc~get_variable_attribute->none~get_value none~get_variable FileMetadata%get_variable proc~get_variable_attribute->none~get_variable proc~get_file_name FileMetadataUtils%get_file_name proc~get_variable_attribute->proc~get_file_name proc~mapl_verify MAPL_Verify proc~get_variable_attribute->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception none~find~39 StringAttributeMap%find none~at~140->none~find~39 none~find~2 StringVariableMap%find none~at~5->none~find~2 none~get_attribute->proc~mapl_return none~get_attribute->interface~mapl_assert none~get_attribute->none~at~140 none~get_value->proc~mapl_return none~get_variable->proc~mapl_return none~get_variable->none~at~5 proc~get_file_name->proc~mapl_return proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~get_level_name~~CalledByGraph proc~get_level_name FileMetadataUtils%get_level_name proc~create_grid regrid_support%create_grid proc~create_grid->proc~get_level_name proc~get_file_levels get_file_levels proc~get_file_levels->proc~get_level_name proc~get_file_levels~2 get_file_levels proc~get_file_levels~2->proc~get_level_name proc~mapl_create_bundle_from_metdata_id MAPL_create_bundle_from_metdata_id proc~mapl_create_bundle_from_metdata_id->proc~get_level_name program~time_ave time_ave program~time_ave->proc~get_level_name program~time_ave->proc~get_file_levels~2 proc~mapl_read_bundle MAPL_read_bundle program~time_ave->proc~mapl_read_bundle proc~main main proc~main->proc~get_file_levels proc~main->proc~mapl_read_bundle proc~process_command_line~2 regrid_support%process_command_line proc~main->proc~process_command_line~2 proc~mapl_read_bundle->proc~mapl_create_bundle_from_metdata_id proc~process_command_line~2->proc~create_grid program~regrid_util Regrid_Util program~regrid_util->proc~main program~ut_regridding ut_ReGridding program~ut_regridding->proc~mapl_read_bundle

Source Code

   function get_level_name(this,rc) result(lev_name)
      class (FileMetadataUtils), target, intent(inout) :: this
      integer, optional, intent(out) :: rc

      character(len=:), pointer :: units
      character(len=:), allocatable :: lev_name
      type(CoordinateVariable), pointer :: var
      type (StringVariableMap), pointer :: vars
      type (StringVariableMapIterator) :: var_iter
      character(len=:), pointer :: var_name
      
      vars => this%get_variables()
      var_iter = vars%begin()
      do while(var_iter /=vars%end())
         var_name => var_iter%key()
         var => this%get_coordinate_variable(trim(var_name))
         if (associated(var)) then
            if (index(var_name,'lev') .ne. 0 .or. index(var_name,'height') .ne. 0) then
               lev_name=var_name
               _RETURN(_SUCCESS)
            else
               if (var%is_attribute_present('units')) then
               units => this%get_variable_attribute(var_name,'units')
                  if (trim(units) .eq. 'hPa' .or. trim(units) .eq. 'sigma_level' .or. &
                      trim(units) .eq. 'mb'  .or. trim(units) .eq. 'millibar') then
                     lev_name=var_name
                     _RETURN(_SUCCESS)
                  end if
               end if
            end if
         end if
         call var_iter%next()
      enddo
      lev_name=''
      _RETURN(_SUCCESS)

   end function get_level_name