Skip to content

Commit

Permalink
fix: correct array indices for horiz_interp_type assignment test
Browse files Browse the repository at this point in the history
  • Loading branch information
rem1776 authored and rem1776 committed Aug 14, 2024
1 parent a5de6a5 commit a1b3d74
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 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 @@ -1100,21 +1101,25 @@ subroutine test_assignment()
call horiz_interp_del(Interp_cp)
! test deletion after direct calls
! this set up is usually done within horiz_interp_new
nlon_in = size(lon_in_1d(:))-1; nlat_in = size(lat_in_1d(:))-1
nlon_out = size(lon_out_1d(:))-1; nlat_out = size(lat_out_1d(:))-1
nlon_in = size(lon_in_1d(:)); nlat_in = size(lat_in_1d(:))
nlon_out = size(lon_out_1d(:)); nlat_out = size(lat_out_1d(:))
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 a1b3d74

Please sign in to comment.