Python bindings for am
Project description
am-python
Python bindings for Scott Paine's am atmospheric model, via Rust (PyO3).
Install
Pre-built wheels are available on PyPI for Linux:
uv pip install am-python
From source
Requires the am source code (tested on v14.0), a C compiler, and a Rust toolchain.
curl -fsSL "https://zenodo.org/records/13748403/files/am-14.0.tgz?download=1" | tar -xz
export AM_SRC_DIR=$PWD/am-14.0/src
uv pip install .
Usage
Single model
import am
m = am.Model("SPole_JJA_75.amc", [0, "GHz", 350, "GHz", 0.01, "GHz", 35, "deg", 1.0])
m.compute()
# numpy array, GHz
m.frequency
# dict of computed outputs
m.outputs
# Rayleigh-Jeans brightness temperature, K
m.outputs["tb_rj"]
Parameter sweep
import xarray as xr
import am
params = xr.Dataset(coords={
"elevation": [30, 45, 60, 75], # deg
"pwv": [0.5, 1.0, 2.0], # mm
})
ds = am.ModelGrid(
"SPole_JJA_75.amc",
params,
args_fn=lambda elevation, pwv: [
0, "GHz", 350, "GHz", 0.5, "GHz", elevation, "deg", pwv
],
).compute()
# xr.Dataset with dims (elevation, pwv, frequency)
ds["tb_rj"].sel(elevation=45, pwv=1.0)
For irregular grids (e.g. a set of specific elevation/PWV pairs), use variables on a shared dimension instead:
import numpy as np
params = xr.Dataset({
"elevation": ("obs", elev_array),
"pwv": ("obs", pwv_array),
})
Development
This project uses just to orchestrate common tasks and pre-commit for local checks.
# install deps
just sync
# run tests
just test
just test py
just test rs
# run formatting/lint checks
just fmt
just fmt-check
just lint
just typecheck
# build docs
just docs
just docs py
just docs rs
# run pre-commit hooks on all files
just precommit
just prepush
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 am_python-0.8.0.tar.gz.
File metadata
- Download URL: am_python-0.8.0.tar.gz
- Upload date:
- Size: 23.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
987b9b1d73aaf3b5bded62d0605a1f7e89db52165c38898d7af7c6563f3876cc
|
|
| MD5 |
48d7c3f34e23b6965c0b4993d442d624
|
|
| BLAKE2b-256 |
b7a91afb6d4094e80994233b5325ec45661d6c5939a8f2036766b2fe40e84128
|
Provenance
The following attestation bundles were made for am_python-0.8.0.tar.gz:
Publisher:
release.yaml on bdelwood/am-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
am_python-0.8.0.tar.gz -
Subject digest:
987b9b1d73aaf3b5bded62d0605a1f7e89db52165c38898d7af7c6563f3876cc - Sigstore transparency entry: 1343312511
- Sigstore integration time:
-
Permalink:
bdelwood/am-python@409926c7e97e3bf138da7128061253fba2af450a -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/bdelwood
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@409926c7e97e3bf138da7128061253fba2af450a -
Trigger Event:
push
-
Statement type:
File details
Details for the file am_python-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: am_python-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 22.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3f835c7d010cd98a4a5e151b8a5a5a3f25b0f9f48a0afd4c1f9035aa325bc5c
|
|
| MD5 |
abe89b91b392fdf03294e31c0671e0a9
|
|
| BLAKE2b-256 |
2df6ac5f9795c14c3e3c97787f1cd1ea478058d278891db859f25a5e8f43c202
|
Provenance
The following attestation bundles were made for am_python-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yaml on bdelwood/am-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
am_python-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
c3f835c7d010cd98a4a5e151b8a5a5a3f25b0f9f48a0afd4c1f9035aa325bc5c - Sigstore transparency entry: 1343312518
- Sigstore integration time:
-
Permalink:
bdelwood/am-python@409926c7e97e3bf138da7128061253fba2af450a -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/bdelwood
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@409926c7e97e3bf138da7128061253fba2af450a -
Trigger Event:
push
-
Statement type: