Skip to content

Commit

Permalink
Fix a precision problem in the ETOPO1 dataset (#209)
Browse files Browse the repository at this point in the history
* solves the problem?

* remove latitude tolerance

* fix this problem

* no stray spaces

* better comment

---------

Co-authored-by: Navid C. Constantinou <[email protected]>
  • Loading branch information
simone-silvestri and navidcy authored Oct 31, 2024
1 parent 69a111a commit 8796b45
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Bathymetry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ function regrid_bathymetry(target_grid;
j₂ = searchsortedfirst(φ_data, φ₂) - 1
jj = j₁:j₂

# Restrict bathymetry _data to region of interest
λ_data = λ_data[ii]
φ_data = φ_data[jj]
z_data = z_data[ii, jj]
# Restrict bathymetry coordinate_data to region of interest
λ_data = λ_data[ii] |> Array{BigFloat}
φ_data = φ_data[jj] |> Array{BigFloat}
z_data = z_data[ii, jj]

if !isnothing(height_above_water)
# Overwrite the height of cells above water.
Expand All @@ -158,10 +158,10 @@ function regrid_bathymetry(target_grid;
Δλ = λ_data[2] - λ_data[1]
Δφ = φ_data[2] - φ_data[1]

λ₁_data = λ_data[1] - Δλ / 2
λ₂_data = λ_data[end] + Δλ / 2
φ₁_data = φ_data[1] - Δφ / 2
φ₂_data = φ_data[end] + Δφ / 2
λ₁_data = convert(Float64, λ_data[1] - Δλ / 2)
λ₂_data = convert(Float64, λ_data[end] + Δλ / 2)
φ₁_data = convert(Float64, φ_data[1] - Δφ / 2)
φ₂_data = convert(Float64, φ_data[end] + Δφ / 2)

Nxn = length(λ_data)
Nyn = length(φ_data)
Expand Down

0 comments on commit 8796b45

Please sign in to comment.