diff --git a/tests/orog/ftst_inside_polygon.F90 b/tests/orog/ftst_inside_polygon.F90 index 94c2d850e..b71e57c38 100644 --- a/tests/orog/ftst_inside_polygon.F90 +++ b/tests/orog/ftst_inside_polygon.F90 @@ -1,5 +1,11 @@ program inside_polygon +! Unit test for function inside_a_polygon, which determines +! whether a test point is located within an area specified +! by a polygon. +! +! Author George Gayno NCEP/EMC + use orog_utils, only : inside_a_polygon implicit none @@ -13,13 +19,15 @@ program inside_polygon real :: lon1, lat1 real :: lon2(npts), lat2(npts) -! The first part of the function checks if the test point is outside + print*,"Starting test of inside_a_polygon." + +! The first part of the function checks if the test point is well outside ! the neighborhood of the polygon - i.e., a gross check. There ! are six separate checks. The first six tests are designed ! so that the polygon is far enough from the test point that ! each check is tripped. -! Test to trip the first 'if' gross check. Is point outside the +! Test to trip the first 'if' gross check. Is point well outside the ! neighborhood in the plus 'x' direction? print*, "Test point 1" @@ -40,7 +48,7 @@ program inside_polygon if (inside) stop 2 ! Test point should be outside polygon. -! Test to trip the second 'if' gross check. Is point outside the +! Test to trip the second 'if' gross check. Is point well outside the ! neighborhood in the minus 'x' direction? print*, "Test point 2" @@ -61,7 +69,7 @@ program inside_polygon if (inside) stop 4 ! Test point should be outside polygon. -! Test to trip the third 'if' gross check. Is point outside the +! Test to trip the third 'if' gross check. Is point well outside the ! neighborhood in the plus 'y' direction? print*, "Test point 3" @@ -82,7 +90,7 @@ program inside_polygon if (inside) stop 6 ! Test point should be outside polygon. -! Test to trip the fourth 'if' gross check. Is point outside the +! Test to trip the fourth 'if' gross check. Is point well outside the ! neighborhood in the minus 'y' direction? print*, "Test point 4" @@ -103,7 +111,7 @@ program inside_polygon if (inside) stop 8 ! Test point should be outside polygon. -! Test to trip the fifth 'if' gross check. Is point outside the +! Test to trip the fifth 'if' gross check. Is point well outside the ! neighborhood in the plus 'z' direction? print*, "Test point 5" @@ -124,7 +132,7 @@ program inside_polygon if (inside) stop 10 ! Test point should be outside polygon. -! Test to trip the sixth 'if' gross check. Is point outside the +! Test to trip the sixth 'if' gross check. Is point well outside the ! neighborhood in the minus 'z' direction? print*, "Test point 6" @@ -189,6 +197,26 @@ program inside_polygon if (.not.inside) stop 16 ! Test point should be inside polygon. +! Test the case when the test point just outside the polygon. + + print*, "Test point 9" + + lon1 = 89.5 * D2R ! Test point. + lat1 = 0.5 * D2R + + lon2(1) = 90.0 * D2R ! Polygon. + lat2(1) = 0.0 * D2R + lon2(2) = 90.0 * D2R + lat2(2) = 1.0 * D2R + lon2(3) = 91.0 * D2R + lat2(3) = 1.0 * D2R + lon2(4) = 91.0 * D2R + lat2(4) = 0.0 * D2R + + inside=inside_a_polygon(lon1, lat1, npts, lon2, lat2) + + if (inside) stop 18 ! Test point should be outside polygon. + print*,"OK" print*,"SUCCSSS"