Skip to main content

A Python client for interacting with a VirES server

Project description

PyPI Conda Documentation Status https://zenodo.org/badge/138034133.svg
pip install viresclient
conda install -c conda-forge viresclient

viresclient is a Python package which connects to a VirES server, of which there are two: VirES for Swarm (https://vires.services) and VirES for Aeolus (https://aeolus.services), through the WPS interface. This package handles product requests and downloads, enabling easy access to data and models from ESA’s Earth Explorer missions, Swarm and Aeolus. This service is provided for ESA by EOX. For enquiries about the service and problems with accessing your account, please email info@vires.services. For help with usage, please email ashley.smith@ed.ac.uk (for Swarm data) or raise an issue on GitHub.

For code recipes and more, see Swarm Notebooks & Aeolus Notebooks. To start experimenting right away, viresclient is installed on the “Virtual Research Environment” (VRE), which is a managed Jupyter-based system provided for ESA by EOX. The service is free and open to all, accessible through your VirES account - check the notebooks to read more and get started.

Data and models are processed on demand on the VirES server - a combination of measurements from any time interval can be accessed. These are the same data that can be accessed by the VirES GUI. viresclient handles the returned data to allow direct loading as a single pandas.DataFrame, or xarray.Dataset.

from viresclient import SwarmRequest

# Set up connection with server
request = SwarmRequest()
# Set collection to use
# - See https://viresclient.readthedocs.io/en/latest/available_parameters.html
request.set_collection("SW_OPER_MAGA_LR_1B")
# Set mix of products to fetch:
#  measurements (variables from the given collection)
#  models (magnetic model predictions at spacecraft sampling points)
#  auxiliaries (variables available with any collection)
# Optionally set a sampling rate different from the original data
request.set_products(
    measurements=["F", "B_NEC"],
    models=["CHAOS-Core"],
    auxiliaries=["QDLat", "QDLon"],
    sampling_step="PT10S"
)
# Fetch data from a given time interval
# - Specify times as ISO-8601 strings or Python datetime
data = request.get_between(
    start_time="2014-01-01T00:00",
    end_time="2014-01-01T01:00"
)
# Load the data as an xarray.Dataset
ds = data.as_xarray()
<xarray.Dataset>
Dimensions:           (NEC: 3, Timestamp: 360)
Coordinates:
* Timestamp         (Timestamp) datetime64[ns] 2014-01-01 ... 2014-01-01T00:59:50
Dimensions without coordinates: NEC
Data variables:
  Spacecraft        (Timestamp) <U1 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A'
  Latitude          (Timestamp) float64 -1.229 -1.863 -2.496 ... 48.14 48.77
  Longitude         (Timestamp) float64 -14.12 -14.13 -14.15 ... 153.6 153.6
  Radius            (Timestamp) float64 6.878e+06 6.878e+06 ... 6.868e+06
  F                 (Timestamp) float64 2.287e+04 2.281e+04 ... 4.021e+04
  F_CHAOS-Core      (Timestamp) float64 2.287e+04 2.282e+04 ... 4.02e+04
  B_NEC             (Timestamp, NEC) float64 2.01e+04 -4.126e+03 ... 3.558e+04
  B_NEC_CHAOS-Core  (Timestamp, NEC) float64 2.011e+04 ... 3.557e+04
  QDLat             (Timestamp) float64 -11.99 -12.6 -13.2 ... 41.59 42.25
  QDLon             (Timestamp) float64 58.02 57.86 57.71 ... -135.9 -136.0
Attributes:
  Sources:         ['SW_OPER_MAGA_LR_1B_20140101T000000_20140101T235959_050...
  MagneticModels:  ["CHAOS-Core = 'CHAOS-Core'(max_degree=20,min_degree=1)"]
  RangeFilters:    []
https://github.com/ESA-VirES/Swarm-VRE/raw/master/docs/images/VRE_shortest_demo.gif

How to acknowledge VirES

You can reference viresclient directly using the DOI of our zenodo record. VirES uses data from a number of different sources so please also acknowledge these appropriately.

“We use the Python package, viresclient [1], to access […] from ESA’s VirES for Swarm service [2]”

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viresclient-0.12.0.tar.gz (219.0 kB view details)

Uploaded Source

Built Distribution

viresclient-0.12.0-py3-none-any.whl (98.3 kB view details)

Uploaded Python 3

File details

Details for the file viresclient-0.12.0.tar.gz.

File metadata

  • Download URL: viresclient-0.12.0.tar.gz
  • Upload date:
  • Size: 219.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for viresclient-0.12.0.tar.gz
Algorithm Hash digest
SHA256 419632ad4cfc7ca076780e5be69adb838375e4323959e1101285c5017d2a6ff8
MD5 d9ccc04e52f0f6370f379d0ca2cb665b
BLAKE2b-256 b63e6a02026ada66223cc8f296f0bfbd7d6421590e2ba18e27ff551cc4fd5641

See more details on using hashes here.

File details

Details for the file viresclient-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for viresclient-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2586d90d2a466dd8754d4dd55898d5fc3882a490c70d8eac8d1c5f64b9d0f4c5
MD5 244ee383752652113317aab0622dcbb3
BLAKE2b-256 7977ac291db6a746f7fc72520c4cf4c77f7a34ab7a03d963c767b65af46f2f91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page