salvus.mesh.layered_meshing.interface.hyperplane
An axis-aligned hyperplane.
Classes
Hyperplane
Hyperplaneclass Hyperplane(salvus.mesh.layered_meshing.interface.Interface):
def __init__(
self,
da: xarray.core.dataarray.DataArray,
extender: Callable[
[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray],
xarray.core.dataarray.DataArray,
] = salvus.utils.xarray_tools.extrude_like_and_pad,
interpolation_method: Literal[("nearest", "linear")] = "linear",
) -> None:
...An interface with a constant depth value.
If a standard float is used as the reference coordinate, its interpretation will be tied to the domain the interface is being applied to. For cartesian domains, a standard float defines a planar discontinuity perpendicular to the vertical coordinate (“y” in 2-D, “z” in 3-D) and located “c” meters away its origin. For spherical domains, it instead defines a spherical shell at radius “c”.
If one is instead interested in specifying a reference coordinate
relative to the domain’s top surface, the “Depth” type can be passed
instead. For example, in a 3-D Cartesian domain, calling
interface.Hyperplane.at(1.0) will place an interface at z = 1.0, while
calling interface.Hyperplane.at(Depth(1.0)) will place an interface
1.0 meters below the domain’s top surface. Behavior in spherical domains
follow similarly, with the radial (“r”) coordinate acting as the
vertical direction.
daxarray.core.dataarray.DataArray — The interface represented as a DataArray.extenderCallable[[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray] — A function that can be used extend the boundaries of the interface past its defined extents.interpolation_methodLiteral[('nearest', 'linear')] — The interpolation method used to evaluate the interface between grid points.
attrs Dict[str, str]
attrs Dict[str, str]The hyperplane is fully determined by its xarray representation.
da_absolute xarray.core.dataarray.DataArray
da_absolute xarray.core.dataarray.DataArrayGet the DEM in absolute coordinates.
is_flat bool
is_flat boolQuery whether the interface is flat.
max_elevation float
max_elevation floatGet the interface’s maximum elevation.
min_elevation Union[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height]
min_elevation Union[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height]Get the interface’s minimum elevation.
reference_elevation Union[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height]
reference_elevation Union[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height]Get the interface’s reference elevation.
at()
at()def at(
c: Union[
float,
salvus.mesh.layered_meshing.interface.Depth,
salvus.mesh.layered_meshing.interface.Height,
]
) -> Hyperplane:
...Specify a hyperplane interface at a vertical coordinate position.
cUnion[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height] — Hyperplane coordinate (absolute, height, or depth).
from_dataarray()
from_dataarray()def from_dataarray(
da: xarray.core.dataarray.DataArray,
extender: Callable[
[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray],
xarray.core.dataarray.DataArray,
] = salvus.utils.xarray_tools.extrude_like_and_pad,
interpolation_method: Literal[("nearest", "linear")] = "linear",
) -> Interface:
...Construct a generic interface from an xarray DataArray.
Will dispatch to the appropriate interface type based on the DataArray’s dimension and heterogeneity (of lack thereof).
daxarray.core.dataarray.DataArray — The data array.extenderCallable[[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray] — A function that can be used extend the boundaries of the interface past its defined extents.interpolation_methodLiteral[('nearest', 'linear')] — The interpolation method used to evaluate the interface between grid points.
extrude_like_and_pad()
extrude_like_and_pad()def extrude_like_and_pad(
data: salvus.utils.xarray_tools.XrType,
like: xarray.core.dataarray.DataArray,
) -> salvus.utils.xarray_tools.XrType:
...Extrude like another data array and pad if necessary.
datasalvus.utils.xarray_tools.XrType — The input data array or set.likexarray.core.dataarray.DataArray — The data array to extrude and pad like.
interp_like()
interp_like()def interp_like(
self, like: xarray.core.dataarray.DataArray
) -> typing_extensions.Self:
...Interpolate this interface onto another DataArray’s coordinates.
Will call the interface’s extend method to ensure that it spans the
coordinates spanned by other with the desired expansion behavior.
likexarray.core.dataarray.DataArray — TheDataArrayon which to interpolate this interface.
map()
map()def map(
self,
f: Callable[
[xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray
],
as_type: Optional[Type] = None,
) -> Interface:
...Apply a function that modifies the DataArray representation.
All attributes of the DataArray will be kept as is.
fCallable[[xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray] — The function used to modify the DataArray. Must take and return a DataArray.as_typeOptional[Type] — Modify the type of the mapped DataArray. Useful for upcasting from aHyperplaneto a heterogeneous container, or vice versa.
map_representation()
map_representation()def map_representation(
self,
f: Callable[
[xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray
],
) -> typing_extensions.Self:
...Transform this interface’s DataArray representation.
fCallable[[xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray] — Function transform with.