Skip to main content

Python bindings for am

Project description

am-python

CI status Documentation PyPI version Wheels License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

am_python-0.7.0.tar.gz (23.1 MB view details)

Uploaded Source

Built Distribution

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

am_python-0.7.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

File details

Details for the file am_python-0.7.0.tar.gz.

File metadata

  • Download URL: am_python-0.7.0.tar.gz
  • Upload date:
  • Size: 23.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for am_python-0.7.0.tar.gz
Algorithm Hash digest
SHA256 5149e8a4d414b511e1a7f113aa664fdda52f73a32c2c36b60304dc4968041cf0
MD5 1608a8fdec61d8bbfa222f7bf1a94214
BLAKE2b-256 acfde4c65abfb5f1bbaf2b2fa3d979893949df12bb6751b9440581c5a0845f6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_python-0.7.0.tar.gz:

Publisher: release.yaml on bdelwood/am-python

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

File details

Details for the file am_python-0.7.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for am_python-0.7.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4824f037c8e970241029785323f40d279f369bbd839f1a1cb15ccdaf0edd89d1
MD5 570fa1d620411e569fc09c7ec5ff0759
BLAKE2b-256 5fb6d18c1fe155ad93187c320a7f05d5f8f770d0b279c0c70d8d0f787e15f4b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for am_python-0.7.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on bdelwood/am-python

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