Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri authored Jan 31, 2025
1 parent baef161 commit ae761bb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Fields/interpolate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ end
@inline function fractional_x_index(λ, locs, grid::XRegularLLG)
λ₀ = λnode(1, 1, 1, grid, locs...)
λ₁ = λnode(2, 1, 1, grid, locs...)
λc = convert_to_0_360(λ)
λc = ifelse(λ₀ < 0, convert_to_minus_180_180(λc), λc)
λc = ifelse(λ₀ < 0, convert_to_minus_180_180(λ), convert_to_0_360(λ))
FT = eltype(grid)
return convert(FT, (λc - λ₀) / (λ₁ - λ₀)) + 1 # 1 - based indexing
end
Expand All @@ -104,9 +103,9 @@ end
loc = @inbounds locs[1]
= topology(grid, 1)()
= length(loc, Tλ, grid.Nx)
λc = convert_to_0_360(λ)
λn = λnodes(grid, locs...)
λc = ifelse(λn[1] < 0, convert_to_minus_180_180(λc), λc)
λ₀ = @inbounds λn[1]
λc = ifelse(λ₀ < 0, convert_to_minus_180_180(λ), convert_to_0_360(λ))
return fractional_index(λc, λn, Nλ)
end

Expand Down

0 comments on commit ae761bb

Please sign in to comment.