Skip to content

Commit a33cbb4

Browse files
Swap indicies
1 parent 5ff9cfe commit a33cbb4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/topography.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ subroutine topography_min_dy(this, hgrid, cutoff)
485485
call handle_error(nf90_inquire_dimension(ncid_hgrid, dids_dy(2), len=nxp_len))
486486

487487
! Allocate memory for dy based on its dimensions
488-
allocate(dy(ny_len, nxp_len))
488+
allocate(dy(nxp_len, ny_len))
489489

490490
! Read the dy variable from hgrid
491491
call handle_error(nf90_get_var(ncid_hgrid, dy_id, dy))
@@ -494,8 +494,8 @@ subroutine topography_min_dy(this, hgrid, cutoff)
494494
! Calculate T cell size based on dy
495495
! For each point, the T cell size is a sum of dy(2*i-1, 2*j) and dy(2*i, 2*j)
496496
! Apply cutoff to depth based on the provided T-cell cutoff value in meters
497-
do i = 1, ny_len / 2
498-
do j = 1, (nxp_len - 1) / 2
497+
do j = 1, ny_len / 2
498+
do i = 1, (nxp_len - 1) / 2
499499
if (dy(2 * i - 1, 2 * j) + dy(2 * i, 2 * j) < cutoff) then !Input cutoff in meters
500500
this%depth(i, j) = MISSING_VALUE ! Set values below cutoff to zero or another value as needed
501501
end if

0 commit comments

Comments
 (0)