A comprehensive model for analyzing precipitation and water isotope fractionation associated with steady atmospheric flow over arbitrary three-dimensional topography.
This repository contains two implementations of the OPI model:
| Version | Language | Status | Documentation |
|---|---|---|---|
| MATLAB | MATLAB R2020b+ | β Original | MATLAB Docs |
| Python | Python 3.8+ | β Ported | Python Docs |
# For MATLAB users
cd matlab/
# See matlab/README.md for instructions
# For Python users
cd python/
pip install -e ".[all]"
# See python/README.md for instructions- Read Getting Started
- Try the Gaussian Mountain Example
- Explore your preferred version
- Start with MATLAB to Python Guide
- Compare side-by-side examples
- See function mapping
- See Python Quick Start
- Try Jupyter Notebooks
- Explore examples
OPI/
βββ README.md # This file - main entry point
βββ LICENSE # MIT License
βββ docs/ # Shared documentation
β βββ getting-started.md # Getting started guide
β βββ comparison/ # MATLAB vs Python comparison
β βββ theory/ # Theoretical background
β
βββ matlab/ # MATLAB implementation
β βββ README.md # MATLAB-specific docs
β βββ OPI_programs/ # Main programs
β βββ private/ # Core functions
β βββ data/ # Sample data
β βββ runs/ # Run files & output
β
βββ python/ # Python implementation
β βββ README.md # Python-specific docs
β βββ opi/ # Main package
β βββ tests/ # Test suite
β βββ examples/ # Examples
β βββ notebooks/ # Jupyter notebooks
β
βββ examples/ # Shared/comparative examples
βββ gaussian-mountain/ # Same case in both languages
βββ himalaya/ # Real-world case study
βββ README.md # Example guide
| Feature | MATLAB | Python |
|---|---|---|
| Installation | MATLAB R2020b+ | pip install -e ".[all]" |
| Quick Start | Run opiCalc_OneWind.m |
from opi import OneWindModel |
| Documentation | MATLAB Docs | Python Docs |
| Examples | MATLAB Examples | Python Examples |
| Visualization | MATLAB plots | Matplotlib + advanced viz |
| Parallel | Parallel Computing Toolbox | joblib, multiprocessing |
| I/O | .mat files |
NumPy, NetCDF, GeoTIFF, etc. |
- Getting Started - Start here!
- Installation Guide - Detailed installation
- Theory & Background - Physical basis
- MATLAB vs Python - Feature comparison
- MATLAB to Python Guide - Migration guide
- Function Mapping - Function correspondence
- Syntax Differences - Syntax comparison
- Gaussian Mountain - Idealized case
- Simple Ridge - 2D ridge case
- Himalaya - Real-world application
See matlab/examples/
See python/examples/
| MATLAB Function | Python Function | Location |
|---|---|---|
opiCalc_OneWind |
OneWindModel.run() |
opi/models/ |
baseState |
base_state() |
opi/core/ |
fourierSolution |
fourier_solution() |
opi/core/ |
precipitationGrid |
precipitation_grid() |
opi/core/ |
isotopeGrid |
isotope_grid() |
opi/core/ |
fminCRS3 |
CRS3Optimizer |
opi/solvers/ |
See full mapping for complete list.
We welcome contributions to both versions! See:
# MATLAB
run(matlab/tests/run_tests.m)
# Python
cd python/
pytest tests/ -vIf you use OPI in your research, please cite:
@software{opi_model,
title = {OPI: Orographic Precipitation and Isotopes},
author = {Brandon, Mark},
year = {2024},
note = {MATLAB original; Python port available}
}- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: ...
- MATLAB Original: Mark Brandon, Yale University
- Python Port: AI Assistant & Contributors
- Theory: Based on Smith & Barstad (2004), Durran & Klemp (1982)