salvus.mesh.layered_meshing.interface.curve
1-D variable interface.
Classes
Curve
Curveclass Curve(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:
...A potentially deformed interface described by one coordinate.
A curve’s independent coordinate can be ONE of the following: x, y, latitude, or longitude. Curves in 3-D domains will be automatically extruded into the “missing” dimension upon model realization. This allows one to conveniently specify the same 1-D deformation in both 2- and 3-D domains.
A curve’s digital elevation model (DEM) should always be specified relative to the “reference_elevation” attribute in its xarray representation. As an example if one wanted to apply a simple sinusoidal topography to a domain’s top surface by they could do so by using Depth(0.0) as the reference coordinate. If no scaling was present, the resultant topography would then have a peak-to-peak range of 2 m, with the highest peak at 1 m above the domain’s top surface and the lowest valley at 1 m below it.
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, Any]
attrs Dict[str, Any]The object’s parameters minus 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.
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.
from_points()
from_points()def from_points(
c: Union[
Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]],
numpy._array_like._SupportsArray[numpy.dtype],
Sequence[numpy._array_like._SupportsArray[numpy.dtype]],
Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]],
Sequence[
Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]
],
Sequence[
Sequence[
Sequence[
Sequence[numpy._array_like._SupportsArray[numpy.dtype]]
]
]
],
bool,
int,
float,
complex,
str,
bytes,
Sequence[Union[bool, int, float, complex, str, bytes]],
Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]],
Sequence[
Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]
],
Sequence[
Sequence[
Sequence[
Sequence[Union[bool, int, float, complex, str, bytes]]
]
]
],
],
dem: Union[
Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]],
numpy._array_like._SupportsArray[numpy.dtype],
Sequence[numpy._array_like._SupportsArray[numpy.dtype]],
Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]],
Sequence[
Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]
],
Sequence[
Sequence[
Sequence[
Sequence[numpy._array_like._SupportsArray[numpy.dtype]]
]
]
],
bool,
int,
float,
complex,
str,
bytes,
Sequence[Union[bool, int, float, complex, str, bytes]],
Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]],
Sequence[
Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]
],
Sequence[
Sequence[
Sequence[
Sequence[Union[bool, int, float, complex, str, bytes]]
]
]
],
],
reference_elevation: Union[
float,
salvus.mesh.layered_meshing.interface.Depth,
salvus.mesh.layered_meshing.interface.Height,
],
axis: str,
interpolation_method: Literal[("nearest", "linear")] = "linear",
extender: Callable[
[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray],
xarray.core.dataarray.DataArray,
] = salvus.utils.xarray_tools.extrude_like_and_pad,
) -> Curve:
...Specify a Curve from its independent components.
cUnion[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy._array_like._SupportsArray[numpy.dtype], Sequence[numpy._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]] — The value of the independent coordinate.demUnion[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy._array_like._SupportsArray[numpy.dtype], Sequence[numpy._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]] — The value of the relative digital elevation model. Must be on the same grid as c.reference_elevationUnion[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height] — The elevation to which the 0.0 value in the dem parameter refers to. A plain float specifies an absolute reference coordinate, while either a Depth or Height value specifies depth below or height above a domain’s top and bottom bounds respectively.axisstr — The axis to which the independent coordinate refers to. Must be one of “x”, “y”, “latitude”, or “longitude”.interpolation_methodLiteral[('nearest', 'linear')] — Method to use for interpolating this curve between its defined points.extenderCallable[[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray], xarray.core.dataarray.DataArray] — Callable to use to extend the curve past its defined domain. Useful, for instance, when absorbing boundaries are used to extend the domain.
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.