Skip to content

Commit

Permalink
Complete unit test for "file_nearest_pole_points".
Browse files Browse the repository at this point in the history
  • Loading branch information
George Gayno committed Dec 5, 2024
1 parent 58cd3bc commit c8dad11
Showing 1 changed file with 53 additions and 5 deletions.
58 changes: 53 additions & 5 deletions tests/orog/ftst_find_nearest_pole_pts.F90
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
program find_nearest_pole_pts

! Unit test for routine find_nearest_pole_points.
!
! The routine is passed the supergrid indices of
! the pole (from the 'grid' files) and returns the
! nearest pole points (using a logical array) on
! the model tile.
!
! Author George Gayno NCEP/EMC

use orog_utils, only : find_nearest_pole_points

implicit none
Expand All @@ -14,10 +23,14 @@ program find_nearest_pole_pts
logical :: is_north_pole(im,jm)
logical :: is_south_pole(im,jm)

print*,"Starting test of find_nearest_pole_points routine."

! Test 1 - C48 uniform tile containing north pole.

i_north_pole = 49 ! supergrid index
j_north_pole = 49 ! uniform grid
print*,"Test number 1."

i_north_pole = 49 ! Supergrid index
j_north_pole = 49
i_south_pole = 0
j_south_pole = 0

Expand All @@ -41,9 +54,11 @@ program find_nearest_pole_pts

! Test 2 - C48 uniform tile containing south pole.

print*,"Test number 2."

i_north_pole = 0
j_north_pole = 0
i_south_pole = 49
i_south_pole = 49 ! Supergrid index.
j_south_pole = 49

call find_nearest_pole_points(i_north_pole, j_north_pole, &
Expand All @@ -66,7 +81,9 @@ program find_nearest_pole_pts

! Test 3 - C48 uniform tile containing no pole.

i_north_pole = 0
print*,"Test number 3."

i_north_pole = 0 ! Zero indicates no pole.
j_north_pole = 0
i_south_pole = 0
j_south_pole = 0
Expand All @@ -84,9 +101,11 @@ program find_nearest_pole_pts

! Test 4 - C48 stretched grid tile containing south pole.

print*,"Test number 4."

i_north_pole = 0
j_north_pole = 0
i_south_pole = 10
i_south_pole = 10 ! Supergrid index.
j_south_pole = 49

call find_nearest_pole_points(i_north_pole, j_north_pole, &
Expand All @@ -105,4 +124,33 @@ program find_nearest_pole_pts
enddo
enddo

! Test 5 - C48 stretched grid tile containing north pole.

print*,"Test number 5."

i_north_pole = 62 ! Supergrid index.
j_north_pole = 49
i_south_pole = 0
j_south_pole = 0

call find_nearest_pole_points(i_north_pole, j_north_pole, &
i_south_pole, j_south_pole, im, jm, is_north_pole, &
is_south_pole)

do j = 1, im
do i = 1, jm
if((i == 31 .and. j == 24) .or. &
(i == 31 .and. j == 25)) then
if (.not.is_north_pole(i,j)) stop 32
else
if (is_north_pole(i,j)) stop 34
endif
if (is_south_pole(i,j)) stop 38
enddo
enddo

print*,"OK"

print*,"SUCCESS"

end program find_nearest_pole_pts

0 comments on commit c8dad11

Please sign in to comment.