Skip to content

Commit

Permalink
Swap indicies
Browse files Browse the repository at this point in the history
  • Loading branch information
ezhilsabareesh8 committed Nov 5, 2024
1 parent 5ff9cfe commit a33cbb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/topography.f90
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ subroutine topography_min_dy(this, hgrid, cutoff)
call handle_error(nf90_inquire_dimension(ncid_hgrid, dids_dy(2), len=nxp_len))

! Allocate memory for dy based on its dimensions
allocate(dy(ny_len, nxp_len))
allocate(dy(nxp_len, ny_len))

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

0 comments on commit a33cbb4

Please sign in to comment.