Skip to content

Commit 398e6b9

Browse files
mlee03mlee03
authored andcommitted
add test
1 parent cb942b4 commit 398e6b9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
program main
2+
3+
use constants_mod, only: DEG_TO_RAD
4+
use horiz_interp_mod, only: horiz_interp_type, horiz_interp_new
5+
use mpp_mod, only: FATAL, mpp_error
6+
use platform_mod, only: r8_kind
7+
8+
implicit none
9+
10+
integer, parameter :: nlon = 12
11+
integer, parameter :: nlat = 8
12+
13+
type(horiz_interp_type) :: interp
14+
real(r8_kind),allocatable :: lon(:,:), lat(:,:), answer_area(:,:)
15+
integer :: i, j
16+
17+
allocate(lon(nlon+1, nlat+1))
18+
allocate(lat(nlon+1, nlat+1))
19+
allocate(answer_area(nlon, nlat))
20+
21+
do j=1, nlat+1
22+
do i=1, nlon+1
23+
lon(i,j) = real(i, r8_kind)*DEG_TO_RAD
24+
lat(i,j) = real(j, r8_kind)*DEG_TO_RAD
25+
end do
26+
end do
27+
28+
call get_grid_area(nlon, nlat,lon, lat, answer_area)
29+
30+
call horiz_interp_new(interp, lon, lat, lon, lat, interp_method="conservative", &
31+
is_latlon_in=.false., is_latlon_out=.false., save_weights_as_fregrid=.true.)
32+
33+
if(any(interp%xgrid_area /= pack(answer_area, .true.))) then
34+
call mpp_error(FATAL, "saved xgrid_area does not match answers")
35+
end if
36+
37+
end program main

0 commit comments

Comments
 (0)