xamr.AMReXDataArray

class xamr.AMReXDataArray(parent_ds: AMReXDataset, field_name: str, selection_obj=None)[source]

xarray-like DataArray for AMR fields

Supports indexing at the coarsest refinement level with time as the leftmost index.

Indexing examples:

# Single time step data[10, 20] # z=10, y=20 (for 2D) data[10, 20, 30] # z=10, y=20, x=30 (for 3D)

# Time series data[0, 10, 20] # time=0, z=10, y=20 (for 2D) data[0, 10, 20, 30] # time=0, z=10, y=20, x=30 (for 3D)

# Slicing data[0, :, :] # time=0, all z,y (for 2D) data[:, 10, :] # all times, z=10, all y (for 2D)

__init__(parent_ds: AMReXDataset, field_name: str, selection_obj=None)[source]

Methods

__init__(parent_ds, field_name[, selection_obj])

level_select(level)

Select specific AMR level(s)

max(**kwargs)

Maximum across AMR structure

mean(**kwargs)

Volume-weighted mean across AMR structure

min(**kwargs)

Minimum across AMR structure

sel(**kwargs)

xarray-like selection (spatial only for AMR)

spatial_select(**kwargs)

Select spatial region across all levels

values([level])

Get values as numpy array for a specific refinement level

Attributes

coords

Get coordinate arrays for this data

data

Lazy load AMR data - returns yt YTArray

dims

shape

Shape of the data at coarsest level

__init__(parent_ds: AMReXDataset, field_name: str, selection_obj=None)[source]
__getitem__(key)[source]

Index into the coarsest level data

Parameters:

key – Index or slice. For time series, time index is leftmost. Spatial indices follow yt convention (z, y, x for 3D).

Returns:

Scalar value or numpy array depending on indexing

property data

Lazy load AMR data - returns yt YTArray

property coords

Get coordinate arrays for this data

property dims
property shape

Shape of the data at coarsest level

level_select(level: int | List[int]) AMReXDataArray[source]

Select specific AMR level(s)

spatial_select(**kwargs) AMReXDataArray[source]

Select spatial region across all levels

sel(**kwargs)[source]

xarray-like selection (spatial only for AMR)

max(**kwargs)[source]

Maximum across AMR structure

min(**kwargs)[source]

Minimum across AMR structure

mean(**kwargs)[source]

Volume-weighted mean across AMR structure

values(level: int | None = None) numpy.ndarray[source]

Get values as numpy array for a specific refinement level

Parameters:

level – AMR level to extract values from. If None, uses coarsest level (level 0). Must be between 0 and max_level.

Returns:

Field values at the specified level. For time series data,

returns array with time as first dimension.

Return type:

numpy.ndarray

Raises:

ValueError – If level is out of range