sdf_xarray.open_datatree

Contents

sdf_xarray.open_datatree#

sdf_xarray.open_datatree(path, *, keep_particles=False, probe_names=None)[source]#

An xarray.DataTree is constructed utilising the original names in the SDF file. This is due to the fact that these names include slashes which xarray can use to automatically build up a datatree. We do additionally replace spaces with underscores to be more pythonic. You can find the xarray.Dataset name under the attrs["flat_structure_name"] for referencing.

In some cases the user may output the always + species dumpmask which means that SDF variable will have species data plus a general one. When defining a xarray.DataTree you cannot have a node of that tree contain both variable information and have leaves with variables so we move the node information to a leaf named node/All (see example of Dervied/Number_Density/All in below table)

Below are some examples of how variable names are translated from the regular xarray.open_dataset result into their more traditional names.

Dataset variable name

DataTree variable name

Derived_Number_Density

Derived/Number_Density/All

Derived_Number_Density_Electron

Derived/Number_Density/Electron

Derived_Number_Density_Ion

Derived/Number_Density/Ion

Derived_Number_Density_Photon

Derived/Number_Density/Photon

Derived_Average_Particle_Energy

Derived/Average_Particle_Energy

Parameters:
  • path (str | PathLike) – The path to the SDF file

  • keep_particles (bool) – If True, also load particle data (this may use a lot of memory!)

  • probe_names (list[str] | None) – List of EPOCH probe names

Return type:

DataTree

Examples

>>> dt = open_datatree("0000.sdf")
>>> dt["Electric_Field"]["Ex"].values  # Access all Electric_Field_Ex data