get_lon_subset.F90 Source File


This file depends on

sourcefile~~get_lon_subset.f90~~EfferentGraph sourcefile~get_lon_subset.f90 get_lon_subset.F90 sourcefile~base_base.f90 Base_Base.F90 sourcefile~get_lon_subset.f90->sourcefile~base_base.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~get_lon_subset.f90->sourcefile~errorhandling.f90 sourcefile~latlondecomposition.f90 LatLonDecomposition.F90 sourcefile~get_lon_subset.f90->sourcefile~latlondecomposition.f90 sourcefile~constants.f90 Constants.F90 sourcefile~base_base.f90->sourcefile~constants.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~base_base.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_range.f90 MAPL_Range.F90 sourcefile~base_base.f90->sourcefile~mapl_range.f90 sourcefile~maplgrid.f90 MaplGrid.F90 sourcefile~base_base.f90->sourcefile~maplgrid.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~latlondecomposition.f90->sourcefile~base_base.f90 sourcefile~latlondecomposition.f90->sourcefile~keywordenforcer.f90 sourcefile~lataxis.f90 LatAxis.F90 sourcefile~latlondecomposition.f90->sourcefile~lataxis.f90 sourcefile~lonaxis.f90 LonAxis.F90 sourcefile~latlondecomposition.f90->sourcefile~lonaxis.f90 sourcefile~internalconstants.f90 InternalConstants.F90 sourcefile~constants.f90->sourcefile~internalconstants.f90 sourcefile~mathconstants.f90 MathConstants.F90 sourcefile~constants.f90->sourcefile~mathconstants.f90 sourcefile~physicalconstants.f90 PhysicalConstants.F90 sourcefile~constants.f90->sourcefile~physicalconstants.f90 sourcefile~coordinateaxis.f90 CoordinateAxis.F90 sourcefile~lataxis.f90->sourcefile~coordinateaxis.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~lataxis.f90->sourcefile~pfio.f90 sourcefile~lonaxis.f90->sourcefile~coordinateaxis.f90 sourcefile~lonaxis.f90->sourcefile~pfio.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~mapl_range.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~maplgrid.f90->sourcefile~errorhandling.f90 sourcefile~maplgrid.f90->sourcefile~constants.f90 sourcefile~maplgrid.f90->sourcefile~keywordenforcer.f90 sourcefile~mapl_sort.f90 MAPL_Sort.F90 sourcefile~maplgrid.f90->sourcefile~mapl_sort.f90 sourcefile~pflogger_stub.f90 pflogger_stub.F90 sourcefile~maplgrid.f90->sourcefile~pflogger_stub.f90

Source Code

#include "MAPL_ErrLog.h"

submodule (mapl3g_LatLonDecomposition) get_lon_subset_smod
   use mapl_ErrorHandlingMod
   use MAPL_Base
   implicit none (type, external)

contains

   pure module function get_lon_subset(this, axis, rank) result(local_axis)
      type(LonAxis) :: local_axis
      class(LatLonDecomposition), intent(in) :: this
      type(LonAxis), intent(in) :: axis
      integer, intent(in) :: rank

      real(kind=R8), allocatable :: centers(:)
      real(kind=R8), allocatable :: corners(:)

      integer :: i_0, i_1, i_n

      call get_idx_range(this%lon_distribution, rank, i_0, i_1)
      i_n = i_1 ! unless

      associate (nx => size(this%get_lon_distribution()))
        if (.not. axis%is_periodic() .and. (1+rank == nx)) then
           i_n = i_n + 1
        end if
      end associate
      
      centers = get_subset(axis%get_centers(), i_0, i_1)
      corners = get_subset(axis%get_corners(), i_0, i_n)
         
      local_axis = LonAxis(centers, corners)

   end function get_lon_subset

end submodule get_lon_subset_smod