PHYEX - Physics Parameterization Package
PHYEX is a Fortran library for atmospheric physics parameterizations with Python bindings.
Features
- Mixed-phase cloud microphysics (ICE_ADJUST, RAIN_ICE)
- Shallow convection schemes
- Python bindings via Cython for easy integration
Building
Fortran Library Only
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --install .
Python Package with scikit-build-core
The project uses scikit-build-core for building Python wheels.
Requirements
- Python >= 3.11
- gfortran (GNU Fortran compiler)
- CMake >= 3.15
- NumPy < 2.0
- Cython
Installation from source
# Install in editable mode for development
pip install -e .
# Or build a wheel
pip install build
python -m build
Installation from wheel
pip install dist/phyex-0.1.0-*.whl
Installation from spack
The package is installable from a spack repo
- To install the python extensions :
spack install phyex +python +double
- To install fortran package :
spack install phyex ~python +double
Usage
Python
import numpy as np
from phyex import ice_adjust, rain_ice, init_rain_ice
# Initialize microphysics
init_rain_ice(timestep=60.0, dzmin=20.0, krr=6, hcloud="AROME")
# Prepare input arrays (Fortran-contiguous, float32)
nlon, nlev = 10, 50
pabs = np.ones((nlon, nlev), dtype=np.float32, order='F') * 85000.0
# ... initialize other arrays ...
# Call ice_adjust
ice_adjust(
timestep=60.0, krr=6,
sigqsat=sigqsat, pabs=pabs, sigs=sigs, th=th,
exn=exn, exn_ref=exn_ref, rho_dry_ref=rho_dry_ref,
rv=rv, rc=rc, ri=ri, rr=rr, rs=rs, rg=rg,
cf_mf=cf_mf, rc_mf=rc_mf, ri_mf=ri_mf,
rvs=rvs, rcs=rcs, ris=ris, ths=ths,
cldfr=cldfr, icldfr=icldfr, wcldfr=wcldfr
)
Project Structure
PHYEX/
├── aux/ # Auxiliary routines
├── turb/ # Turbulence parameterizations
├── micro/ # Microphysics schemes
├── conv/ # Convection schemes
├── bridge/ # Python-Fortran bridge
│ ├── phyex_bridge.F90 # Fortran C-interop layer
│ ├── _phyex_wrapper.pyx # Cython wrapper (CPU)
│ └── _phyex_wrapper_acc.pyx # Cython wrapper (GPU/OpenACC)
├── CMakeLists.txt # Build configuration
└── pyproject.toml # Python package configuration
Development
Testing
pip install -e ".[dev]"
pytest tests/
Code Formatting
black phyex/
ruff check phyex/
References
Based on the PHYEX physics package from Météo-France.
License
Apache-2.0
Metadata
Release files for phyex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phyex-0.1.0.tar.gz | 961.2 kB | Without provenance | Details for phyex-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phyex-0.1.0-cp311-cp311-macosx_26_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 26.0+ ARM64 | Details for phyex-0.1.0-cp311-cp311-macosx_26_0_arm64.whl |
Total release size: 7.0 MB
Release files / phyex-0.1.0.tar.gz
| Download URL | phyex-0.1.0.tar.gz |
|---|---|
| Size | 961.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
668a1325786403e5542e729f202391b702508cb1da5d611805d3580f4744f1a8
|
|
BLAKE2b-256 checksum How to use checksums |
bb098485ac15f41b7af59dcb218325cff7b8410dd0a137101a3fc8210b3504ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Release files / phyex-0.1.0-cp311-cp311-macosx_26_0_arm64.whl
| Download URL | phyex-0.1.0-cp311-cp311-macosx_26_0_arm64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.11 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1055562962ffd3145423a8fa973f1ddd539088a7829c0b3dc4ef210bec089bae
|
|
BLAKE2b-256 checksum How to use checksums |
943335662fb79bb0fa69b7eff6b6e4f0be17f155db2880a397fe994416592add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Security for phyex 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.