test_cartesian_to_spherical_Y Subroutine

public subroutine test_cartesian_to_spherical_Y(this)

Arguments

Type IntentOptional Attributes Name
class(ESMF_TestMethod), intent(inout) :: this

Calls

proc~~test_cartesian_to_spherical_y~~CallsGraph proc~test_cartesian_to_spherical_y test_cartesian_to_spherical_Y assertequal assertequal proc~test_cartesian_to_spherical_y->assertequal none~cartesian_to_spherical~5 LatLonGridFactory%cartesian_to_spherical proc~test_cartesian_to_spherical_y->none~cartesian_to_spherical~5 none~get_latitudes LatLonGridFactory%get_latitudes proc~test_cartesian_to_spherical_y->none~get_latitudes none~get_longitudes LatLonGridFactory%get_longitudes proc~test_cartesian_to_spherical_y->none~get_longitudes none~make_grid AbstractGridFactory%make_grid proc~test_cartesian_to_spherical_y->none~make_grid none~cartesian_to_spherical_3d_real64 AbstractGridFactory%cartesian_to_spherical_3d_real64 none~cartesian_to_spherical~5->none~cartesian_to_spherical_3d_real64 proc~mapl_return MAPL_Return none~get_latitudes->proc~mapl_return none~get_longitudes->proc~mapl_return make_new_grid make_new_grid none~make_grid->make_new_grid none~make_grid->proc~mapl_return proc~mapl_verify MAPL_Verify none~make_grid->proc~mapl_verify none~cartesian_to_spherical_3d_real64->proc~mapl_return none~cartesian_to_spherical_3d_real64->proc~mapl_verify interface~mapl_assert MAPL_Assert none~cartesian_to_spherical_3d_real64->interface~mapl_assert none~get_basis AbstractGridFactory%get_basis none~cartesian_to_spherical_3d_real64->none~get_basis 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 proc~mapl_verify->proc~mapl_throw_exception none~get_basis->proc~mapl_return none~get_basis->proc~mapl_verify none~get_basis->interface~mapl_assert ESMF_GridGetCoord ESMF_GridGetCoord none~get_basis->ESMF_GridGetCoord interface~mapl_gridgetcorners MAPL_GridGetCorners none~get_basis->interface~mapl_gridgetcorners proc~mapl_gridget MAPL_GridGet none~get_basis->proc~mapl_gridget

Source Code

   subroutine test_cartesian_to_spherical_Y(this)
      class (ESMF_TestMethod), intent(inout) :: this
      type (LatLonGridFactory) :: factory
      real, allocatable :: u(:,:)
      real, allocatable :: v(:,:)
      real, allocatable :: xyz(:,:,:,:)
      real, allocatable :: longitudes(:)
      real, allocatable :: latitudes(:)

      integer, parameter :: IM=12, JM=6
      type (ESMF_Grid) :: grid
      integer :: status

      _UNUSED_DUMMY(this)

      factory = LatLonGridFactory(im_world=IM, jm_world=JM, lm=1, nx=1, ny=1, pole='PE', dateline='GC')
      grid = factory%make_grid()

      allocate(u(IM,JM))
      allocate(v(IM,JM))
      allocate(xyz(3,1,IM,JM))

      XYZ(1,1,:,:) = 0
      XYZ(2,1,:,:) = 1
      XYZ(3,1,:,:) = 0

      call factory%cartesian_to_spherical(xyz, u, v, basis='north-south',rc=status)
      @assertEqual(0,status)

      ! Note: longitudes return as REAL64.
      longitudes = real(factory%get_longitudes())
      latitudes = real(factory%get_latitudes())
      do j = 1, JM
         @assertEqual(+cos(longitudes), u(:,j), 10*epsilon(1.))
         @assertEqual(-sin(longitudes)*sin(latitudes(j)), v(:,j), 10*epsilon(1.))
      end do

   end subroutine test_cartesian_to_spherical_Y