Skip to content

Commit

Permalink
Merge pull request #65 from albert-de-montserrat/adm/topo
Browse files Browse the repository at this point in the history
Interpolate topography to a plane
  • Loading branch information
boriskaus authored Feb 29, 2024
2 parents aee67d0 + dcff56b commit 58678d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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 @@ function InterpolateDataOnSurface(V::GeoData, Surf::GeoData)
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]
end

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

0 comments on commit 58678d4

Please sign in to comment.