Skip to content

Commit

Permalink
test_horiz_interp: Don't over-allocate arrays
Browse files Browse the repository at this point in the history
In the horiz_interp_type assignment 1x2d bicubic test, there are four
allocatable arrays for which the number of elements allocated exceeds the number
that get initialized:

* `lon_src_1d`
* `lat_src_1d`
* `lon_out_1d`
* `lat_out_1d`

This PR shortens the sizes of the arrays to match the number of elements that
get initialized.
  • Loading branch information
Jesse Lentz authored and Jesse Lentz committed Oct 28, 2024
1 parent bd9cbeb commit 4b35a46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test_fms/horiz_interp/test_horiz_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ subroutine test_assignment()
! 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
allocate(lon_src_1d(nlon_in), lat_src_1d(nlat_in))
allocate(lon_src_1d(nlon_in-1), lat_src_1d(nlat_in-1))
allocate(lon_dst_1d(nlon_out), lat_dst_1d(nlat_out))
do i = 1, nlon_in-1
lon_src_1d(i) = (lon_in_1d(i) + lon_in_1d(i+1)) * 0.5_lkind
Expand Down Expand Up @@ -1213,7 +1213,7 @@ subroutine test_assignment()
call horiz_interp_del(Interp_cp)
! 2dx1d
deallocate(lon_out_1D, lat_out_1D)
allocate(lon_out_1D(ni_dst+1), lat_out_1D(nj_dst+1))
allocate(lon_out_1D(ni_dst), lat_out_1D(nj_dst))
do i=1, ni_dst
lon_out_1d(i) = real(i-1, HI_TEST_KIND_) * dlon_dst + lon_dst_beg
enddo
Expand Down

0 comments on commit 4b35a46

Please sign in to comment.