Python package for spectral approximation methods applied to topographic analysis
Project description
Constrained Spectral Approximation
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.
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):
- Idealised —
pycsa-idealised(synthetic terrain with a known spectrum; see the tutorial). - Aleutians / MERIT —
examples/icon_regional_minimal.py(real ICON cell, ~10 s). - Andes / ETOPO —
examples/icon_etopo_andes.py(real ETOPO cell with ocean-aware masking; see the showcase).
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2301499952a9694707c5262a7c54fb3a143cb1efd48204abb92b891625b9aa1
|
|
| MD5 |
c6f8b436d571d618c653ed5dcadc5f01
|
|
| BLAKE2b-256 |
de3cf21f12b55d03a1556d6791d85c300636463a7e2dc8a5fc05263703e19852
|
Provenance
The following attestation bundles were made for pycsa_specappx-1.0.1.tar.gz:
Publisher:
publish.yml on ray-chew/pyCSA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycsa_specappx-1.0.1.tar.gz -
Subject digest:
c2301499952a9694707c5262a7c54fb3a143cb1efd48204abb92b891625b9aa1 - Sigstore transparency entry: 1855512171
- Sigstore integration time:
-
Permalink:
ray-chew/pyCSA@ae59dfbe4263c0863f380efdd01e120855fc122b -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/ray-chew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae59dfbe4263c0863f380efdd01e120855fc122b -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3af1620c35ce0c89968bce74752fc31c31fe4864c431e40634499426aa0eea1
|
|
| MD5 |
09b0442094dec0a77de02a1917e0283e
|
|
| BLAKE2b-256 |
bebbc62abbdde18e8b2b4dc78cf4a37e89a0a8c82d07707e36a2564a923ddcb7
|
Provenance
The following attestation bundles were made for pycsa_specappx-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on ray-chew/pyCSA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycsa_specappx-1.0.1-py3-none-any.whl -
Subject digest:
d3af1620c35ce0c89968bce74752fc31c31fe4864c431e40634499426aa0eea1 - Sigstore transparency entry: 1855512198
- Sigstore integration time:
-
Permalink:
ray-chew/pyCSA@ae59dfbe4263c0863f380efdd01e120855fc122b -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/ray-chew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae59dfbe4263c0863f380efdd01e120855fc122b -
Trigger Event:
release
-
Statement type: