vslice

vslice#

_HdfData.vslice(
*args,
unit=None,
mesh=None,
order=None,
scales=True,
bounds_error=True,
)[source]#

Read data by physical coordinate value with linear interpolation.

Extends read() to accept physical coordinate values as positional arguments. A scalar or Quantity argument for an axis locates the two nearest grid points and linearly interpolates to the target value. Index-space arguments (None, int, slice) are handled identically to read().

Attention

When reading/slicing data, the *args are always supplied in physical (e.g. \((r, \theta, \phi)\)) order. However, unless specified with the order argument, the sliced data array will be returned in storage order.

Parameters:
*argsQuantityLike | int | slice | None

One argument per axis in physical (r, t, p) order. Physical coordinate values trigger interpolation; index-space arguments do not.

unitUnitLike | None, optional

Output unit. Default is None (code units).

meshMeshCodeType | None, optional

Target stagger mesh. Default is None.

orderArrayOrdering | None, optional

Transpose output if it differs from storage order. Default is None.

scalesbool, optional

If True (default), return coordinate slices alongside the data.

bounds_errorbool, optional

If True (default), raise ValueError when a physical value is outside the coordinate range.

Returns:
dataQuantity

Interpolated or sliced data array.

*scalesQuantity

Sliced scales (only returned when scales is True).

Raises:
ValueError

If bounds_error is True and a physical value falls outside the coordinate range.

Examples

>>> # Extract the r = 2.5 solar radii surface
>>> data, r, t, p = reader.vslice(2.5 * u.R_sun)