Skip to main content

Readers and utilities for working with C3S Soil Moisture data

Project description

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

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

c3s_sm-0.3.2.tar.gz (465.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

c3s_sm-0.3.2-py2.py3-none-any.whl (28.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file c3s_sm-0.3.2.tar.gz.

File metadata

  • Download URL: c3s_sm-0.3.2.tar.gz
  • Upload date:
  • Size: 465.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.20

File hashes

Hashes for c3s_sm-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ab461dfd9c317630e769db0f71285a25463f0e36929d235cd57968dd70728a37
MD5 caf91b443e8f8b9b68ca44d16430ef93
BLAKE2b-256 37006ebc83f50f1c5a3826dca18c93a62a422eb302602152168b2b30106d7810

See more details on using hashes here.

File details

Details for the file c3s_sm-0.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: c3s_sm-0.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.20

File hashes

Hashes for c3s_sm-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9694eaa722730d11c853db07a4a1b7b367e2bff5d7afad36c0aefffbd4445be1
MD5 ee2266a2efe6b759076276756f78d5c3
BLAKE2b-256 ce058562c1eabb288aac9e9ae1ddcea10c0e4f7de4894f02fe25775d27c64b90

See more details on using hashes here.

Supported by

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