salvus.mesh.layered_meshing.interface.detail
salvus.mesh.layered_meshing.interface.detail salvus mesh layered_meshing interface detail Implementation details for interfaces.
Functions
compute_reference_elevation()
compute_reference_elevation()def compute_reference_elevation(
da: xr_tools.XrType, extents: tuple[float, float]
) -> xr_tools.XrType: ...Compute the absolute reference elevations from depths or heights.
daxr_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: xr_tools.XrType,
extents: tuple[float, float],
c: str,
vb: tuple[float, float],
) -> xr_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.
daxr_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: Interface, i1: Interface, db: 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.
i0Interface — The bottom interface.i1Interface — The top interface.dbdomain.DomainBounds — The bounds of the domain.
interpolate()
interpolate()def interpolate(i: Interface, hc: np.ndarray) -> np.ndarray: ...Interpolate an interface onto horizontal coordinates.
iInterface — The interface.hcnp.ndarray — The horizontal coordinates.
is_flat()
is_flat()def is_flat(i: 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.
iInterface — The interface.
max_bounds_da()
max_bounds_da()def max_bounds_da(i0: Interface, i1: Interface, vc: str) -> xr.DataArray: ...Given two interfaces, return their max bounds as a DataArray.
i0Interface — The lower interface.i1Interface — The upper interface.vcstr — The coordinate to compute the bounds over.
thickness()
thickness()def thickness(
bot: Interface,
top: Interface,
crd: np.ndarray,
allow_crossing: bool = False,
) -> np.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.
botInterface — The bottom interface.topInterface — The top interface.crdnp.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: Interface, top: Interface) -> float: ...Compute the distance between the reference elevations of two interfaces.
botInterface — The bottom interface.topInterface — The top interface.
validate_interfaces()
validate_interfaces()def validate_interfaces(
dim: types.Dim, interfaces: list[Interface]
) -> list[Interface]: ...Ensure that an interface is consistent with a domain’s dimension.
dimtypes.Dim — The domain’s dimension.interfaceslist[Interface] — The list of interfaces to validate.