forked from ufs-community/UFS_UTILS
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Baseline rough unit test for function inside_a_polygon.
Fixes ufs-community#1000.
- Loading branch information
1 parent
9d47f97
commit c15de74
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
program inside_polygon | ||
|
||
use orog_utils, only : inside_a_polygon | ||
|
||
implicit none | ||
|
||
integer, parameter :: npts=4 | ||
|
||
real, parameter :: D2R = 3.14159265358979/180. | ||
logical :: inside | ||
|
||
real :: lon1, lat1 | ||
real :: lon2(npts), lat2(npts) | ||
|
||
! Test to trip the first 'if' range check | ||
|
||
print*, "Test point 1" | ||
|
||
lon1 = 90.0 * D2R | ||
lat1 = 0.0 * D2R | ||
|
||
lon2(1) = 94.0 * D2R | ||
lat2(1) = -1.0 * D2R | ||
lon2(2) = 94.0 * D2R | ||
lat2(2) = 1.0 * D2R | ||
lon2(3) = 95.0 * D2R | ||
lat2(3) = 1.0 * D2R | ||
lon2(4) = 95.0 * D2R | ||
lat2(4) = -1.0 * D2R | ||
|
||
inside=inside_a_polygon(lon1, lat1, npts, lon2, lat2) | ||
|
||
if (inside) stop 2 | ||
|
||
! Test to trip the second 'if' range check | ||
|
||
print*, "Test point 2" | ||
|
||
lon1 = 90.0 * D2R | ||
lat1 = 0.0 * D2R | ||
|
||
lon2(1) = 84.0 * D2R | ||
lat2(1) = -1.0 * D2R | ||
lon2(2) = 84.0 * D2R | ||
lat2(2) = 1.0 * D2R | ||
lon2(3) = 85.0 * D2R | ||
lat2(3) = 1.0 * D2R | ||
lon2(4) = 85.0 * D2R | ||
lat2(4) = -1.0 * D2R | ||
|
||
inside=inside_a_polygon(lon1, lat1, npts, lon2, lat2) | ||
|
||
if (inside) stop 4 | ||
|
||
print*,"OK" | ||
print*,"SUCCSSS" | ||
|
||
end program inside_polygon |