Data object methods§
Different methods are available depending on the type of PIC data (e.g. grid versus particle data), and on the PIC code the data originates from (e.g. OSIRIS versus LCODE).
Please check the sections below for more details about all the available data object methods.
Calling a method on an ozzy data object§
Ozzy is implemented according to xarray's accessor model1. All the ozzy functionality built on top of xarray data objects (Datasets or DataArrays) can therefore be accessed via
xarray.DataArray.ozzy.<method>
xarray.Dataset.ozzy.<method>
Example
Saving a Dataset object:
import ozzy as oz
ds = oz.Dataset()
ds.ozzy.save('test.h5')
# -> Saved file "test.h5"
# -> 'save' took: 0:00:00.212650
Note for developers
Ozzy's custom methods are defined in two accessor classes:
ozzy.accessors.OzzyDataset
ozzy.accessors.OzzyDataArray
Strictly speaking, the path to each method should be for example ozzy.accessors.[OzzyDataset|OzzyDataArray].<method>
. However, this documentation page presents the methods as if they were under xarray.[Dataset|DataArray].ozzy.<method>
, which is effectively how the user can access them.
The methods in each accessor class can access the actual data object via <data_obj>.ozzy._obj
. This is only relevant when defining new methods in the accessor classes.
Example
import xarray as xr
import ozzy as oz
ds = xr.Dataset()
assert ds == ds.ozzy._obj
# True