SMOS
Download, readers and time series conversion for SMOS (Soil Moisture and Ocean Salinity) soil moisture data. Works great in combination with pytesmo.
The full documentation is available at smos.readthedocs.io. To cite this package, follow the Zenodo (DOI) badge above and export the citation there.
Supported products
| Product | Description | Download | Command group |
|---|---|---|---|
| SMOS L2 | ESA L2 soil moisture swaths (MIR_SMUDP2) | ESA FTP (EO Sign In account) | smos l2 |
| SMOS IC | INRAE-CESBIO SMOS-IC (CDF3S), 25 km | CATDS (no account) | smos ic |
| SMOS L3 | CATDS L3 soil moisture (CLF3S, CLF31, CLF33, CLF3E, CLF3D, CLF3M), 25 km | CATDS FTP (public account) | smos l3 |
| SMOS L4 RZSM | CATDS-CESBIO root zone soil moisture, 25 km | not included | smos l4 |
Installation
All dependencies are available via pip (Python >= 3.11):
pip install smos
The download programs use lftp, which must be
installed on your system (e.g. apt-get install lftp). The package can also
be installed into an existing conda environment, e.g. if you prefer installing
compiled dependencies such as netCDF4 or pyresample from conda-forge first.
Quickstart
All command line programs are available via smos <product> <command>, see
smos --help and e.g. smos l3 download --help. As an example, download 10
days of SMOS L3 daily soil moisture (ascending overpasses):
smos l3 download ./smos_l3 --product CLF3S --orbits ASC -s 2024-01-01 -e 2024-01-10
and convert the images over Europe into time series (5x5 degree cell files):
smos l3 reshuffle ./smos_l3/MIR_CLF3SA ./smos_l3_ts --parameters Soil_Moisture,Mean_Acq_Time_Days,Mean_Acq_Time_Seconds --bbox -11 34 43 71
Read an image and a time series in python:
from datetime import datetime
from smos.smos_l3.interface_l3 import SMOS_L3_Ds, SMOSL3Ts
ds = SMOS_L3_Ds('./smos_l3/MIR_CLF3SA', parameters='Soil_Moisture')
image = ds.read(datetime(2024, 1, 5))
sm = image.data['Soil_Moisture'] # global 2D array (584 x 1388)
ts = SMOSL3Ts('./smos_l3_ts', index_add_time=True).read(16.37, 48.21) # lon, lat
print(ts['Soil_Moisture'])
To keep the data up to date, download all images that are new since the last downloaded day (until today) and append them to the time series with
smos l3 update_img ./smos_l3 --product CLF3S --orbits ASC
smos l3 update_ts ./smos_l3/MIR_CLF3SA ./smos_l3_ts
The other products work the same way, see the documentation for details.
Docker image
For each release, a Docker image with the package and lftp is published to
the GitHub container registry:
docker run --rm -v /path/to/data:/data ghcr.io/tuw-geo/smos:latest smos l3 update_img /data/smos_l3
The container runs as a non-root user (uid 1000), pass e.g.
--user $(id -u):$(id -g) to access mounted data as your own user. To build
the image locally from the checked out version, run docker build -t smos ..
Development
Clone the repository including the test data submodule (requires git lfs) and install the package in editable mode with the test dependencies:
git clone --recurse-submodules git@github.com:TUW-GEO/smos.git
cd smos
pip install -e ".[testing]"
pytest
Contribute
We are happy if you want to contribute. Please raise an issue explaining what is missing or if you find a bug. We will also gladly accept pull requests against our master branch for new features or bug fixes:
- Fork the smos repository and create a feature branch from master.
- Add your feature or fix, including tests (we use pytest) and documentation
(numpy style docstrings, docs pages,
CHANGELOG.rst). - Format your code with
yapf(settings inpyproject.toml). - Submit a pull request to our master branch.
See AGENTS.md for more detailed development guidelines.
Metadata
Release files for smos 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| smos-0.5.tar.gz | 877.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smos-0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 966.8 kB
Release files / smos-0.5.tar.gz
| Download URL | smos-0.5.tar.gz |
|---|---|
| Size | 877.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94a0fddadae2d0157fba50cec55afe522430b13b22fda3918533bf5b55e514bc
|
|
BLAKE2b-256 checksum How to use checksums |
8ef1b6af359cbbde41987e2779f31277ffa9f9f335d3da59887377f5a1bba60f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / smos-0.5-py3-none-any.whl
| Download URL | smos-0.5-py3-none-any.whl |
|---|---|
| Size | 89.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ab948249540c4ee8a7725a0482aa300d61c2e710a06b83fe80b079a640d1802
|
|
BLAKE2b-256 checksum How to use checksums |
10ef34e28f37a257e343c7971046abc7f50cfc7d1b719302191cbd04b27f5fbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|