Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install package
run: python -m pip install .[test]
run: uv sync ${{ github.event_name == 'schedule' && '--upgrade' || '--frozen' }} --group test
- name: Configure token access
run: |
viresclient set_token "https://vires.services/ows" ${{ secrets.VIRES_TOKEN_SWARM }}
viresclient set_default_server https://vires.services/ows
uv run viresclient set_token "https://vires.services/ows" ${{ secrets.VIRES_TOKEN_SWARM }}
uv run viresclient set_default_server https://vires.services/ows
- name: Test package
run: python -m pytest -ra
run: uv run pytest -ra
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ repos:
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
exclude: CITATION.cff

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
17 changes: 10 additions & 7 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
version: 2

# Set the OS, Python version and other tools you might need
# Use uv so that the uv.lock file is used for reproducibility
build:
os: ubuntu-24.04
tools:
python: "3.12"
jobs:
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Include PDF and ePub
formats: all

python:
install:
- method: pip
path: .
extra_requirements:
- docs
10 changes: 5 additions & 5 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ title: ESA-VirES/VirES-Python-Client
message: >-
Example citation:

“We use the Python package, viresclient [1], to access [ name the datasets ] from ESA's VirES for Swarm service [2]"
“We use the Python package, viresclient [1], to access [ name the datasets ] from ESA's VirES for Swarm service [2]".

[1] Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client (v0.14.1). Zenodo. Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client (v0.14.1). Zenodo. https://doi.org/10.5281/zenodo.2554162
[2] https://vires.services
[1] Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. https://doi.org/10.5281/zenodo.2554162.
[2] https://vires.services

You may also wish to cite this paper:
You may also wish to cite this paper:

Smith A.R.A., Pačes M. and Swarm DISC (2022) Python tools for ESA's Swarm mission: VirES for Swarm and surrounding ecosystem. Front. Astron. Space Sci. 9:1002697. https://doi.org/10.3389/fspas.2022.1002697
Smith A.R.A., Pačes M. and Swarm DISC (2022) Python tools for ESA's Swarm mission: VirES for Swarm and surrounding ecosystem. Front. Astron. Space Sci. 9:1002697. https://doi.org/10.3389/fspas.2022.1002697.

Please refer to the Swarm handbook for product references: https://swarmhandbook.earth.esa.int/
type: software
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ You can reference *viresclient* directly using the DOI of our zenodo_ record. Vi

“We use the Python package, viresclient [1], to access [ name the datasets... ] from ESA's VirES for Swarm service [2]"

[1] Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. https://doi.org/10.5281/zenodo.2554162
[1] Smith, A. R. A., Pačes, M., & Santillan, D. (2025). ESA-VirES/VirES-Python-Client. Zenodo. https://doi.org/10.5281/zenodo.2554162
[2] https://vires.services

(To follow best practices you should cite the specific version that you used - refer to the Zenodo page to find the correct DOI for that version)
Expand Down
9 changes: 9 additions & 0 deletions docs/_templates/sections/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<a href="https://swarmpal.readthedocs.io" class="link">SwarmPAL</a>
<a href="https://vires.services" target="_blank" class="link">VirES for Swarm↗</a>
<a href="https://vre.vires.services" target="_blank" class="link">Swarm JupyterHub↗</a>
<a href="https://dev.swarmdisc.org/dashboards/vires-query" target="_blank" class="link link-highlight">New! Query builder↗</a>
</div>
<div style="width: 100%; height: 5px;"></div>
<div class="section">
Expand Down Expand Up @@ -48,6 +49,14 @@
color: #1e90ff !important;
}

.custom-header-container .link-highlight {
background-color: #ffc107;
color: #333 !important;
border-radius: 4px;
font-weight: bold;
padding: 3px 8px;
}

