Abstract: An overview of using HAPI to access Swarm data, and using hapiclient within the VRE. HAPI has been added to the VirES server as an alternative interface to the main VirES API. The Heliophysics Application Programming Interface (HAPI) is a community specification of a unified interface for accessing data time-series. VirES for Swarm acts as a HAPI server and allows access to selected datasets via the HAPI interface. This enables more interoperability with other analysis tools.
:::{admonition} Learn more about HAPI :class: seealso
:::
Only a few Swarm datasets are currently available through HAPI, but more will be available soon. HAPI is a more limited interface than the full VirES API so there is no access to special VirES features like magnetic model handling, resampling, and filtering.
Data is available at simple endpoints following /hapi/
and the interface is open so there is no authentication needed. For example:
!curl 'https://vires.services/hapi/data?dataset=SW_OPER_MAGA_LR_1B¶meters=Latitude,B_NEC&start=2013-11-25T11:02:52Z&stop=2013-11-25T11:03:02Z&format=csv'
hapiclient is a Python client that interfaces with HAPI servers. It can be used like:
from hapiclient import hapi
server = 'https://vires.services/hapi';
dataset = 'SW_OPER_MAGA_LR_1B';
parameters = 'Latitude,B_NEC';
start = '2013-11-25T11:02:52Z';
stop = '2013-11-25T11:03:02Z';
data, meta = hapi(server, dataset, parameters, start, stop)
Data and metadata are returned separately as a NumPy Structured Array and dictionary.
data["Timestamp"]
data["B_NEC"]
For more help, see: