make_LatAxis_from_hconfig.F90 Source File


This file depends on

sourcefile~~make_lataxis_from_hconfig.f90~~EfferentGraph sourcefile~make_lataxis_from_hconfig.f90 make_LatAxis_from_hconfig.F90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~make_lataxis_from_hconfig.f90->sourcefile~errorhandling.f90 sourcefile~lataxis.f90 LatAxis.F90 sourcefile~make_lataxis_from_hconfig.f90->sourcefile~lataxis.f90 sourcefile~mapl_range.f90 MAPL_Range.F90 sourcefile~make_lataxis_from_hconfig.f90->sourcefile~mapl_range.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~coordinateaxis.f90 CoordinateAxis.F90 sourcefile~lataxis.f90->sourcefile~coordinateaxis.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~lataxis.f90->sourcefile~pfio.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~mapl_range.f90->sourcefile~mapl_exceptionhandling.f90

Source Code

#include "MAPL_ErrLog.h"

submodule (mapl3g_LatAxis) make_LatAxis_from_hconfig_smod
   use mapl_RangeMod
!   use hconfig3g
   use esmf
   use mapl_ErrorHandling
   implicit none (type, external)

   integer, parameter :: R8 = ESMF_KIND_R8

contains

   ! static factory methods
   module function make_LatAxis_from_hconfig(hconfig, rc) result(axis)
      type(LatAxis) :: axis
      type(ESMF_HConfig), intent(in) :: hconfig
      integer, optional, intent(out) :: rc

      integer :: status
      integer :: jm_world
      real(kind=R8), allocatable :: centers(:), corners(:)
      type(AxisRanges) :: ranges
      logical :: found

      jm_world = ESMF_HConfigAsI4(hconfig, keyString='jm_world', asOkay=found, _RC)
      _ASSERT(found, '"jm_world" not found.')
      _ASSERT(jm_world > 0, 'jm_world must be greater than 1')

      ranges = get_lat_range(hconfig, jm_world, _RC)
      centers = MAPL_Range(ranges%center_min, ranges%center_max, jm_world, _RC)

      corners = MAPL_Range(ranges%corner_min, ranges%corner_max, jm_world+1, _RC)
      ! IMPORTANT: this fix must be _after the call to MAPL_Range.
      if (corners(1) < -90.d0) corners(1) = -90.0d0
      if (corners(jm_world+1) > 90.d0) corners(jm_world+1) = 90.0d0

      axis%CoordinateAxis = CoordinateAxis(centers, corners)

      _RETURN(_SUCCESS)
   end function make_LatAxis_from_hconfig

end submodule make_LatAxis_from_hconfig_smod