Space Physics made EASY
Speasy is a free and open-source Python package that makes it easy to find and load space physics data from a variety of data sources, whether online and public such as CDAWEB and AMDA, or any local or remote archive. Finding and loading data is where any science project starts. It would seem easy a priori but, considering the diverse array of missions and instruments available nowadays, it proves to be one of the major bottlenecks, especially for students and newcomers. Speasy solves this problem by providing a single, easy-to-use interface to over 70 space missions and 65,000 products.
Quickstart
Installing Speasy with pip (more details here):
$ python -m pip install speasy
# or
$ python -m pip install --user speasy
Getting data is as simple as:
import speasy as spz
ace_mag = spz.get_data('amda/imf', "2016-6-2", "2016-6-5")
ace_mag.plot()
Where amda is the data provider and imf is the product ID.
Using the dynamic inventory, this can be even more discoverable:
import speasy as spz
amda_tree = spz.inventories.data_tree.amda
ace_mag = spz.get_data(amda_tree.Parameters.ACE.MFI.ace_imf_all.imf, "2016-6-2", "2016-6-5")
This produces the same result as the previous example but lets you discover available data through tab-completion in IPython, Jupyter notebooks, or any Python environment that supports it.
This also works with SSCWEB, you can easily download trajectories:
import speasy as spz
sscweb_tree = spz.inventories.data_tree.ssc
solo = spz.get_data(sscweb_tree.Trajectories.solarorbiter, "2021-01-01", "2021-02-01")
More complex requests like this one are supported:
import speasy as spz
products = [
spz.inventories.tree.amda.Parameters.Wind.SWE.wnd_swe_kp.wnd_swe_vth,
spz.inventories.tree.amda.Parameters.Wind.SWE.wnd_swe_kp.wnd_swe_pdyn,
spz.inventories.tree.amda.Parameters.Wind.SWE.wnd_swe_kp.wnd_swe_n,
spz.inventories.tree.cda.Wind.WIND.MFI.WI_H2_MFI.BGSE,
spz.inventories.tree.ssc.Trajectories.wind,
]
intervals = [["2010-01-02", "2010-01-02T10"], ["2009-08-02", "2009-08-02T10"]]
data = spz.get_data(products, intervals)
Features
Simple and intuitive API (spz.get_data to get them all)
Pandas DataFrame like interface for variables (columns, values, index)
Quick functions to convert a variable to a Pandas DataFrame
Dynamic inventory to discover available data from your favourite Python environment completion
Speasy variables support NumPy operations
Speasy variables support filtering, resampling, and interpolation
Local cache to avoid redundant downloads
Can take advantage of SciQLop dedicated proxy as a community backed ultra fast cache
Full support of AMDA API
Can retrieve data from any local or remote archive with a simple configuration file
Also available as Speasy.jl for Julia users
Examples
See here for a complete list of examples.