.custom-header-container .link-selected {
margin: 0 5px;
padding: 5px 5px;
Expand Down
3 changes: 3 additions & 0 deletions docs/available_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ The available measurements are segregated according to the "collection" (essenti
- ``SW_FAST_MODx_SC_1B``
- ``SW_FAST_FACxTMS_2F``
- ``SW_FAST_TECxTMS_2F``
- ``SW_FAST_AEJxLPL_2F``
- ``SW_FAST_AEJxPBL_2F``
- ``SW_FAST_AOBxFAC_2F``

Collections are grouped according to a type containing similar measurements (i.e. the same product from different spacecraft). The collection type can be given to :py:meth:`viresclient.SwarmRequest.available_collections` to retrieve the full collection names. These cover the Swarm data products as below (replace x with A, B, or C for Alpha, Bravo, or Charlie):

Expand Down
6 changes: 6 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Release notes
Change log
----------

Changes from 0.15.2 to 0.16.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Fix usage of ``reshape=True`` when using ``AUX_OBSH`` collection (via creating an additional ``SiteCode`` data variable)
- Add more FAST product variants: ``SW_FAST_AEJxLPL_2F``, ``SW_FAST_AEJxPBL_2F``, ``SW_FAST_AOBxFAC_2F``

Changes from 0.15.1 to 0.15.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ maintainers = [
license = { file = "LICENSE" }
description = "A Python client for interacting with a VirES server"
readme = "README.rst"
requires-python = ">=3.7"
requires-python = ">=3.9"
classifiers = [
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering",
Expand Down Expand Up @@ -47,7 +47,7 @@ dependencies = [
"xarray >= 0.11.0",
]

[project.optional-dependencies]
[dependency-groups]
test = [
"pytest >=6",
]
Expand All @@ -56,10 +56,10 @@ dev = [
"nox >=2022",
]
docs = [
"Sphinx == 8.2",
"sphinx-book-theme == 1.1.4",
"sphinx-copybutton == 0.5.2",
"sphinx-tabs == 3.4.7",
"Sphinx == 8.2; python_version>='3.11'",
"sphinx-book-theme == 1.1.4; python_version>='3.11'",
"sphinx-copybutton == 0.5.2; python_version>='3.11'",
"sphinx-tabs == 3.4.7; python_version>='3.11'",
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/viresclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
from ._config import ClientConfig, set_token
from ._data_handling import ReturnedData, ReturnedDataFile

__version__ = "0.15.2"
__version__ = "0.16.0"
66 changes: 31 additions & 35 deletions src/viresclient/_client_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@
" https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field ",
),
"CHAOS-Core": (
"CHAOS-8 Core field (SH degrees 1-20)",
"CHAOS Core field (SH degrees 1-20)",
" http://www.spacecenter.dk/files/magnetic-models/CHAOS-8/ ",
),
"CHAOS-Static": (
"CHAOS-8 crust field (SH degrees 21-185)",
"CHAOS crust field (SH degrees 21-185)",
" http://www.spacecenter.dk/files/magnetic-models/CHAOS-8/ ",
),
"CHAOS-MMA-Primary": (
"CHAOS-8 Primary (external) magnetospheric field",
"CHAOS Primary (external) magnetospheric field",
" http://www.spacecenter.dk/files/magnetic-models/CHAOS-8/ ",
),
"CHAOS-MMA-Secondary": (
"CHAOS-8 Secondary (internal) magnetospheric field",
"CHAOS Secondary (internal) magnetospheric field",
" http://www.spacecenter.dk/files/magnetic-models/CHAOS-8/ ",
),
"CHAOS-MIO": (
"CHAOS-8 Ionospheric field",
"CHAOS Ionospheric field",
" http://www.spacecenter.dk/files/magnetic-models/CHAOS-8/ ",
),
"MF7": (
Expand All @@ -79,75 +79,59 @@
" http://www.spacecenter.dk/files/magnetic-models/LCS-1/",
),
"MCO_SHA_2C": (
"[Comprehensive Inversion]: Core field of CIY4",
"[Comprehensive Inversion]: Core field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mco_sha_2c",
" A comprehensive model of Earth’s magnetic field determined from 4 years of Swarm satellite observations, https://doi.org/10.1186/s40623-018-0896-3 ",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MCO/SW_OPER_MCO_VAL_2C_20131201T000000_20180101T000000_0401.ZIP ",
),
"MCO_SHA_2D": (
"[Dedicated Chain]: Core field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mco_sha_2d",
"An algorithm for deriving core magnetic field models from the Swarm data set, https://doi.org/10.5047/eps.2013.07.005 ",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MCO/SW_OPER_MCO_VAL_2D_20131126T000000_20180101T000000_0401.ZIP ",
),
"MLI_SHA_2C": (
"[Comprehensive Inversion]: Lithospheric field of CIY4",
"[Comprehensive Inversion]: Lithospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mli_sha_2c",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MLI/SW_OPER_MLI_VAL_2C_00000000T000000_99999999T999999_0401.ZIP",
),
"MLI_SHA_2D": (
"[Dedicated Chain]: Lithospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mli_sha_2d",
" Swarm SCARF Dedicated Lithospheric Field Inversion chain, https://doi.org/10.5047/eps.2013.07.008 ",
" Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MLI/SW_OPER_MLI_VAL_2D_00000000T000000_99999999T999999_0401.ZIP ",
),
"MLI_SHA_2E": (
"[Extended dedicated chain]: Lithospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mli_sha_2e",
" Joint inversion of Swarm, CHAMP, and WDMAM data ",
" https://swarm-diss.eo.esa.int/?do=download&file=swarm%2FLevel2longterm%2FMLI%2FSW_OPER_MLI_VAL_2E_00000000T000000_99999999T999999_0502.ZIP ",
),
"MMA_SHA_2C-Primary": (
"[Comprehensive Inversion]: Primary (external) magnetospheric field of CIY4",
"[Comprehensive Inversion]: Primary (external) magnetospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mma_sha_2c",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MMA/SW_OPER_MMA_VAL_2C_20131201T000000_20180101T000000_0401.ZIP",
),
"MMA_SHA_2C-Secondary": (
"https://swarmhandbook.earth.esa.int/catalogue/sw_mma_sha_2c",
"[Comprehensive Inversion]: Secondary (internal/induced) magnetospheric field of CIY4",
"[Comprehensive Inversion]: Secondary (internal/induced) magnetospheric field",
),
"MMA_SHA_2F-Primary": (
"[Fast-Track Product]: Primary (external) magnetospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mma_sha_2f",
" Rapid modelling of the large-scale magnetospheric field from Swarm satellite data, https://doi.org/10.5047/eps.2013.09.003 ",
),
"MMA_SHA_2F-Secondary": (
"[Fast-Track Product]: Secondary (internal/induced) magnetospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mma_sha_2f",
),
"MIO_SHA_2C-Primary": (
"[Comprehensive Inversion]: Primary (external) ionospheric field of CIY4",
"[Comprehensive Inversion]: Primary (external) ionospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mio_sha_2c",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MIO/SW_OPER_MIO_VAL_2C_00000000T000000_99999999T999999_0401.ZIP ",
),
"MIO_SHA_2C-Secondary": (
"[Comprehensive Inversion]: Secondary (external/induced) ionospheric field of CIY4",
"[Comprehensive Inversion]: Secondary (external/induced) ionospheric field",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mio_sha_2c",
),
"MIO_SHA_2D-Primary": (
"[Dedicated Chain]: Primary (external) ionospheric field, DIFI",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mio_sha_2d",
" Swarm SCARF dedicated ionospheric field inversion chain, https://doi.org/10.5047/eps.2013.08.006 ",
" First results from the Swarm Dedicated Ionospheric Field Inversion chain, https://doi.org/10.1186/s40623-016-0481-6 ",
" http://geomag.colorado.edu/difi-3 ",
"Validation: ftp://swarm-diss.eo.esa.int/Level2longterm/MIO/SW_OPER_MIO_VAL_2D_20131201T000000_20171231T235959_0402.ZIP ",
),
"MIO_SHA_2D-Secondary": (
"[Dedicated Chain]: Secondary (external/induced) ionospheric field, DIFI",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mio_sha_2d",
),
"AMPS": (
"AMPS - associated magnetic field, https://github.com/klaundal/pyAMPS",
"AMPS - Polar currents magnetic field, https://github.com/klaundal/pyAMPS",
"https://swarmhandbook.earth.esa.int/catalogue/sw_mio_sha_2e",
),
"MCO_SHA_2X": (
Expand Down Expand Up @@ -261,9 +245,9 @@
)

DATA_CITATIONS = {
"AUX_OBSH": "ftp://ftp.nerc-murchison.ac.uk/geomag/Swarm/AUX_OBS/hour/README",
"AUX_OBSM": "ftp://ftp.nerc-murchison.ac.uk/geomag/Swarm/AUX_OBS/minute/README",
"AUX_OBSS": "ftp://ftp.nerc-murchison.ac.uk/geomag/Swarm/AUX_OBS/second/README",
"AUX_OBSH": "https://auxobs-api.bgs.ac.uk/docs",
"AUX_OBSM": "https://auxobs-api.bgs.ac.uk/docs",
"AUX_OBSS": "https://auxobs-api.bgs.ac.uk/docs",
}

IAGA_CODES = CONFIG_SWARM.get("IAGA_CODES")
Expand Down Expand Up @@ -563,16 +547,28 @@ class SwarmRequest(ClientRequest):
],
"EEF": [f"SW_OPER_EEF{x}TMS_2F" for x in "ABC"],
"IPD": [f"SW_OPER_IPD{x}IRR_2F" for x in "ABC"],
"AEJ_LPL": [f"SW_OPER_AEJ{x}LPL_2F" for x in "ABC"],
"AEJ_LPL:Quality": [f"SW_OPER_AEJ{x}LPL_2F:Quality" for x in "ABC"],
"AEJ_LPL": [
*(f"SW_OPER_AEJ{x}LPL_2F" for x in "ABC"),
*(f"SW_FAST_AEJ{x}LPL_2F" for x in "ABC"),
],
"AEJ_LPL:Quality": [
*(f"SW_OPER_AEJ{x}LPL_2F:Quality" for x in "ABC"),
*(f"SW_FAST_AEJ{x}LPL_2F:Quality" for x in "ABC"),
],
"AEJ_LPS": [f"SW_OPER_AEJ{x}LPS_2F" for x in "ABC"],
"AEJ_LPS:Quality": [f"SW_OPER_AEJ{x}LPS_2F:Quality" for x in "ABC"],
"AEJ_PBL": [f"SW_OPER_AEJ{x}PBL_2F" for x in "ABC"],
"AEJ_PBL": [
*(f"SW_OPER_AEJ{x}PBL_2F" for x in "ABC"),
*(f"SW_FAST_AEJ{x}PBL_2F" for x in "ABC"),
],
"AEJ_PBS": [f"SW_OPER_AEJ{x}PBS_2F" for x in "ABC"],
"AEJ_PBS:GroundMagneticDisturbance": [
f"SW_OPER_AEJ{x}PBS_2F:GroundMagneticDisturbance" for x in "ABC"
],
"AOB_FAC": [f"SW_OPER_AOB{x}FAC_2F" for x in "ABC"],
"AOB_FAC": [
*(f"SW_OPER_AOB{x}FAC_2F" for x in "ABC"),
*(f"SW_FAST_AOB{x}FAC_2F" for x in "ABC"),
],
"AUX_OBSH": [
"SW_OPER_AUX_OBSH2_",
*[f"SW_OPER_AUX_OBSH2_:{code}" for code in IAGA_CODES],
Expand Down
Loading
Loading