Skip to content

Commit

Permalink
fix: array indices for horiz_interp_type assignment test (#1575)
Browse files Browse the repository at this point in the history
  • Loading branch information
rem1776 authored Aug 29, 2024
1 parent 4fcc421 commit d13c129
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test_fms/horiz_interp/test_horiz_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ subroutine test_assignment()
real(HI_TEST_KIND_) :: R2D = 180._lkind/real(PI,HI_TEST_KIND_) !< degrees per radian
real(HI_TEST_KIND_), allocatable :: lon_src_1d(:), lat_src_1d(:) !< src data used for bicubic test
real(HI_TEST_KIND_), allocatable :: lon_dst_1d(:), lat_dst_1d(:) !< destination data used for bicubic test
integer :: icount !< index for setting the output array when taking midpoints for bilinear


! set up longitude and latitude of source/destination grid.
Expand Down Expand Up @@ -1104,17 +1105,21 @@ subroutine test_assignment()
nlon_out = size(lon_out_1d(:))-1; nlat_out = size(lat_out_1d(:))-1
allocate(lon_src_1d(nlon_in), lat_src_1d(nlat_in))
allocate(lon_dst_1d(nlon_out), lat_dst_1d(nlat_out))
do i = 1, nlon_in
do i = 1, nlon_in-1
lon_src_1d(i) = (lon_in_1d(i) + lon_in_1d(i+1)) * 0.5_lkind
enddo
do j = 1, nlat_in
do j = 1, nlat_in-1
lat_src_1d(j) = (lat_in_1d(j) + lat_in_1d(j+1)) * 0.5_lkind
enddo
do i = 1, nlon_out
lon_dst_1d(i) = (lon_out_1d(i) + lon_out_1d(i+1)) * 0.5_lkind
icount = 1
do i = isc, iec
lon_dst_1d(icount) = (lon_out_1d(i) + lon_out_1d(i+1)) * 0.5_lkind
icount = icount + 1
enddo
do j = 1, nlat_out
lat_dst_1d(j) = (lat_out_1d(j) + lat_out_1d(j+1)) * 0.5_lkind
icount = 1
do j = jsc, jec
lat_dst_1d(icount) = (lat_out_1d(j) + lat_out_1d(j+1)) * 0.5_lkind
icount = icount + 1
enddo
call horiz_interp_bicubic_new(Interp_new1, lon_src_1d, lat_src_1d, lon_out_2d, lat_out_2d)
call horiz_interp_del(Interp_new1)
Expand Down

0 comments on commit d13c129

Please sign in to comment.