Skip to content

Backend-specific methods§

The methods described in this section are exclusively applicable to specific data formats. In general, these methods can be accessed with:

xarray.DataArray.ozzy.<method>
xarray.Dataset.ozzy.<method>
Note for developers

These methods are defined within a mixin class called Methods which should be defined in each backend file (e.g. backends/ozzy_backend.py).

The methods in this class are accessible to a data object when <data_obj>.attrs['data_origin'] == 'ozzy'.

This class is currently empty.

The methods in this class are accessible to a data object when <data_obj>.attrs['data_origin'] == 'osiris'.

This class is currently empty.

The methods in this class are accessible to a data object when <data_obj>.attrs['data_origin'] == 'lcode'.

convert_q §

convert_q(dxi, n0, q_var='q')

Convert the charge variable to physical units (in units of \(e\)).

Parameters:

Name Type Description Default

dxi §

float

The grid spacing in the longitudinal direction in normalized units, i.e., in units of \(k_p^{-1}\). or \(\mathrm{cm}\).

required

n0 §

float

The reference density, in \(\mathrm{cm}^{-3}\).

required

q_var §

str

Name of the charge density variable.

'q'

Returns:

Type Description
None

The dataset is modified in place.

Notes

The charge in physical units (\(\mathrm{C}\)) is obtained by multiplying the normalized charge with the factor \(\frac{\Delta \hat{\xi}}{2} \frac{I_A}{\omega_p}\), where \(\Delta \hat{\xi} = k_p \Delta \xi\) is the normalized longitudinal cell size and \(I_A\) is the Alfvén current, defined as:

\[ I_A = 4 \pi \varepsilon_0 \frac{m_e c^3}{e} \approx 17.045 \ \mathrm{kA} \]

Note that the charge is given in units of the elementary charge \(e\) after this method is applied.

Examples:

Particle data
import ozzy as oz
ds = oz.open('lcode', [part example])
ds.ozzy.convert_q(dxi=0.01, n0=2e14, q_var='q')
print(ds)