AMReXDataArray
- class xamr.AMReXDataArray(parent_ds: AMReXDataset, field_name: str, selection_obj=None)[source]
Bases:
objectxarray-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)
Methods
__init__(parent_ds, field_name[, selection_obj])__getitem__(key)Index into the coarsest level data
level_select(level)Select specific AMR level(s)
spatial_select(**kwargs)Select spatial region across all levels
sel(**kwargs)xarray-like selection (spatial only for AMR)
max(**kwargs)Maximum across AMR structure
min(**kwargs)Minimum across AMR structure
mean(**kwargs)Volume-weighted mean across AMR structure
values([level])Get values as numpy array for a specific refinement level
Properties
Lazy load AMR data - returns yt YTArray
Get coordinate arrays for this data
Shape of the data at coarsest level
Private Methods
Load data at coarsest level for all time steps
- __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
- spatial_select(**kwargs) AMReXDataArray[source]
Select spatial region across all levels
- 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:
- Raises:
ValueError – If level is out of range