GameraInputUnitsMapManager

class PlasmaCalcs.hookups.mage.gamera.gamera_units.GameraInputUnitsMapManager(u=None, units=None, **kw_super)

Bases: InputUnitsMapManager

InputUnitsMapManager for gamera.

Methods

get_behavior([keys])

return value of self.behavior.

init_units_manager([units])

initialize self.u, the UnitsManager for this GameraCalculator instance.

record_units(array)

return array.assign_attrs(self.units_meta()).

u_from_input(var)

return conversion factor from "input units" to self.units for var.

units_meta()

return dict(units=self.units).

Attributes

behavior

dict of {attr: self.attr} for attr in self.behavior_attrs.

behavior_attrs

list of attrs in self which control behavior of self.

cls_behavior_attrs

input_units_map

the current input units map being used by self.

input_units_map_key

the key to use for self.input_units_maps to get the current input units map.

input_units_maps

nondim_behavior_attrs

list of attrs in self which control behavior of self, but which are NOT in self.dimensions.

u

the current units manager for self.

units

the current unit system for self.

units_id

tells units id string for self, e.g. 'EARTH'.

property behavior

dict of {attr: self.attr} for attr in self.behavior_attrs. Note dims are separate;

dims go in behavior.dims. E.g. Behavior({‘units’:’si’,…}, dims={‘snap’:0,…}).
property behavior_attrs

list of attrs in self which control behavior of self.

Here, returns self.cls_behavior_attrs.
Subclasses could override if any behavior attrs are not known at the class-level,
e.g. if MySubclass’s list of behavior attrs varies between instances of MySubclass.
get_behavior(keys=None)

return value of self.behavior.

keys: None or iterable
if provided, only include these attrs.
from nondim_behavior_attrs, or dims.
init_units_manager(units='si')

initialize self.u, the UnitsManager for this GameraCalculator instance.

property input_units_map

the current input units map being used by self.

property input_units_map_key

the key to use for self.input_units_maps to get the current input units map.

Here, this is just an alias to self.units_id.
(see help(self.u_from_input) for more details.)
property nondim_behavior_attrs

list of attrs in self which control behavior of self, but which are NOT in self.dimensions.

record_units(array)

return array.assign_attrs(self.units_meta()).

if array is not an xarray.DataArray, convert it first.
property u

the current units manager for self.

if not yet initialized, getting self.u will create (and store) a new UnitsManager().
u_from_input(var)

return conversion factor from “input units” to self.units for var.

Example: if self.input_units_map = InputUnitsMap({‘B’: (‘b_field’, 1e-9), …})
then self.u_from_input(‘B’) == 1e-9 * si_to_self_units
where si_to_self_units = self.u(‘b_field’, units=self.units, convert_from=’si’).
Thus, multiplying ‘input’ B values (which are in ‘input units’ of [nT])
by self.u_from_input(‘B’) will give values in self.units system.
property units

the current unit system for self. E.g., ‘si’. (this is an alias to self.u.units)

property units_id

tells units id string for self, e.g. ‘EARTH’.

units_meta()

return dict(units=self.units).