xbout.xarraybackend.BoutADIOSBackendArray

class xbout.xarraybackend.BoutADIOSBackendArray(shape, dtype, lock, adiosfile, varname, *, cast_dtype=None)[source]

Bases: BackendArray

Lazily indexed array backed by an ADIOS2 Variable.

xarray calls __getitem__ with an ExplicitIndexer; this class maps the indexer into ADIOS2 set_step_selection (for time/steps) and set_selection (for spatial dimensions), then reads the selection.

Parameters:
  • shape (list)

  • dtype (np.dtype)

  • adiosfile (FileReader)

  • varname (str)

  • cast_dtype (np.dtype | None)

__init__(shape, dtype, lock, adiosfile, varname, *, cast_dtype=None)[source]
Parameters:
  • shape (list) – Full xarray-visible shape. If the ADIOS2 variable has steps, the first dimension is the synthetic xarray time dimension.

  • dtype (np.dtype) – Numpy dtype used by ADIOS2 for the stored variable.

  • lock – Optional lock for thread-safety. ADIOS2 reads are not thread-safe.

  • adiosfile (FileReader) – Open ADIOS2 FileReader handle.

  • varname (str) – Name of the ADIOS2 variable to read.

  • cast_dtype (np.dtype | None) – Optional dtype to cast to after reading (used to round-trip types that are stored differently on disk, e.g. bool stored as uint8).

Methods

__init__(shape, dtype, lock, adiosfile, ...)

async_get_duck_array([dtype])

async_getitem(key)

get_duck_array([dtype])

Attributes

ndim

Number of array dimensions.

size

Number of elements in the array.