Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolate topography to a plane #65

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/man/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GeophysicalModelGenerator.SubtractHorizontalMean
GeophysicalModelGenerator.AboveSurface
GeophysicalModelGenerator.BelowSurface
GeophysicalModelGenerator.InterpolateDataOnSurface
GeophysicalModelGenerator.InterpolateTopographyOnPlane
GeophysicalModelGenerator.ParseColumns_CSV_File
GeophysicalModelGenerator.RotateTranslateScale!
GeophysicalModelGenerator.Convert2UTMzone
Expand Down
12 changes: 11 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export meshgrid, CrossSection, CrossSectionVolume, CrossSectionSurface, CrossSectionPoints, ExtractSubvolume, SubtractHorizontalMean
export ParseColumns_CSV_File, AboveSurface, BelowSurface, VoteMap
export InterpolateDataOnSurface, InterpolateDataFields2D, InterpolateDataFields
export InterpolateDataOnSurface, InterpolateDataFields2D, InterpolateDataFields, InterpolateTopographyOnPlane
export RotateTranslateScale
export DrapeOnTopo, LithostaticPressure!
export FlattenCrossSection
Expand Down Expand Up @@ -1327,7 +1327,17 @@
return Surf_interp
end

"""
Surf_interp = InterpolateTopographyOnPlane(V::GeoData, proj::ProjectionPoint, x::AbstractRange, y::AbstractRange)

Interpolates a 3D data set `V` with a projection point `proj` on a plane defined by `x` and `y`, where are uniformly spaced.
Returns the 2D array `Surf_interp`.
"""
function InterpolateTopographyOnPlane(V::GeoData, proj::ProjectionPoint, x::AbstractRange, y::AbstractRange)
cart_grid = CartData(XYZGrid(x, y, 0))
tproj = ProjectCartData(cart_grid, V, proj)
return tproj.z.val[:, :, 1]

Check warning on line 1339 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L1336-L1339

Added lines #L1336 - L1339 were not covered by tests
end

# Extracts a sub-data set using indices
function ExtractDataSets(V::AbstractGeneralGrid, iLon, iLat, iDepth)
Expand Down
Loading