Skip to main content

c3s_sm

ci cov pip doc

Processing tools and tutorials for users of the C3S satellite soil moisture service ( https://doi.org/10.24381/cds.d7782f18 ). Written in Python.

Installation

The c3s_sm package and all required dependencies can be installed via

pip install c3s_sm

On macOS if you get ImportError: Pykdtree failed to import its C extension, then it might be necessary to install the pykdtree package from conda-forge

conda install -c conda-forge pykdtree

API Key

In order to download C3S soil moisture data from CDS, this package uses the CDS API (https://pypi.org/project/cdsapi/). You can either pass your credentials directly on the command line (which might be unsafe) or set up a .cdsapirc file in your home directory (recommended). Please see the description at https://cds.climate.copernicus.eu/how-to-api.

Quickstart

Download image data from CDS using the c3s_sm shell command

c3s_sm download /tmp/c3s/img -s 2023-09-01 -e 2023-10-31 -v v202212

… and convert them to time series

c3s_sm reshuffle /tmp/c3s/img /tmp/c3s/ts

Finally, in python, read the time series data for a location as pandas DataFrame.

>> from c3s_sm.interface import C3STs
>> ds = C3STs('/tmp/c3s/ts')
>> ts = ds.read(18, 48)

                  sm  sm_uncertainty  flag  ...  mode  sensor            t0
2023-09-01  0.222125        0.014661     0  ...     2     544  19601.100348
2023-09-02  0.213480        0.011166     0  ...     3   38432  19602.051628
2023-09-03  0.197324        0.014661     0  ...     3   33312  19602.945730
              ...             ...   ...  ...   ...     ...           ...
2023-10-29  0.265275        0.013192     0  ...     3   37408  19658.955236
2023-10-30  0.256964        0.011166     0  ...     3   38432  19660.085144
2023-10-31  0.241187        0.014661     0  ...     3   33312  19660.945730

Tutorials

We provide tutorials on using the C3S Soil Moisture data:

These tutorials are designed to run on mybinder.org You can find the code for all examples in this repository.

Supported Products

At the moment this package supports C3S soil moisture data in netCDF format (reading and time series creation) with a spatial sampling of 0.25 degrees.

Build Docker image

For operational implementations, this package and be installed in a docker container.

  • Check out the repo at the branch/tag/commit you want build

  • Make sure you have docker installed and run the command (replace the tag latest with something more meaningful, e.g. a matching version number)

docker build -t c3s_sm:latest . 2>&1 | tee docker_build.log

This will execute the commands from the Dockerfile. I.e. install a new environment with the checked out version of the c3s_sm package.

To build and publish the image online, we have a GitHub Actions workflow in .github/workflows/docker.yml

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.

Guidelines

If you want to contribute please follow these steps:

  • Fork the c3s_sm repository to your account

  • Clone the repository, make sure you use git clone --recursive to also get the test data repository.

  • make a new feature branch from the c3s_sm master branch

  • Add your feature

  • Please include tests for your contributions in one of the test directories.

  • submit a pull request to our master branch

Metadata

Release files for c3s-sm 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for c3s-sm 0.4.0
File Size Uploaded Provenance Actions
c3s_sm-0.4.0.tar.gz 3.7 MB Without provenance Details for c3s_sm-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for c3s-sm 0.4.0
File Interpreter ABI Platform Actions
c3s_sm-0.4.0-py3-none-any.whl Python 3 none any Details for c3s_sm-0.4.0-py3-none-any.whl

Total release size: 3.7 MB

Release files / c3s_sm-0.4.0.tar.gz

Download URL c3s_sm-0.4.0.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
d27685788e7ba74ba1d0980fadc22728c22c837e92e6f51904f0aa0eb7645abe
BLAKE2b-256 checksum
How to use checksums
ab5dbf5a814a464a1cdb915467ba4ff691e65123568cbe6565e479407b76f333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.1.dev37+g4f20c0dc3 CPython/3.12.5

Release files / c3s_sm-0.4.0-py3-none-any.whl

Download URL c3s_sm-0.4.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c0736a70c3a2467366ab3386ffd5983a0eb9843c07e5520624b7cad3d884bb9
BLAKE2b-256 checksum
How to use checksums
f4f52e5e8ec3fbfd3487cb025ecb41d65cd2d7f57a7f4acd356741a847fd443f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.1.dev37+g4f20c0dc3 CPython/3.12.5

Security for c3s-sm 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page