Skip to main content

Python package for spectral approximation methods applied to topographic analysis

Project description

CSA Logo

Constrained Spectral Approximation

GitHub Actions: CI Documentation License: GPL v3 Code style: black DOI

The Constrained Spectral Approximation (CSA) method is a physically sound and robust method for approximating the spectrum of subgrid-scale orography. It operates under the following constraints:

  • Utilises a limited number of spectral modes (no more than 100)
  • Significantly reduces the complexity of physical terrain by over 500 times
  • Maintains the integrity of physical information to a large extent
  • Compatible with unstructured geodesic grids
  • Inherently scale-aware

This method is primarily used to represent terrain for weather forecasting purposes, but it also shows promise for broader data analysis applications.


Read the documentation here


Requirements

See requirements.txt

NOTE: The Sphinx dependencies can be found in docs/source/conf.py.

Usage

Installation

Install the latest release from PyPI:

pip install pycsa-specappx

The distribution is named pycsa-specappx (the bare pycsa name was already taken on PyPI by an unrelated project), but the import name is unchanged — import pycsa.

To run the bundled experiment scripts in runs/ / examples/, or to contribute, work from a clone instead:

git clone https://github.com/ray-chew/pyCSA && cd pyCSA
pip install -e ".[test]"

Configuration

Run parameters are assembled programmatically inside the run scripts using the pycsa.config.params dataclass. Example experiment scripts live in runs/ and examples/; the reusable building blocks are in the pycsa package (pycsa.core, pycsa.wrappers, pycsa.plotting, pycsa.data, pycsa.compute).

Runs that read on-disk data (e.g. the global ICON+ETOPO pipeline) locate it through SPEC_APPX_* environment variables, which are read by pycsa/local_paths.py (copied from local_paths.py.template):

export SPEC_APPX_DATA_DIR=/path/to/data          # directory containing the ICON grid
export SPEC_APPX_ETOPO_DIR=/path/to/data/etopo_15s
export SPEC_APPX_MERIT_DIR=/path/to/MERIT        # MERIT runs only
export SPEC_APPX_REMA_DIR=/path/to/REMA          # MERIT runs only
export SPEC_APPX_OUTPUT_DIR=/path/to/outputs

Set these directly or with source setup_paths.sh. The bundled examples/ need no such setup — their data ships with the repo.

Execution

A simple setup can be found in runs/idealised_isosceles.py, a fixed-seed idealised benchmark. From a clone, run it directly:

python -m runs.idealised_isosceles
python3 ./runs/idealised_isosceles.py

However, the codebase is structured such that the user can easily assemble a run script to define their own experiments. Refer to the documentation for the available APIs.

Examples

Three self-contained examples ship with bundled data (no download needed):

License

GNU GPL v3 (tentative)

Contributions

Refer to the open issues that require attention.

Any changes, improvements, or bug fixes can be submitted to upstream via a pull request.

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

pycsa_specappx-1.0.1.tar.gz (179.2 kB view details)

Uploaded Source

Built Distribution

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

pycsa_specappx-1.0.1-py3-none-any.whl (132.5 kB view details)

Uploaded Python 3

File details

Details for the file pycsa_specappx-1.0.1.tar.gz.

File metadata

  • Download URL: pycsa_specappx-1.0.1.tar.gz
  • Upload date:
  • Size: 179.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycsa_specappx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c2301499952a9694707c5262a7c54fb3a143cb1efd48204abb92b891625b9aa1
MD5 c6f8b436d571d618c653ed5dcadc5f01
BLAKE2b-256 de3cf21f12b55d03a1556d6791d85c300636463a7e2dc8a5fc05263703e19852

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycsa_specappx-1.0.1.tar.gz:

Publisher: publish.yml on ray-chew/pyCSA

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

File details

Details for the file pycsa_specappx-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pycsa_specappx-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 132.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycsa_specappx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3af1620c35ce0c89968bce74752fc31c31fe4864c431e40634499426aa0eea1
MD5 09b0442094dec0a77de02a1917e0283e
BLAKE2b-256 bebbc62abbdde18e8b2b4dc78cf4a37e89a0a8c82d07707e36a2564a923ddcb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycsa_specappx-1.0.1-py3-none-any.whl:

Publisher: publish.yml on ray-chew/pyCSA

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