Skip to content

Commit

Permalink
Fix non unique knots for intersections
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc committed May 6, 2021
1 parent ef8d51b commit 937abc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OceanGrids"
uuid = "cfe838f4-859f-11e9-2ea1-df7d4e7c3537"
authors = ["Benoit Pasquier <[email protected]>"]
version = "0.3.5"
version = "0.3.6"

[deps]
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
Expand Down
10 changes: 6 additions & 4 deletions src/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,12 @@ function intersections(x::AbstractArray{T}, y, ylevs) where T
mini_y = view(y, i:i+1)
idx = sortperm(mini_y)
a, b = view(mini_y, idx)
itp = LinearInterpolation(mini_y[idx], mini_x[idx], extrapolation_bc=Line())
for x_intersect in itp(ylevs[a .< ylevs .≤ b])
push!(out, x_intersect)
end
if a b
itp = LinearInterpolation(mini_y[idx], mini_x[idx], extrapolation_bc=Line())
for x_intersect in itp(ylevs[a .< ylevs .≤ b])
push!(out, x_intersect)
end
end
end
return out
end
Expand Down

0 comments on commit 937abc7

Please sign in to comment.