Version:

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 the absolute reference elevations from depths or heights.
SIGNATURE
def compute_reference_elevation(
    da: xr_tools.XrType, extents: tuple[float, float]
) -> xr_tools.XrType: ...
ARGUMENTS
Required
da
Type:xr_tools.XrType
Description:
A dataset to compute the absolute coordinates for.
Required
extents
Type:tuple[float, float]
Description:
The extents to concretize the reference coordinates against. Tuple should be (bottom, top).
EXCEPTIONS
ValueError
If relative coordinates are present but the top or bottom interfaces are not well defined (i.e., if they are specified by NAN values).
RETURNS
Return type: xr_tools.XrType
A new xarray representation with absolute coordinates.

compute_relative_coordinates()

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.
SIGNATURE
def compute_relative_coordinates(
    da: xr_tools.XrType,
    extents: tuple[float, float],
    c: str,
    vb: tuple[float, float],
) -> xr_tools.XrType: ...
ARGUMENTS
Required
da
Type:xr_tools.XrType
Description:
The model data array in relative coordinates.
Required
extents
Type:tuple[float, float]
Description:
The extents of the target layer.
Required
c
Type:str
Description:
The vertical coordinate.
Required
vb
Type:tuple[float, float]
Description:
The vertical bounds of the entire domain.
RETURNS
Return type: xr_tools.XrType
xarray_tools.XrType: description

get_bounds()

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.
SIGNATURE
def get_bounds(
    i0: Interface, i1: Interface, db: domain.DomainBounds
) -> dict[str, tuple[float, float]]: ...
ARGUMENTS
Required
i0
Type:Interface
Description:
The bottom interface.
Required
i1
Type:Interface
Description:
The top interface.
Required
db
Type:domain.DomainBounds
Description:
The bounds of the domain.
RETURNS
Return type: dict[str, tuple[float, float]]
The bounds of the layer as a dictionary.

interpolate()

Interpolate an interface onto horizontal coordinates.
SIGNATURE
def interpolate(i: Interface, hc: np.ndarray) -> np.ndarray: ...
ARGUMENTS
Required
i
Type:Interface
Description:
The interface.
Required
hc
Type:np.ndarray
Description:
The horizontal coordinates.
RETURNS
Return type: np.ndarray
The interpolated interface relative to the reference elevation.

is_flat()

Determine whether or not an interface is flat.
Always returns true for Hyperplanes, returns True based on numpy's isclose for other interface types.
SIGNATURE
def is_flat(i: Interface) -> bool: ...
ARGUMENTS
Required
i
Type:Interface
Description:
The interface.
RETURNS
Return type: bool
True if the interface is flat.

max_bounds_da()

Given two interfaces, return their max bounds as a DataArray.
SIGNATURE
def max_bounds_da(i0: Interface, i1: Interface, vc: str) -> xr.DataArray: ...
ARGUMENTS
Required
i0
Type:Interface
Description:
The lower interface.
Required
i1
Type:Interface
Description:
The upper interface.
Required
vc
Type:str
Description:
The coordinate to compute the bounds over.
RETURNS
Return type: xr.DataArray
An empty DataArray with the bounds.

thickness()

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.
SIGNATURE
def thickness(
    bot: Interface,
    top: Interface,
    crd: np.ndarray,
    allow_crossing: bool = False,
) -> np.ndarray: ...
ARGUMENTS
Required
bot
Type:Interface
Description:
The bottom interface.
Required
top
Type:Interface
Description:
The top interface.
Required
crd
Type:np.ndarray
Description:
The coordinates to interpolate onto.
Optional
allow_crossing
Type:bool
Default value:False
Description:
Don't throw if thickness is less than or equal to 0.0.
RETURNS
Return type: np.ndarray
An array with the thickness at each point in the passed coordinates.

thickness_ref()

Compute the distance between the reference elevations of two interfaces.
SIGNATURE
def thickness_ref(bot: Interface, top: Interface) -> float: ...
ARGUMENTS
Required
bot
Type:Interface
Description:
The bottom interface.
Required
top
Type:Interface
Description:
The top interface.
RETURNS
Return type: float
The distance between the reference coordinates.

validate_interfaces()

Ensure that an interface is consistent with a domain's dimension.
SIGNATURE
def validate_interfaces(
    dim: types.Dim, interfaces: list[Interface]
) -> list[Interface]: ...
ARGUMENTS
Required
dim
Type:types.Dim
Description:
The domain's dimension.
Required
interfaces
Type:list[Interface]
Description:
The list of interfaces to validate.
EXCEPTIONS
ValueError
If an inconsistency is detected
RETURNS
Return type: list[Interface]
A list of validated interfaces.
PAGE CONTENTS