Skip to main content

Experimental AI-assisted Rust rewrite of the PRATMO photochemical box model

Project description

pratmo

[!WARNING] pratmo is an experimental, AI-assisted rewrite of the PRATMO v6.0 stratospheric photochemical box model. It has not been scientifically validated, including the additional iodine chemistry. Do not use its output for scientific conclusions, operational decisions, or safety-critical work without independent review and validation.

pratmo rewrites the original Fortran 77 model in Rust and exposes it through a command-line runner and a typed Python/NumPy interface. The project aims to preserve the original model structure while making the code easier to test, inspect, and embed. It also adds an experimental inorganic iodine mechanism that is not present in PRATMO v6.0.

Implementation tests and selected numerical comparisons with the compiled Fortran program are included, but these are software consistency checks—not scientific validation of the Rust rewrite, its inputs, or its predictions.

Features

  • Rust model core with structured CTM steady-state and full DIURN-cycle APIs.
  • Python package named pratmo, with typed configuration objects and NumPy arrays for profiles, grids, coordinates, time series, and diagnostics.
  • 40 implicit gas-phase species and 19 long-lived species or chemical families.
  • Experimental inorganic iodine chemistry, including ten iodine species, iodine photolysis, higher iodine oxides, and heterogeneous recycling.
  • Standard atmospheres, custom atmospheric profiles, configurable aerosol and sea-salt surface areas, and observation-constrained NO2 workflows.
  • Compatibility paths for the original fixed-format inputs and legacy CLI outputs, plus opt-in tooling for numerical comparisons with Fortran.
  • Runnable CTM, DIURN, iodine, custom-atmosphere, and OMPS batch examples.

The iodine mechanism's assumptions and known omissions are documented in Iodine chemistry.

Python quickstart

The published distribution and import name are both pratmo. To install a released wheel:

python -m pip install pratmo

For development, build the extension into the project environment:

uv sync --dev
uv run maturin develop --release

Run a small CTM altitude profile:

from pratmo import CtmBoxSpec, CtmConfig, PratmoModel

model = PratmoModel.with_defaults()
output = model.run_ctm(
    CtmConfig(
        latitude_deg=60.0,
        julian_day=75,
        integration_days=40,
        boxes=[CtmBoxSpec(altitude_level=level) for level in (10, 15, 20, 25)],
    )
)

print(output.altitude_km)
print(output.species_profile("o3"))       # cm^-3
print(output.long_lived_profile("noy"))  # dimensionless mixing ratio

The package exposes IMPLICIT_SPECIES_NAMES, LONG_LIVED_NAMES, and JVALUE_NAMES for programmatic discovery. Field lookup is case-insensitive. See the Python documentation and examples for CTM, DIURN, custom-atmosphere, and observation-constrained workflows.

Rust and CLI

cargo build --workspace
cargo run -p pratmo-cli -- --input-dir fortran

pratmo-core provides the structured Rust API. pratmo-cli preserves the original file-based workflow and writes Fortran-compatible output files into the selected input directory.

Development verification

These checks test software behavior and selected Fortran agreement. Passing them does not mean that the model is scientifically validated.

Run the normal development checks with:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace
cargo test --workspace --all-features
uv run pytest
uv run sphinx-build -W --keep-going -b html docs docs/_build/html

GitHub Actions runs these Rust checks, the Python tests, a strict documentation build, and the complete cross-platform wheel build on every push and pull request. Built distributions are retained as workflow artifacts. The publish job runs only for release tags matching v* and uses PyPI Trusted Publishing. The extension uses PyO3's Python 3.9 stable ABI, so each platform build produces one cp39-abi3 wheel compatible with Python 3.9 and newer.

The clean-room compiled-Fortran differential is available separately:

scripts/fortran_differential.sh

The detailed numerical comparisons, parity policy, and unsupported legacy modes are tracked in STATUS.md and FORTRAN_PARITY.md.

Current boundaries

  • DERIVS sensitivity mode and PZSTD conversion are rejected explicitly.
  • The original multi-case Fortran driver loop is not implemented.
  • Full CTM climatology-grid coverage remains broader than the comparison fixture.
  • The iodine extension has mechanism-level tests but no Fortran reference and has not been scientifically validated.

License

pratmo is available under the MIT License.

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

pratmo-0.1.0.tar.gz (401.4 kB view details)

Uploaded Source

Built Distributions

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

pratmo-0.1.0-cp39-abi3-win_arm64.whl (619.5 kB view details)

Uploaded CPython 3.9+Windows ARM64

