PlasmaCalcs.dimensions.dimension_tools.dimension_value.DimensionSpecialValueSpecifier

class PlasmaCalcs.dimensions.dimension_tools.dimension_value.DimensionSpecialValueSpecifier(getter, *args__None, iseler=None, isel_cls=UNSET, **kw__None)

Bases: object

behaves in a special way when used to specify a dimension value:
dim.v = specifier –> dim.v = specifier.getter(dim.values)
dlist.get(specifier) –> specifier.getter(dlist)
(for DimensionSpecialValueSpecifier specifier,
Dimension dim, and DimensionValueList dlist.)
getter: str or callable
self specifies to use the dimension value(s): self.getter(dlist)
callable –> callable of 1 arg; will be passed dlist.
str –> use dlist.{getter}(). E.g. getter=’get_ion’ –> use dlist.get_ion().
internally stored at self.init_getter.
iseler: None, str, or callable
if provided, can use self in calls to PlasmaCalcs’ xarray_isel and xarray_sel,
commonly via array.pc.sel(dim=self) or array.pc.isel(dim=self).
None –> crash with InputError if used in xarray_isel or xarray_sel.
callable –> callable of 1 arg; will be passed list of coord values for dim,
(probably a list of DimensionValue objects, maybe converted to DimensionValueList).
must return index (or indexes) appropriate for xarray.isel.
str –> use dlist.{iseler}(), where dlist=isel_cls(list of coord values for dim).
E.g. iseler=’i_ions’, isel_cls=FluidList –> use FluidList(values).i_ions().
internally stored at self.init_iseler.
isel_cls: UNSET, None, or type
if provided, iseler calls use iseler(isel_cls(list of coord values for dim)),
else, iseler calls use iseler(list of coord values for dim).
(None –> set self.isel_cls = None. UNSET –> do not set self.isel_cls.)
__init__(getter, *args__None, iseler=None, isel_cls=UNSET, **kw__None)

Methods

__init__(getter, *args__None[, iseler, isel_cls])