diff --git a/sorc/orog_mask_tools.fd/orog.fd/orog_utils.F90 b/sorc/orog_mask_tools.fd/orog.fd/orog_utils.F90 index cae1f2bec..363dfe95f 100644 --- a/sorc/orog_mask_tools.fd/orog.fd/orog_utils.F90 +++ b/sorc/orog_mask_tools.fd/orog.fd/orog_utils.F90 @@ -699,7 +699,8 @@ end subroutine remove_isolated_pts !! @param[in] jmn 'j' dimension of the high-resolution orography !! data set. !! @param[in] npts Number of vertices to describe the cubed-sphere point. -!! @param[in] lonO The longitudes of the cubed-sphere vertices. +!! @param[in] lonO The longitudes of the cubed-sphere vertices. Must +!! range from 0 - 360. !! @param[in] latO The latitudes of the cubed-sphere vertices. !! @param[in] delxn Resolution of the high-resolution orography !! data set. diff --git a/tests/orog/ftst_get_index.F90 b/tests/orog/ftst_get_index.F90 index d321192ff..70bfd6bbf 100644 --- a/tests/orog/ftst_get_index.F90 +++ b/tests/orog/ftst_get_index.F90 @@ -1,5 +1,11 @@ program test_get_index +! Unit test for routine get_index, which finds the +! i/j location of the model point on the high-resolution +! mask and orography grids. +! +! Author George Gayno NCEP/EMC + use orog_utils, only : get_index implicit none @@ -8,12 +14,15 @@ program test_get_index integer, parameter :: jmn=180*120 integer, parameter :: npts=4 - integer :: jst, jen, ilist(imn), numx + integer :: i, ii, jst, jen, ilist(imn), numx real :: lono(npts), lato(npts) - real, parameter :: delxn=360.0/imn + real, parameter :: delxn=360.0/float(imn) + + print*,"Starting test of get_index." - print*,'hello world' +! Point 1 - At equator. Western edge of grid cell at +! Greenwich. lato(1) = 0.0; lono(1) = 0.0 lato(2) = 1.0; lono(2) = 0.5 @@ -22,11 +31,59 @@ program test_get_index ilist = -999 - call get_index(imn,jmn,npts,lonO,latO,delxn,jst,jen,ilist,numx) + call get_index(imn,jmn,npts,lono,lato,delxn,jst,jen,ilist,numx) + + if (jst /= 10676) stop 2 + if (jen /= 10925) stop 4 + if (numx /= 121) stop 6 + do i = 1, numx + if (ilist(i) /= i) stop 8 + enddo + +! Point 2 - At equator. Grid cell centered at +! Greenwich. + + lato(1) = 0.0; lono(1) = -0.5 + lato(2) = 1.0; lono(2) = 0.0 + lato(3) = 0.0; lono(3) = 0.5 + lato(4) = -1.0; lono(4) = 0.0 + + ilist = -999 + + call get_index(imn,jmn,npts,lono,lato,delxn,jst,jen,ilist,numx) + + if (jst /= 10676) stop 12 + if (jen /= 10925) stop 14 + if (numx /= 121) stop 16 + ii = 1 + do i = -59, 61, 1 + if (ilist(ii) /= i) stop 18 + ii = ii + 1 + enddo + +! Point 3 - At equator. Grid cell centered at +! the dateline. + + lato(1) = -1.0; lono(1) = 179.0 + lato(2) = 1.0; lono(2) = 179.0 + lato(3) = 1.0; lono(3) = 181.0 + lato(4) = -1.0; lono(4) = 181.0 + + ilist = -999 + + call get_index(imn,jmn,npts,lono,lato,delxn,jst,jen,ilist,numx) - print*,jst,jen,numx + if (jst /= 10676) stop 22 + if (jen /= 10925) stop 24 + if (numx /= 241) stop 26 + ii = 1 + do i = 21481, 21721 + if (ilist(ii) /= i) stop 28 + ii = ii + 1 + enddo - print*,ilist(1:numx) + print*,"OK" + print*,"SUCCESS" end program test_get_index