get_coordinate_info Subroutine

public subroutine get_coordinate_info(this, coordinate_name, coordSize, coordUnits, long_name, standard_name, coords, coordinate_attr, rc)

Type Bound

FileMetadataUtils

Arguments

Type IntentOptional Attributes Name
class(FileMetadataUtils), intent(inout) :: this
character(len=*), intent(in) :: coordinate_name
integer, intent(out), optional :: coordSize
character(len=*), intent(out), optional :: coordUnits
character(len=*), intent(out), optional :: long_name
character(len=*), intent(out), optional :: standard_name
real, intent(inout), optional, allocatable :: coords(:)
character(len=*), intent(out), optional :: coordinate_attr
integer, intent(out), optional :: rc

Calls

proc~~get_coordinate_info~~CallsGraph proc~get_coordinate_info FileMetadataUtils%get_coordinate_info interface~mapl_assert MAPL_Assert proc~get_coordinate_info->interface~mapl_assert none~get_attribute Variable%get_attribute proc~get_coordinate_info->none~get_attribute none~get_coordinate_data CoordinateVariable%get_coordinate_data proc~get_coordinate_info->none~get_coordinate_data none~get_coordinate_variable FileMetadata%get_coordinate_variable proc~get_coordinate_info->none~get_coordinate_variable none~get_dimension FileMetadata%get_dimension proc~get_coordinate_info->none~get_dimension none~get_ith_dimension Variable%get_ith_dimension proc~get_coordinate_info->none~get_ith_dimension none~get_value UnlimitedEntity%get_value proc~get_coordinate_info->none~get_value proc~get_file_name FileMetadataUtils%get_file_name proc~get_coordinate_info->proc~get_file_name proc~mapl_return MAPL_Return proc~get_coordinate_info->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_coordinate_info->proc~mapl_verify proc~var_has_attr FileMetadataUtils%var_has_attr proc~get_coordinate_info->proc~var_has_attr none~get_attribute->interface~mapl_assert none~get_attribute->proc~mapl_return none~at~226 StringAttributeMap%at none~get_attribute->none~at~226 none~get_coordinate_data->proc~mapl_return none~get_coordinate_variable->interface~mapl_assert none~get_coordinate_variable->proc~mapl_return none~at~139 StringVariableMap%at none~get_coordinate_variable->none~at~139 none~get_dimension->proc~mapl_return at at none~get_dimension->at find find none~get_dimension->find none~get_ith_dimension->proc~mapl_return none~get_ith_dimension->at none~get_value->proc~mapl_return proc~get_file_name->proc~mapl_return proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception proc~var_has_attr->interface~mapl_assert proc~var_has_attr->proc~get_file_name proc~var_has_attr->proc~mapl_return proc~var_has_attr->proc~mapl_verify none~get_variable FileMetadata%get_variable proc~var_has_attr->none~get_variable none~is_attribute_present Variable%is_attribute_present proc~var_has_attr->none~is_attribute_present none~find~35 StringVariableMap%find none~at~139->none~find~35 none~find~59 StringAttributeMap%find none~at~226->none~find~59 none~get_variable->proc~mapl_return none~get_variable->none~at~139 none~is_attribute_present->proc~mapl_return none~is_attribute_present->none~at~226

Called by

proc~~get_coordinate_info~~CalledByGraph proc~get_coordinate_info FileMetadataUtils%get_coordinate_info proc~get_file_levels get_file_levels proc~get_file_levels->proc~get_coordinate_info proc~get_file_levels~2 get_file_levels proc~get_file_levels~2->proc~get_coordinate_info proc~get_time_info FileMetadataUtils%get_time_info proc~get_time_info->proc~get_coordinate_info program~time_ave time_ave program~time_ave->proc~get_coordinate_info program~time_ave->proc~get_file_levels proc~get_file_times get_file_times program~time_ave->proc~get_file_times proc~mapl_read_bundle MAPL_read_bundle program~time_ave->proc~mapl_read_bundle none~detect_metadata ExtDataFileStream%detect_metadata none~detect_metadata->proc~get_time_info proc~get_file_times->proc~get_time_info proc~get_file_times~2 get_file_times proc~get_file_times~2->proc~get_time_info proc~main~2 main proc~main~2->proc~get_file_levels~2 proc~main~2->proc~get_file_times~2 proc~main~2->proc~mapl_read_bundle proc~mapl_read_bundle->proc~get_time_info proc~run_component_driver run_component_driver proc~run_component_driver->proc~get_time_info proc~fillin_primary ExtDataOldTypesCreator%fillin_primary proc~fillin_primary->none~detect_metadata proc~main main proc~main->proc~run_component_driver program~regrid_util Regrid_Util program~regrid_util->proc~main~2 program~ut_regridding ut_ReGridding program~ut_regridding->proc~mapl_read_bundle program~comp_testing_driver comp_testing_driver program~comp_testing_driver->proc~main

