Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.layered_meshing.interface.detail

Implementation details for interfaces.

Functions

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.

Parameters
  • da salvus.utils.xarray_tools.XrType — A dataset to compute the absolute coordinates for.
  • extents Tuple[float, float] — The extents to concretize the reference coordinates against. Tuple should be (bottom, top).
Returns salvus.utils.xarray_tools.XrType — A new xarray representation with absolute 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.

Parameters
  • da salvus.utils.xarray_tools.XrType — The model data array in relative coordinates.
  • extents Tuple[float, float] — The extents of the target layer.
  • c str — The vertical coordinate.
  • vb Tuple[float, float] — The vertical bounds of the entire domain.
Returns salvus.utils.xarray_tools.XrType — xarray_tools.XrType: description

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.

Parameters
  • i0 salvus.mesh.layered_meshing.interface.Interface — The bottom interface.
  • i1 salvus.mesh.layered_meshing.interface.Interface — The top interface.
  • db salvus.project.domain.DomainBounds — The bounds of the domain.
Returns Dict[str, Tuple[float, float]] — The bounds of the layer as a dictionary.

interpolate()

def interpolate(
    i: salvus.mesh.layered_meshing.interface.Interface, hc: numpy.ndarray
) -> numpy.ndarray:
    ...

Interpolate an interface onto horizontal coordinates.

Parameters
  • i salvus.mesh.layered_meshing.interface.Interface — The interface.
  • hc numpy.ndarray — The horizontal coordinates.
Returns numpy.ndarray — The interpolated interface relative to the reference elevation.

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.

Parameters
  • i salvus.mesh.layered_meshing.interface.Interface — The interface.
Returns bool — True if the interface is flat.

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.

Parameters
  • i0 salvus.mesh.layered_meshing.interface.Interface — The lower interface.
  • i1 salvus.mesh.layered_meshing.interface.Interface — The upper interface.
  • vc str — The coordinate to compute the bounds over.
Returns xarray.core.dataarray.DataArray — An empty DataArray with the bounds.

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.

Parameters
  • bot salvus.mesh.layered_meshing.interface.Interface — The bottom interface.
  • top salvus.mesh.layered_meshing.interface.Interface — The top interface.
  • crd numpy.ndarray — The coordinates to interpolate onto.
  • allow_crossing bool — Don’t throw if thickness is less than or equal to 0.0.
Returns numpy.ndarray — An array with the thickness at each point in the passed coordinates.

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.

Parameters
  • bot salvus.mesh.layered_meshing.interface.Interface — The bottom interface.
  • top salvus.mesh.layered_meshing.interface.Interface — The top interface.
Returns float — The distance between the reference coordinates.

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.

Parameters
  • dim salvus.project.components.types.Dim — The domain’s dimension.
  • interfaces List[salvus.mesh.layered_meshing.interface.Interface] — The list of interfaces to validate.
Returns List[salvus.mesh.layered_meshing.interface.Interface] — A list of validated interfaces.