Skip to main content

Python client library for WCPS (OGC Web Coverage Processing Service) backends.

Project description

Overview

The OGC Web Coverage Processing Service (WCPS) standard defines a protocol-independent declarative query language for the extraction, processing, and analysis of multi-dimensional coverages (datacubes) representing sensor, image, or statistics data.

This Python library allows to dynamically build WCPS queries and execute on a WCPS server.

Installation

pip install wcps

Examples

Derive an NDVI map from red and near-infrared bands of a Sentinel-2 datacube, threshold the very green areas (values greater than 0.5) as true values (white in a PNG), and save the result as a PNG image.

from wcps.service import Service
from wcps.model import Datacube

# Let S2_L2A be a 3D coverage with nir and red bands;
# slice it at "2025-01-15" on the time axis, getting a 2D map
cov = Datacube("S2_L2A")["time", "2025-01-15"]
# NDVI formula
ndvi = (cov.nir - cov.red) / (cov.nir + cov.red)
# threshold NDVI values to highlight areas with high vegetation
vegetation = ndvi > 0.5
# encode final result to PNG
query = vegetation.encode("PNG")

service = Service("https://ows.rasdaman.org/rasdaman/ows")

# execute the query on the server and get back the response
response = service.execute(query)

# alternatively, save the content of the response into a file
response = service.execute(query,
                           output_file='vegetation.png')

We can calculate the average NDVI as follows:

cov = ...
# NDVI formula
ndvi = (cov.nir - cov.red) / (cov.nir + cov.red)
# get average NDVI value
query = ndvi.avg()

service = ...
response = service.execute(query)

print(f'The average NDVI is {response.content}')

Contributing

The directory structure is as follows:

  • wcps - the main library code
  • tests - testing code
  • docs - documentation in reStructuredText format

Tests

To run the tests execute:

pytest

Documentation

To build the documentation:

# install needed dependencies
pip install wcps[docs]

cd docs
make html

The built documentation can be found in the docs/_build/html/ subdir.

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

wcps-0.1.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

wcps-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file wcps-0.1.0.tar.gz.

File metadata

  • Download URL: wcps-0.1.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for wcps-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0acea01ff7d6eacf20b9f0e51de73ed8ef5b2f181c57d7b01adec872acd0daa3
MD5 24da61a25d7a13126dd95f235577141d
BLAKE2b-256 fc9e8cf7ae01ac5ceab4158962e45122b4c30577009bfdd90e77f9066d4d2227

See more details on using hashes here.

Provenance

The following attestation bundles were made for wcps-0.1.0.tar.gz:

Publisher: release.yml on rasdaman/wcps-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wcps-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wcps-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for wcps-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a98a2995e6290c90012d5bc30d492d838df22d62cae1f69e6050e1d7620395f6
MD5 5b5d0c74359ace5a5c997f493fa35077
BLAKE2b-256 4985d733d7851f828c0aab39236ec90d2fb279e1e6c71087d838a6ab3bb835b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for wcps-0.1.0-py3-none-any.whl:

Publisher: release.yml on rasdaman/wcps-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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