Why use sdf-xarray?

Why use sdf-xarray?#

sdf_xarray is a Python package that allows you to load EPOCH SDF files into structured N-D labelled datasets (xarray). We leverage the underlying SDF-C library to convert the binary SDF files to xarray.Dataset. This package might not work as expected when loading datasets so please check the Known Issues page first before raising a GitHub Issue.

There are several benefits to using this package over the sdf_helper including:

  • data to numpy and pandas - Data can be easily converted to numpy or pandas if you prefer to work with raw data.

  • data labelling - All SDF files come with a bunch of information about them such as the dimensions, units and name of the variable. In xarray these are added to each variable making it much easier to read.

  • lazy/partial loading - This reduces the RAM requirements when loading large SDF files as we only load the actual array values when they are needed.

  • plotting - You can easily plot variables across several dimensions including time using built in matplotlib support.

  • animating - Visualise your data across time or slice through another dimension and make beautiful GIFs for your presentations.

  • deck loading - sdf_xarray automatically loads in the associated input.deck utilised when creating the simulation so that you can access setup variables.

  • easier unit conversion - Convert dimensions and variable units to other types with the help of pint.