vslice#
- _HdfData.vslice(
- *args,
- unit=None,
- mesh=None,
- order=None,
- scales=True,
- bounds_error=True,
Read data by physical coordinate value with linear interpolation.
Extends
read()to accept physical coordinate values as positional arguments. A scalar,int, orQuantityargument for an axis locates the two nearest grid points and linearly interpolates to the target value. OnlyNoneandslicearguments are index-space and handled identically toread().Attention
When reading/slicing data, the
*argsare always supplied in physical (e.g. \((r, \theta, \phi)\)) order. However, unless specified with theorderargument, the sliced data array will be returned in storage order.Note
Unlike
read(), anintargument is treated as a physical coordinate value (in the axis’s native unit), not an array index. Use asliceto select by index.- Parameters:
- *args
QuantityLike|slice|None One argument per axis in physical
(r, t, p)order. AQuantity, bare scalar, orinttriggers interpolation to that coordinate value;Noneandsliceare index-space and do not interpolate.- unit
UnitLike|None, optional Output unit. Default is
None(code units).- mesh
MeshCodeType|None, optional Target stagger mesh. Default is
None.- order
ArrayOrdering|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), raiseValueErrorwhen a physical value is outside the coordinate range.
- *args
- Returns:
- Raises:
ValueErrorIf bounds_error is
Trueand 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)