salvus.mesh.layered_meshing.interface.detail
Implementation details for interfaces.
Functions
compute_reference_elevation()
compute_reference_elevation()def compute_reference_elevation(
da: salvus.utils.xarray_tools.XrType, extents: Tuple[float, float]
) -> salvus.utils.xarray_tools.XrType:
...Compute the absolute reference elevations from depths or heights.
dasalvus.utils.xarray_tools.XrType — A dataset to compute the absolute coordinates for.extentsTuple[float, float] — The extents to concretize the reference coordinates against. Tuple should be (bottom, top).
compute_relative_coordinates()
compute_relative_coordinates()def compute_relative_coordinates(
da: salvus.utils.xarray_tools.XrType,
extents: Tuple[float, float],
c: str,
vb: Tuple[float, float],
) -> salvus.utils.xarray_tools.XrType:
...Expand relative coordinates to fill a layer.
The relative vertical coordinates for models should be specified in the range [0, 1] with 0 corresponding to the bottom interface and 1 to the top. This function serves to expand the vertical coordinates across the layer. It set the reference coordinate to the elevation of the bottom interface, and flags this value with _R as a message to future interpolation routines.
dasalvus.utils.xarray_tools.XrType — The model data array in relative coordinates.extentsTuple[float, float] — The extents of the target layer.cstr — The vertical coordinate.vbTuple[float, float] — The vertical bounds of the entire domain.
get_bounds()
get_bounds()def get_bounds(
i0: salvus.mesh.layered_meshing.interface.Interface,
i1: salvus.mesh.layered_meshing.interface.Interface,
db: salvus.project.domain.DomainBounds,
) -> Dict[str, Tuple[float, float]]:
...Get a dictionary with the bounds of the current layer.
The top and bottom bounds will be taken as the maximum / minimum extent of the interfaces, and the horizontal boundaries will be taken from the domain bounds.
i0salvus.mesh.layered_meshing.interface.Interface — The bottom interface.i1salvus.mesh.layered_meshing.interface.Interface — The top interface.dbsalvus.project.domain.DomainBounds — The bounds of the domain.
interpolate()
interpolate()def interpolate(
i: salvus.mesh.layered_meshing.interface.Interface, hc: numpy.ndarray
) -> numpy.ndarray:
...Interpolate an interface onto horizontal coordinates.
isalvus.mesh.layered_meshing.interface.Interface — The interface.hcnumpy.ndarray — The horizontal coordinates.
is_flat()
is_flat()def is_flat(i: salvus.mesh.layered_meshing.interface.Interface) -> bool:
...Determine whether or not an interface is flat.
Always returns true for Hyperplanes, returns True based on numpy’s isclose for other interface types.
isalvus.mesh.layered_meshing.interface.Interface — The interface.
max_bounds_da()
max_bounds_da()def max_bounds_da(
i0: salvus.mesh.layered_meshing.interface.Interface,
i1: salvus.mesh.layered_meshing.interface.Interface,
vc: str,
) -> xarray.core.dataarray.DataArray:
...Given two interfaces, return their max bounds as a DataArray.
i0salvus.mesh.layered_meshing.interface.Interface — The lower interface.i1salvus.mesh.layered_meshing.interface.Interface — The upper interface.vcstr — The coordinate to compute the bounds over.
thickness()
thickness()def thickness(
bot: salvus.mesh.layered_meshing.interface.Interface,
top: salvus.mesh.layered_meshing.interface.Interface,
crd: numpy.ndarray,
allow_crossing: bool = False,
) -> numpy.ndarray:
...Compute the thickness between two interfaces.
Both interfaces will be interpolated onto a common grid before thickness is computed. Will throw if thickness is ever less than or equal to 0.0.
botsalvus.mesh.layered_meshing.interface.Interface — The bottom interface.topsalvus.mesh.layered_meshing.interface.Interface — The top interface.crdnumpy.ndarray — The coordinates to interpolate onto.allow_crossingbool — Don’t throw if thickness is less than or equal to 0.0.
thickness_ref()
thickness_ref()def thickness_ref(
bot: salvus.mesh.layered_meshing.interface.Interface,
top: salvus.mesh.layered_meshing.interface.Interface,
) -> float:
...Compute the distance between the reference elevations of two interfaces.
botsalvus.mesh.layered_meshing.interface.Interface — The bottom interface.topsalvus.mesh.layered_meshing.interface.Interface — The top interface.
validate_interfaces()
validate_interfaces()def validate_interfaces(
dim: salvus.project.components.types.Dim,
interfaces: List[salvus.mesh.layered_meshing.interface.Interface],
) -> List[salvus.mesh.layered_meshing.interface.Interface]:
...Ensure that an interface is consistent with a domain’s dimension.
dimsalvus.project.components.types.Dim — The domain’s dimension.interfacesList[salvus.mesh.layered_meshing.interface.Interface] — The list of interfaces to validate.