Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Test_LatLonCorners), | intent(inout) | :: | this |
subroutine test_corners(this) class (Test_LatLonCorners), intent(inout) :: this integer :: status integer, parameter :: SUCCESS = 0 real(ESMF_KIND_R8), pointer :: corners(:,:) integer :: petX, petY integer :: i_1, i_n, j_1, j_n select type (p => this%testParameter) type is (GridCase) petX = mod(this%getLocalPET(), p%nx) petY = this%getLocalPET() / p%nx @mpiAssertTrue(petX >= 0) @mpiAssertTrue(petX < size(p%ims)) @mpiAssertTrue(petY >= 0) @mpiAssertTrue(petY < size(p%jms)) i_1 = 1 + sum(p%ims(:petX)) i_n = sum(p%ims(:petX+1)) if (p%dateline == 'XY') then if (petX+1 == size(p%ims)) i_n = i_n + 1 end if j_1 = 1 + sum(p%jms(:petY)) j_n = sum(p%jms(:petY+1)) if (petY+1==size(p%jms)) j_n=j_n+1 end select ! X call ESMF_GridGetCoord(this%grid, coordDim=1, staggerLoc=ESMF_STAGGERLOC_CORNER, & & farrayPtr=corners, rc=status) @mpiAssertTrue(status==SUCCESS, message='Failed to get grid x corners.') select type (p => this%testparameter) type is (GridCase) @mpiAssertEqual(p%lons(i_1:i_n), corners(:,1)*MAPL_RADIANS_TO_DEGREES, message='Wrong corners X.', tolerance=1.d-5) end select ! Y call ESMF_GridGetCoord(this%grid, coordDim=2, staggerLoc=ESMF_STAGGERLOC_CORNER, & & farrayPtr=corners, rc=status) @mpiAssertTrue(status==SUCCESS, message='Failed to geet grid x corners.') select type (p => this%testparameter) type is (GridCase) @mpiAssertEqual(p%lats(j_1:j_n), corners(1,:)*MAPL_RADIANS_TO_DEGREES, message='Wrong corners Y.', tolerance=1.d-5) end select end subroutine test_corners