Source Code

   subroutine get_coordinate_info(this,coordinate_name,coordSize,coordUnits,long_name,standard_name,coords,coordinate_attr,rc)
      class (FileMetadataUtils), intent(inout) :: this
      character(len=*), intent(in) :: coordinate_name
      integer, optional, intent(out) :: coordSize
      character(len=*), optional, intent(out) :: coordUnits
      character(len=*), optional, intent(out) :: long_name
      character(len=*), optional, intent(out) :: standard_name
      character(len=*), optional, intent(out) :: coordinate_attr
      real, allocatable, optional,  intent(inout) :: coords(:)
      integer, optional, intent(out) :: rc

      integer :: status
      character(:), allocatable :: fname
      class(CoordinateVariable), pointer :: var
      type(Attribute), pointer :: attr
      character(len=:), pointer :: vdim
      class(*), pointer :: coordUnitPtr
      class(*), pointer :: ptr(:)
 
      fname = this%get_file_name(_RC)
      var => this%get_coordinate_variable(trim(coordinate_name),rc=status)
      _VERIFY(status)
   
      if (present(coordSize)) then
         vdim => var%get_ith_dimension(1)
         coordSize = this%get_dimension(vdim,rc=status)
      end if

      if (present(coordUnits)) then
         attr => var%get_attribute('units')
         coordUnitPtr => attr%get_value()
         select type(coordUnitPtr)
         type is (character(*))
            coordUnits = trim(coordUnitPtr)
         class default
            _FAIL(trim(coordinate_name)//' units must be string in '//fname)
         end select
      end if 

      if (present(long_name)) then
         if (this%var_has_attr(coordinate_name,"long_name")) then
            attr => var%get_attribute('long_name')
            coordUnitPtr => attr%get_value()
            select type(coordUnitPtr)
            type is (character(*))
               long_name = trim(coordUnitPtr)
            class default
               _FAIL(trim(coordinate_name)//' long_name must be string in '//fname)
            end select
         else
             long_name = 'not found'
         endif
      end if 

      if (present(standard_name)) then
         if (this%var_has_attr(coordinate_name,"standard_name")) then
            attr => var%get_attribute('standard_name')
            coordUnitPtr => attr%get_value()
            select type(coordUnitPtr)
            type is (character(*))
               standard_name = trim(coordUnitPtr)
            class default
               _FAIL(trim(coordinate_name)//' standard_name must be string in '//fname)
            end select
         else
             standard_name = 'not found'
         endif
      end if 

      if (present(coordinate_attr)) then
         if (this%var_has_attr(coordinate_name,"coordinate")) then
            attr => var%get_attribute('coordinate')
            coordUnitPtr => attr%get_value()
            select type(coordUnitPtr)
            type is (character(*))
               coordinate_attr = trim(coordUnitPtr)
            class default
               _FAIL(trim(coordinate_name)//' name must be string in '//fname)
            end select
         else
             coordinate_attr = 'not found'
         endif
      end if 

      if (present(coords)) then
         ptr => var%get_coordinate_data()
         _ASSERT(associated(ptr),"coord variable coordinate data not found in "//fname)
         select type (ptr)
         type is (real(kind=REAL64))
            coords=ptr
         type is (real(kind=REAL32))
            coords=ptr
         type is (integer(kind=INT64))
            coords=ptr
         type is (integer(kind=INT32))
            coords=ptr
         class default
            _FAIL("unsupported coordinate variable type in "//fname)
         end select
      end if
      _RETURN(_SUCCESS)

   end subroutine get_coordinate_info