pratmo-0.1.0-cp39-abi3-win_amd64.whl (632.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

pratmo-0.1.0-cp39-abi3-win32.whl (597.3 kB view details)

Uploaded CPython 3.9+Windows x86

pratmo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

pratmo-0.1.0-cp39-abi3-musllinux_1_2_i686.whl (1.1 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

pratmo-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

pratmo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pratmo-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (817.5 kB view details)

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

pratmo-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (844.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

pratmo-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (974.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

pratmo-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (874.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

pratmo-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (812.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

pratmo-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (831.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

pratmo-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (774.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pratmo-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (760.8 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pratmo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68d0d8b870eca907b164123d5cd3632fa5e7a4e3192d4d396961d16d0153ce9b
MD5 1bcfd00b4ddf8179d1c3f3ff93d27d84
BLAKE2b-256 c04a77d06c7071eec6e47860aa204f1606e8250c4027d87ee26f9126b540f47f

See more details on using hashes here.

Provenance

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

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-win_arm64.whl.

File metadata

  • Download URL: pratmo-0.1.0-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 619.5 kB
  • Tags: CPython 3.9+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 7e31f83cb875d9b689123d7a09e552833144de4360f1dc0c8ad972f544e56350
MD5 93c38ac53ef6762ebe4e3f2a7ec247a0
BLAKE2b-256 b243d89d9071229c4b430ddf3a8792f898879c57d800109ff31c8bf3c1698988

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-win_arm64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pratmo-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 632.7 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dae32f8e50a59f14fa0efced835215c55ba8c5c4058d704c37a276258f524d24
MD5 8d7861761e99c83a5d43b6b40c674612
BLAKE2b-256 2ca312a71c17645d4712b8ddb33c2388f46aa5c3171ea40344048d458ebf74fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-win32.whl.

File metadata

  • Download URL: pratmo-0.1.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 597.3 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 f82547e8e8abf0763d080fa12c9074a87fb67e5d97cedd71390266a7da56a1fa
MD5 f5312bd6b08a10e6638604a57a1dd2ec
BLAKE2b-256 07d3eb2cdb50963d5e776d330db7b780937fce42b9094bfb5fe69019ef48a4be

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-win32.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 46fe45bca7dccf855bd8fae1d219615cc4afaa854021cc9772bf1bdd1b3ba52c
MD5 e084af255e2e3485a457dd1100ae4cc6
BLAKE2b-256 c3cd3423233d953ddfd3c453b5c6f89fc47c93e7f1f2113e13b4a7072ec3e50d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

  • Download URL: pratmo-0.1.0-cp39-abi3-musllinux_1_2_i686.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9+, musllinux: musl 1.2+ i686
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b308b7998b2408cabe4bf34ed9650afc3250e6a4a79f49dfaad3368cacc83fb2
MD5 c78cd10041aa952c4c0c49312c5bedf2
BLAKE2b-256 b8fef2ae0deea71e156acd08c37a8ec1d1a238ff3f4023158587e69d42e093d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-musllinux_1_2_i686.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a65ccdf33af31a158d5d47dd0f9e87604c035128d64e09f7b594b091a75b5f42
MD5 e0261ba69cabbf789e0eea683e0aa350
BLAKE2b-256 0bcd854bbc08594d0d4d2a6781a9be44203f3f817214e65e865081097705786e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8c0f991d2b01ec15eb119698b5a9449ccd66f351cd9fb97c57388579e50175ab
MD5 77f0653928955e2eaa85dd1e7bba3820
BLAKE2b-256 26673a51132da949b8a4dae0418539f59b928fed6a9f882cc1e248f5846771ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd62b5412db7d3959ce71a2175e8b22ce34be73aec5bba821738a5ab00fc2b02
MD5 98b96feab401451b1fbedadd79b90c04
BLAKE2b-256 cd0ca63bf584c53d3204f4a2550390c9912f4250d9cccdc5e19f89dc485e5ad7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1c2277b84d26c77b67ed1d8c0b292c2e46594680896a4e08437ed89d1e8ce7ef
MD5 0b850cc36d8428e7439fece686dc08ff
BLAKE2b-256 92134873cc917897bed0ffe485caf67341957256dce8853b218e2d46a9647ef1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 15adf796e4e75d78d5fb8797fce1a8239cfe95a74f505a09b5c29bf04ff7c792
MD5 ec3c6d07a8a7ec1a285b7d89f05c0219
BLAKE2b-256 9e7bfb7fb7cb7caffe4b8c7cf65b1e7086d94a35f55c549860017e1e4136877f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0700c9e5f8349b12fe0650babb34f2a534fc8c1233ed0024c031c0c491e13656
MD5 6595ffe881c20c08fa4e056f8b76f2fb
BLAKE2b-256 d470878a4a6d658331a1a2ed5172afdfb08d45893afa0d7d4c48c8dcadcf8a54

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 613cf8f17054952e4c5eee2819e4c29fb51029fb072ee13f3d2119cc50e6aaa9
MD5 033bd387e97dd7b981c6db00d2837665
BLAKE2b-256 0f9bb96d097ea608a7dbf31667ac50b6338aec895d2c775d5d3371ef4fa762a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ee35ad74b108d4ae16cf0b87c9f939d337f4beba26a7c1a4540a300efca812d1
MD5 f88f2fe7b64582c73836fb1d52342513
BLAKE2b-256 f28004945d3afb1b9782c2a2c0bbb343e6781b8301fd2d3257f0cc75b3ec383b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pratmo-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 774.6 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d01a74030fac0c90e84fa84fb99ebc2b8f6b89115226b08c5ddc7b125ace717
MD5 665ae8bfc7a527caf4357b268e3acc12
BLAKE2b-256 5e618363de9c24bfc673becd7da9382a77984ed31454ee1b2b1ab8e7933c0df0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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

File details

Details for the file pratmo-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pratmo-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b1d250d4bf310e09af1f1c62c3445f2a516d05e05916ac4fade0a10f96d38757
MD5 8c5ad6ad12f3481f47e3b08045541227
BLAKE2b-256 3e7bb2736f2c80206bc8a6612b48fa270283fd604817034211e1baa59a5999b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pratmo-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on usask-arg/pratmo-rust

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