salvus.mesh.layered_meshing.utils.remap_xarray_to_unit_domain
salvus.mesh.layered_meshing.utils.remap_xarray_to_unit_domain salvus mesh layered_meshing utils remap_xarray_to_unit_domain Remap a DataArray or Dataset slab onto the unit square (2D) or unit cube (3D).
Functions
remap_xarray_to_unit_domain()
remap_xarray_to_unit_domain()def remap_xarray_to_unit_domain(
da: _XrTypes, top: xr.DataArray | float, bottom: xr.DataArray | float
) -> _XrTypes: ...Remap a slab of da between bottom and top onto the unit square/cube.
Per horizontal column the trailing axis is rescaled to t ∈ [0, 1] with
bottom(x, y) → 0 and top(x, y) → 1. At t = 0 and t = 1 the output
value equals da linearly interpolated along the trailing axis at the
bounding surface — the “pin value” at the cut.
The output uses the same dim names as da with coordinate values
replaced by np.linspace(0, 1, N_d); horizontal coordinates are
re-labeled uniformly and so the input’s horizontal spacing is not
preserved in the output coordinate values. The unit-space resolution
along the trailing axis equals the densest column’s count of da
grid points within [bottom, top], with a floor of 2; horizontal
dims keep their input resolution. Pass top/bottom as a scalar for
a flat cut (e.g. a grid-aligned boundary), or as a DataArray on the
horizontal coords of da for a tilted/curved cut.
da_XrTypes — The DataArray or Dataset to remap. Horizontal coordinates are the leading dimensions; the vertical coordinate is the trailing dimension and must be monotonically increasing.topxr.DataArray | float — The upper bounding surface, as a scalar (flat cut) or as a DataArray on the horizontal coords ofda(tilted cut).bottomxr.DataArray | float — The lower bounding surface, with the same conventions astop.
da but with coordinate values uniformly spanning [0, 1].