sdf_xarray.open_datatree#
- sdf_xarray.open_datatree(path, *, keep_particles=False, probe_names=None)[source]#
An
xarray.DataTreeis constructed utilising the original names in the SDF file. This is due to the fact that these names include slashes whichxarraycan use to automatically build up a datatree. We do additionally replace spaces with underscores to be more pythonic. You can find thexarray.Datasetname under theattrs["flat_structure_name"]for referencing.In some cases the user may output the
always + speciesdumpmask which means that SDF variable will have species data plus a general one. When defining axarray.DataTreeyou 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 namednode/All(see example ofDervied/Number_Density/Allin below table)Below are some examples of how variable names are translated from the regular
xarray.open_datasetresult into their more traditional names.Dataset variable name
DataTree variable name
Derived_Number_DensityDerived/Number_Density/AllDerived_Number_Density_ElectronDerived/Number_Density/ElectronDerived_Number_Density_IonDerived/Number_Density/IonDerived_Number_Density_PhotonDerived/Number_Density/PhotonDerived_Average_Particle_EnergyDerived/Average_Particle_Energy- Parameters:
- Return type:
Examples
>>> dt = open_datatree("0000.sdf") >>> dt["Electric_Field"]["Ex"].values # Access all Electric_Field_Ex data