Getting Started#
Installation#
Install sdf-xarray from PyPI with:
pip install sdf-xarray
or download this code locally:
git clone --recursive https://github.com/epochpic/sdf-xarray.git
cd sdf-xarray
pip install .
Interaction#
There are two main ways to load EPOCH SDF files into xarray objects: using the dedicated
sdf_xarray functions or using the standard xarray interface with our custom engine.
For examples of how to use these functions see Loading SDF files.
All code examples throughout this documentation are visualised using Jupyter notebooks so that you can interactively explore the datasets. To do this on your machine make sure that you have the necessary dependencies installed:
pip install "sdf-xarray[jupyter]"
Important
When loading SDF files, variables related to boundaries, cpu and output file
are excluded as they are problematic. If you wish to load these variables in see
Loading raw files.
Using sdf_xarray (Recommended)#
These functions are wrappers designed specifically for SDF data, providing the most straightforward experience:
Single files: Use
sdf_xarray.open_datasetorsdf_xarray.open_datatreeMultiple files: Use
sdf_xarray.open_mfdatasetorsdf_xarray.open_mfdatatreeRaw files: use
sdf_xarray.sdf_interface.SDFFile
Using xarray#
If you prefer using the native xarray functions, you can use the xarray.open_dataset,
xarray.open_datatree and xarray.open_mfdataset. Strangely there is no function in
xarray for xarray.open_mfdatatree.
These functions should all work out of the box as long as sdf_xarray is installed on your
system, if you are having issues with it reading files, you might need to pass the parameter
engine=sdf_engine when calling any of the above xarray functions.