Skip to content

Repository files navigation

OPI - Orographic Precipitation and Isotopes

MATLAB Python License

A comprehensive model for analyzing precipitation and water isotope fractionation associated with steady atmospheric flow over arbitrary three-dimensional topography.

πŸ“¦ Two Versions Available

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

🎯 Quick Start

Choose Your Version

# 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

πŸ“š Learning Path

For New Users

  1. Read Getting Started
  2. Try the Gaussian Mountain Example
  3. Explore your preferred version

For MATLAB Users Learning Python

  1. Start with MATLAB to Python Guide
  2. Compare side-by-side examples
  3. See function mapping

For Python Users

  1. See Python Quick Start
  2. Try Jupyter Notebooks
  3. Explore examples

πŸ“‚ Repository Structure

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

πŸ”¬ Side-by-Side Comparison

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.

πŸ“– Documentation

Main Documentation

Comparison Documentation

Version-Specific Docs

πŸŽ“ Examples

Comparative Examples (Same case in both languages)

MATLAB Examples

See matlab/examples/

Python Examples

See python/examples/

πŸ”„ Function Mapping

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.

πŸ› οΈ Development

Contributing

We welcome contributions to both versions! See:

Testing

# MATLAB
run(matlab/tests/run_tests.m)

# Python
cd python/
pytest tests/ -v

πŸ“š Citation

If 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}
}

πŸ“ž Support

πŸ™ Acknowledgments

  • MATLAB Original: Mark Brandon, Yale University
  • Python Port: AI Assistant & Contributors
  • Theory: Based on Smith & Barstad (2004), Durran & Klemp (1982)

Choose your path: MATLAB | Python | Compare

About

Python code snippets for "OPI-Orographic-Precipitation-and-Isotopes"

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages