Skip to content

Commit b113f7e

Browse files
authored
Improve installation instructions (#134)
1 parent 7582cc6 commit b113f7e

File tree

7 files changed

+179
-38
lines changed

7 files changed

+179
-38
lines changed

README.rst

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. image:: https://img.shields.io/pypi/pyversions/viresclient
2+
:target: https://pypi.org/project/viresclient/
3+
:alt: Python Version
14

25
.. image:: https://img.shields.io/pypi/v/viresclient
36
:target: https://pypi.org/project/viresclient/
@@ -14,27 +17,36 @@
1417
.. image:: https://zenodo.org/badge/138034133.svg
1518
:target: https://zenodo.org/badge/latestdoi/138034133
1619

17-
::
18-
19-
pip install viresclient
20-
21-
::
22-
23-
conda install -c conda-forge viresclient
24-
25-
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`_.
20+
``viresclient`` is a Python package which provides access to products (including on-demand processing) from two of 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 or `raise an issue on GitHub`_.
2621

27-
.. _viresclient: https://github.com/ESA-VirES/VirES-Python-Client
2822
.. _WPS: http://www.opengeospatial.org/standards/wps
2923
.. _Swarm: https://earth.esa.int/eogateway/missions/swarm
3024
.. _Aeolus: https://earth.esa.int/eogateway/missions/aeolus
31-
.. _EOX: https://eox.at/category/vires/
25+
.. _EOX: https://eox.at/tag/vires/
3226
.. _`raise an issue on GitHub`: https://github.com/ESA-VirES/VirES-Python-Client/issues
3327

34-
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.
28+
There are two VirES services (Virtual environments for Earth Scientists) which *viresclient* can communicate with:
3529

36-
.. _`Swarm Notebooks`: https://notebooks.vires.services
37-
.. _`Aeolus Notebooks`: https://notebooks.aeolus.services
30+
- *VirES for Swarm:*
31+
32+
- Interact with the `VirES for Swarm graphical interface (web client) <https://vires.services>`_
33+
- Browse code recipes: `Swarm Notebooks <https://notebooks.vires.services>`_
34+
- JupyterHub: `Swarm VRE (Virtual Research Environment) <https://vre.vires.services>`_
35+
- Swarm data documentation: `Swarm handbook <https://swarmhandbook.earth.esa.int>`_
36+
- *Note that this service is not only for Swarm*:
37+
38+
- Multi-mission products including magnetometry from CHAMP, CryoSat-2, and more
39+
- INTERMAGNET ground magnetometers via the ``AUX_OBS`` collection
40+
- Custom geomagnetic model evaluation
41+
42+
- Read more about the ecosystem: `Python tools for ESA's Swarm mission: VirES for Swarm and surrounding ecosystem <https://doi.org/10.3389/fspas.2022.1002697>`_
43+
44+
- *VirES for Aeolus:*
45+
46+
- Interact with the `VirES for Aeolus graphical interface (web client) <https://aeolus.services>`_
47+
- Browse code recipes: `Aeolus Notebooks <https://notebooks.aeolus.services>`_
48+
- JupterHub: `Aeolus VRE <https://vre.aeolus.services>`_
49+
- `Aeolus data documentation <https://earth.esa.int/eogateway/missions/aeolus/data>`_
3850

3951
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_.
4052

@@ -109,3 +121,7 @@ You can reference *viresclient* directly using the DOI of our zenodo_ record. Vi
109121
| "We use the Python package, viresclient [1], to access [...] from ESA's VirES for Swarm service [2]"
110122
| [1] https://doi.org/10.5281/zenodo.2554162
111123
| [2] https://vires.services
124+
125+
You can also cite this paper:
126+
127+
| 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. doi: 10.3389/fspas.2022.1002697

docs/available_parameters.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ NB: When using model names containing a hyphen (``-``) then extra single (``'``)
361361

362362
----
363363

364+
.. _Swarm auxiliaries:
365+
364366
``auxiliaries``
365367
---------------
366368

docs/capabilities.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,22 @@ VirES provides more than just *access* to data. Some operations can be peformed
2222
| :py:meth:`viresclient.SwarmRequest.get_orbit_number`
2323
| :py:meth:`viresclient.SwarmRequest.get_times_for_orbits`
2424
| :py:meth:`viresclient.SwarmRequest.get_collection_info`
25+
**Auxiliary information**
26+
| e.g. geomagnetic coordinates (``QDLat``), orbit ascending/descending (``OrbitDirection``), geomagnetic activity (``Kp, Dst, dDst``), solar position (``SunZenithAngle``), ...
27+
| See :ref:`Swarm auxiliaries<Swarm auxiliaries>`
2528
**Geomagnetic model evaluation**
26-
| Forwards evaluation of magnetic field models when a magnetic dataset is selected (e.g. ``MAGx_LR``). For more detail, see :ref:`Geomagnetic model handling`.
27-
| :py:meth:`viresclient.SwarmRequest.available_models`
28-
| :py:meth:`viresclient.SwarmRequest.get_model_info`
29-
| `models` option in :py:meth:`viresclient.SwarmRequest.set_products`
29+
30+
- Forward evaluation of magnetic field models when a magnetic dataset is selected (e.g. ``MAGx_LR``) and using the `models` option in :py:meth:`viresclient.SwarmRequest.set_products`
31+
- Model evaluation at user-provided coordinates. See:
32+
33+
- :py:meth:`viresclient.SwarmRequest.eval_model`
34+
- :py:meth:`viresclient.SwarmRequest.eval_model_for_cdf_file`
35+
36+
- For more detail, see :ref:`Geomagnetic model handling`, and:
37+
38+
- :py:meth:`viresclient.SwarmRequest.available_models`
39+
- :py:meth:`viresclient.SwarmRequest.get_model_info`
40+
3041
**Identifying conjunctions between spacecraft**
3142
| :py:meth:`viresclient.SwarmRequest.get_conjunctions`
3243
**Synchronous and asynchronous processing**

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# -- Project information -----------------------------------------------------
1717

1818
project = "viresclient"
19-
copyright = "2018, Ashley Smith"
19+
copyright = "2025, Ashley Smith"
2020
author = "Ashley Smith"
2121

2222

docs/geomagnetic_models.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ The geomagnetic models provided by VirES are all based on spherical harmonics, t
88

99
In VirES, we provide model evaluations calculated at the same sample points as the data products. This means that the spherical harmonic expansion is made at the time and location of each datapoint (e.g. in the case of ``MAGx_LR``, at every second). The main purpose is to provide the data-model residuals, or magnetic perturbations, useful for studying the external magnetic field, typically ionospheric in origin.
1010

11-
*Pending:* In a future VirES release, some interpolation will be used to provide the magnetic model predictions along the 50Hz ``MAGx_HR`` products (to improve speed). The predictions at the 1Hz (``MAGx_LR``) locations will be used and a cubic interpolation performed to provide the predictions at the 50Hz locations.
11+
The magnetic data products provide the magnetic field vector as the parameter ``B_NEC`` in the geocentric NEC (North, East, Centre) frame, as well as the magnetic field intensity/magnitude (scalar), ``F``. When requesting models from VirES (by supplying the ``models`` kwarg to :py:meth:`viresclient.SwarmRequest.set_products`), the corresponding model predictions will be returned in parameters named ``B_NEC_<model-name>`` or ``F_<model-name>``. Alternatively, the data-model residual alone, named ``B_NEC_res_<model-name>`` or ``F_res_<model-name>`` can be returned directly by also supplying the kwarg ``residuals=True``. Models should be provided as a list, like ``models=["CHAOS", "IGRF"]``.
1212

13-
The magnetic data products provide the magnetic field vector as the parameter ``B_NEC`` in the NEC (North, East, Centre) frame, as well as the magnetic field intensity/magnitude (scalar), ``F``. When also requesting models from VirES (by supplying the ``models`` kwarg to :py:meth:`viresclient.SwarmRequest.set_products`), the corresponding model predictions will be returned in parameters named ``B_NEC_<model-name>`` or ``F_<model-name>``. Alternatively, the data-model residual alone, named ``B_NEC_res_<model-name>`` or ``F_res_<model-name>`` can be returned directly by also supplying the kwarg ``residuals=True``. Models should be provided as a list, like ``models=["CHAOS", "IGRF"]``.
13+
When using high rate 50Hz ``MAGx_HR`` products, interpolatation is used to improve speed. The predictions at the 1Hz (``MAGx_LR``) locations are used and a cubic interpolation performed to provide the predictions at the 50Hz locations. This should be accurate enough for applications that we are aware of. To disable this interpolation, use ``do_not_interpolate_models=True`` in :py:meth:`viresclient.SwarmRequest.set_products`.
14+
15+
To evaluate models at arbitrary times and locations, see: :py:meth:`viresclient.SwarmRequest.eval_model` and :py:meth:`viresclient.SwarmRequest.eval_model_for_cdf_file`.
1416

1517
Available models
1618
----------------
@@ -88,7 +90,8 @@ The predictions for these models are cached only at the positions and times defi
8890

8991
The logic describing when the cache is used is as follows:
9092

91-
.. image:: https://mermaid.ink/img/pako:eNqFkk1v2zAMhv8KoVMLND20PRlDiyYxugKxW6wekCAeBkZiEgGyFEhUt6Dpf5_8kSw7zQdDfvnyISnzQ0inSGRibdwvuUXPUE1rC-l5vChSyIB0dq030SNrZx8uhyCMRveHN0ar0KsDjM_lSQzsmgMsenF8UemGjLaUWO_kScFqDxLllh6-rPz9pD21ZRi1DWCQKTA0bfFjuXHHXVA4wPxcKd2pSv-eL78H6tk_emWxzN_RxATtkUkerC0B5jfD183fLpWjANYx0G-UbPbQIMvtWcd0vblOBjsqHp9-zr7BzjsVJUMgQ5JJXR6ZXZMvvCV_9KQBbv-JtoivJ0RLf83L6XP5lEH5UsEir-C5eJ3lRV5W-TSl3w3pt8tZahY9aMvkd850P6gFxKDtBvrehluY3y0ncaUlhF034v9yxJVoyDeoVdqNj5ZRizRGQ7XI0lHRGqPhWtT2M1njTqX7zZVm50W2RhPoSmBk97a3UmTsIx1NU40bj83JRV1S0S9ht4uffwB28dYw?type=png
93+
.. image:: https://mermaid.ink/img/pako:eNqFUstu2zAQ_BWCpwSQDT0jWwgSxE7QHuIGSFLAjlUUNLmWCEikwUca1_a_l3ql7qk6EOTM7sysyAOmkgHO8LaSv2hJlEGv97lA7ru7WDiqQlSKLS-sIoZLcXvZk2g0ujm-GCIYUeyIZufw3Goj6yNadeDs4pXXUHEBTusdFDC02SNKaAm31xt1M292jY0hXGhUEQPaoLoxH-xmre4K9BEtz5Fv8tOlW5fr7xo67R8dslo_vJPKOtFO0sF9aaOAlmF_Cv-mZBI0EtIg-CDUVHtUE0PLs8QwLsauQIwWd19-Pj6jnZLMUoM0VEANsMtBsw35ZEpQQ40bIPqHbSS-Pp_RcU9H60cXhijEhQG1k1V7AY291VwUqPPup1zG67ndcIr0rh3hfz3YwzWomnDm7v7QaOTYxawhx5nbMtgSW5kc5-LkSok18mUvKM6MsuBhJW1R4mxLKu1Odsfc373npFCk_kR3RLxJWQ8thWqs-nYQDNRcWmFwduW3tTg74A-cBUE6TtMoTdJpFCepHwUe3js49cdX08T30yiMw2CSJicP_27lHRH7gR8nwXQyjf0wnngYGDdSLbqX3T7wIeVDy_QhT38AUx3zUQ?type=png
94+
https://mermaid.live/edit#pako:
9295
:alt: Flowchart showing the cache usage logic
9396

9497
*Custom* configured models, e.g. ``CHAOS-Static(max_degree=80)``, are not cached and must be evaluated directly.

docs/installation.rst

Lines changed: 123 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,123 @@ Installation and First Usage
33

44
.. note:: For VRE users (it's free! read more: `Swarm <https://notebooks.vires.services>`_, `Aeolus <https://notebooks.aeolus.services>`_), viresclient is already installed and configured so skip these steps
55

6-
1. Installation
7-
---------------
6+
1. Installation and updating
7+
----------------------------
88

9-
Python ≥ 3.6 is required. Testing is primarily on Linux, but macOS and Windows should also work. Available through both pip and conda (conda-forge).
9+
The package is available through both pip (PyPI) and conda (conda-forge). To add viresclient to an existing environment, use your preferred tool:
1010

1111
.. tabs::
1212

1313
.. group-tab:: pip
1414

15+
To install:
16+
17+
.. code-block:: sh
18+
19+
python -m pip install viresclient
20+
21+
To update:
22+
23+
.. code-block:: sh
24+
25+
python -m pip install --upgrade viresclient
26+
27+
.. tip::
28+
29+
If you are using an online notebook (e.g. Jupyter, Google Colab), you can run (in a notebook cell):
30+
31+
.. code-block:: sh
32+
33+
%pip install --upgrade viresclient
34+
35+
.. group-tab:: uv
36+
37+
To install:
38+
39+
(Assuming you use a `uv project <https://docs.astral.sh/uv/guides/projects/>`_)
40+
1541
.. code-block:: sh
1642
17-
pip install viresclient
43+
uv add viresclient
44+
45+
To update:
46+
47+
.. code-block:: sh
48+
49+
uv sync --upgrade-package viresclient
1850
1951
.. group-tab:: conda
2052

53+
To install:
54+
2155
.. code-block:: sh
2256
2357
conda install --channel conda-forge viresclient
2458
59+
To update:
60+
61+
.. code-block:: sh
62+
63+
conda update --channel conda-forge viresclient
64+
2565
.. group-tab:: mamba
2666

67+
To install:
68+
2769
.. code-block:: sh
2870
2971
mamba install --channel conda-forge viresclient
3072
73+
To update:
74+
75+
.. code-block:: sh
76+
77+
mamba update --channel conda-forge viresclient
78+
79+
3180
Recommended setup if starting without Python already
3281
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3382

34-
There are many ways to work with Python. We recommend using conda/mamba to manage your programming environment because of the availability of many data science packages through conda.
83+
There are many ways to work with Python. Depending on your computing environment, we recommend using either:
84+
85+
- `uv <https://docs.astral.sh/uv/>`_: if your project relies specifically on Python packages (available via `PyPI <https://pypi.org/>`_) and you can use a system package manager (e.g. apt) to manage non-Python dependencies
86+
- `Mamba <https://mamba.readthedocs.io/>`_ or `conda <https://docs.conda.io/projects/conda/>`_: which also manage non-Python dependencies (from `conda-forge <https://conda-forge.org/>`_)
87+
88+
- Use mamba preferably. It is a drop-in replacement for conda and is separate from Anaconda Inc.
89+
- Use conda if you have an existing Anaconda or Miniconda installation
90+
- `Pixi <https://pixi.sh/>`_: a newer tool that provides reproducible environments with lock files; works with both conda and pip packages (integrates with uv)
91+
92+
This guidance is appropriate for unix-like platforms (macOS & Linux & WSL). If you are using Windows, we recommend using `Windows Subsystem for Linux (WSL) <https://learn.microsoft.com/en-us/windows/wsl/>`_. While viresclient is compatible with Windows, you will get a more consistent experience with the scientific Python ecosystem by using WSL.
3593

3694
.. tabs::
3795

96+
.. group-tab:: uv
97+
98+
1. `Install uv <https://docs.astral.sh/uv/getting-started/installation>`_
99+
2. Create a new `project <https://docs.astral.sh/uv/guides/projects/>`_::
100+
101+
uv init --python 3.12 my-science-project
102+
103+
3. Enter the project and add some packages (including viresclient)::
104+
105+
cd my-science-project
106+
uv add viresclient scipy matplotlib cartopy
107+
108+
4. Run code within the uv-managed environment. Either:
109+
110+
- Use `uv run <https://docs.astral.sh/uv/guides/scripts/>`_ to run scripts
111+
- Activate the environment manually (``source .venv/bin/activate``)
112+
- Configure your IDE to use this environment
113+
- `Launch JupyterLab together with your project's dependencies <https://docs.astral.sh/uv/guides/integration/jupyter/>`_::
114+
115+
cd my-science-project
116+
uv run --with jupyter jupyter lab
117+
118+
You should avoid using pip to install or update packages. By instead using ``uv add <package>``, or ``uv sync --upgrade-package <package>``, this lets uv track your project's dependencies (via the ``pyproject.toml`` file) and the exact versions used (via the ``uv.lock`` file) to help with safer updates and additions to the environment, and to ensure reproducibility.
119+
38120
.. group-tab:: conda
39121

40-
1. Install Miniconda: https://docs.conda.io/en/latest/miniconda.html
122+
1. (If you do not have conda already) Install Miniconda: https://docs.conda.io/en/latest/miniconda.html
41123

42124
2. Set the conda-forge channel as the priority to install packages from::
43125

@@ -46,28 +128,55 @@ There are many ways to work with Python. We recommend using conda/mamba to manag
46128

47129
You should do this to avoid mixing packages from the anaconda channel (which can result in broken environments), and try to get all packages from conda-forge where available for consistency.
48130

49-
3. Create a new conda environment with some recommended packages, including viresclient::
131+
3. Create a new environment with some packages (including viresclient)::
50132

51-
conda create --name myenv python=3.10 jupyterlab scipy matplotlib pandas xarray cartopy h5py netCDF4 pytables ipywidgets viresclient
133+
conda create --name myenv python=3.12 jupyterlab scipy matplotlib cartopy viresclient
52134

53135
4. Activate the new environment (you do this each time you want to use it)::
54136

55137
conda activate myenv
56138

57-
.. group-tab:: mamba
139+
5. Or run a command directly from within the environment (without needing to activate it), e.g.::
140+
141+
conda run -n myenv jupyter lab
58142

59-
`Mamba <https://mamba.readthedocs.io/>`_ is a drop-in replacement for conda. You can install it into an existing (base) conda environment (``conda install -c conda-forge mamba``) and then just use ``mamba`` in place of ``conda`` in any commands - mamba is significantly faster. You can also install *mambaforge* directly to get mamba and conda-forge immediately configured in the base environment.
143+
.. group-tab:: mamba
60144

61-
1. Download and install the `mambaforge installer <https://github.com/conda-forge/miniforge#mambaforge>`_ or check the `mamba documentation <https://mamba.readthedocs.io/en/latest/installation.html>`_
145+
1. Download and install `Miniforge <https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html>`_
62146

63-
2. Create a new environment for your development work::
147+
2. Create a new environment with some packages (including viresclient)::
64148

65-
mamba create --name myenv python=3.10 jupyterlab scipy matplotlib pandas xarray cartopy h5py netCDF4 pytables ipywidgets viresclient
149+
mamba create --name myenv python=3.12 jupyterlab scipy matplotlib cartopy viresclient
66150

67-
3. Activate it to use it::
151+
3. Activate the new environment (you do this each time you want to use it)::
68152

69153
mamba activate myenv
70154

155+
4. Or run a command directly from within the environment (without needing to activate it), e.g.::
156+
157+
mamba run -n myenv jupyter lab
158+
159+
160+
.. group-tab:: docker
161+
162+
viresclient is available in several publicly available (experimental) Docker images:
163+
164+
- `Swarm DISC SwarmPAL processor (swarmpal-processor) <https://github.com/Swarm-DISC/SwarmPAL-processor/pkgs/container/swarmpal-processor>`_
165+
- `Python in Heliophysics Community environment (pyhc-environment) <https://hub.docker.com/r/spolson/pyhc-environment>`_
166+
167+
.. group-tab:: cloud / online
168+
169+
Online services provide access to a range of scientific software within a Jupyter environment. viresclient may be pre-installed or can be added as above.
170+
171+
- `ESA Swarm VRE <https://vre.vires.services/>`_
172+
173+
- Run by us in connection with VirES (free self-signup, included with your VirES account)
174+
- `ESA Datalabs <https://datalabs.esa.int/>`_
175+
176+
- Requires an authorised ESA Cosmos account
177+
- `HelioCloud <https://heliocloud.org/>`_
178+
179+
- In development
71180

72181
2. First usage / Configuration
73182
------------------------------

0 commit comments

Comments
 (0)