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.1.tar.gz (465.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for c3s_sm-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b691b982543438bb4081342390962bf14623a573e571be4bc1e16d38f325b6ed
MD5 86a74818dfe9e12a8e4e23207e0656c9
BLAKE2b-256 ce39e4937daf7bf50a4d45f6bfcf16a0c0d511346ec67973e2e0b0a0d9ce3395

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for c3s_sm-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e932c117482cf1a6166628636f8d7bfe02d584cfb1b399bfe8c7cd472c7a4319
MD5 a7d7d8cbfbf91b716d874a0ffe399ca0
BLAKE2b-256 5d8bbd8d5c5dd6d1963977392213bf04933a9fb11a0a78a251444747c179e695

See more details on using hashes here.

Supported by

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