puffins
A Python toolkit for large-scale atmospheric and climate dynamics research.
puffins provides functions for computing physical quantities, analyzing climate data, and creating publication-ready visualizations. Built on xarray, it is designed for use in Jupyter notebooks for both interactive exploration and generating figures for papers and presentations.
Note: This is a personal research tool. You are welcome to use it, but I cannot provide support or guarantee correctness. Use at your own risk.
Features
Core Utilities
Physical constants for Earth, Mars, Saturn, Titan, and Venus. Numerical differentiation, integration, interpolation, and solvers. Standardized coordinate and dimension names for consistent xarray workflows.
Physical Calculations
Coriolis parameter, absolute angular momentum, vorticity, Rossby number, thermodynamic quantities, tropopause diagnostics, and vertical coordinate transformations.
Climate Dynamics
Hadley cell and meridional overturning circulation diagnostics (streamfunction, cell strength and extent), gradient wind balance, equal-area coordinates, Empirical Orthogonal Functions, and column budget adjustment via spherical harmonic wind inversion.
Theoretical Models
Implementations of classic models from the literature: Held & Hou (1980), Lindzen & Hou (1988), Plumb & Hou (1992), the Kuo-Eliassen equation, and Hide's theorem.
Visualization
Matplotlib helpers with custom styling, sine-latitude and standard latitude axis formatting, and integration with faceted for multi-panel plots.
Quick Examples
import puffins
# Coriolis parameter at 30°N
f = puffins.dynamics.coriolis_param(30)
# Same calculation for Mars
f_mars = puffins.dynamics.coriolis_param(
30, rot_rate=puffins.constants.ROT_RATE_MARS
)
# Meridional mass streamfunction from v-wind and pressure thickness
psi = puffins.had_cell.merid_streamfunc(v, dp)
# Held-Hou 1980 Hadley cell edge latitude
phi_h = puffins.held_hou_1980.hc_edge_hh80(delta_h=1/6)
Functions accept planet-specific parameters (gravity, radius, rotation rate) so the same code works across planetary atmospheres.
Installation
Clone the repository and install in editable mode:
git clone https://github.com/spencerahill/puffins.git
cd puffins
pip install -e .
Dependencies
puffins requires Python 3.10+ and the following packages (installed automatically):
The spherical-harmonics wind inversion in budget_adj additionally
requires windspharm, which is
optional (the fortran extra) and on modern setups must be installed
via conda: conda install -c conda-forge windspharm.
Using puffins in individual science projects
puffins is developed continuously, so a development clone may be checked out to any branch at any moment. Science projects should not import from a clone that is also used for development. The intended arrangement:
- Maintain a second, consumer-only clone (e.g.
puffins-main) that stays permanently onmasterand is only ever updated viagit pull. Install it into each project's environment in editable mode (pip install -e /path/to/puffins-main, adding--no-depswhen the environment already provides puffins' dependencies, e.g. from conda). Every project then imports pushed, CI-testedmaster, and a singlepullupdates all of them at once. - If a project needs an unmerged branch, give that project its own temporary clone or git worktree pinned to that branch, install that copy into the project's environment only, and delete it once the branch merges.
- To freeze an analysis (e.g., when a paper is submitted), replace
the editable install with one pinned to a commit or tag:
pip install git+https://github.com/spencerahill/puffins@<sha-or-tag>. The setuptools-scm version string records the exact commit.
Earlier versions of puffins instead switched a single shared clone
between branches from the top of each notebook
(nb_utils.setup_puffins() and the set-proj-puff-branch script);
those utilities have been removed.
License
This project is licensed under the Apache License 2.0 — see the LICENSE file for details.
Author
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file puffins-0.2.0.tar.gz.
File metadata
- Download URL: puffins-0.2.0.tar.gz
- Upload date:
- Size: 331.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
863cc478873f5a2d6a8c77d2cc41ab07d590ffb3716a0cc4a0991e3a327143be
|
|
| MD5 |
bd6ecc6b98b009191da2a0f045a647e9
|
|
| BLAKE2b-256 |
ddcfbfd203bb4750e883c44814e2df3e4de5b0d8d3aa4f724e94b5d8cf06fe23
|
Provenance
The following attestation bundles were made for puffins-0.2.0.tar.gz:
Publisher:
publish.yml on spencerahill/puffins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
puffins-0.2.0.tar.gz -
Subject digest:
863cc478873f5a2d6a8c77d2cc41ab07d590ffb3716a0cc4a0991e3a327143be - Sigstore transparency entry: 2195007147
- Sigstore integration time:
-
Permalink:
spencerahill/puffins@3ca738592577c9491a1a0428b62fc2a40406c815 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/spencerahill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ca738592577c9491a1a0428b62fc2a40406c815 -
Trigger Event:
push
-
Statement type:
File details
Details for the file puffins-0.2.0-py3-none-any.whl.
File metadata
- Download URL: puffins-0.2.0-py3-none-any.whl
- Upload date:
- Size: 172.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5a8a92bbbd74d28bb6cc9b1ffcd4cd50c445b20f2c38d79b50d411a443b62c0
|
|
| MD5 |
9cc3dd179c2caf7fd4b52bcc5beaf092
|
|
| BLAKE2b-256 |
3fea39bb28404279677b7846c07a2e8f1e44a4bcbd598b7234a9bcb267c052c5
|
Provenance
The following attestation bundles were made for puffins-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on spencerahill/puffins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
puffins-0.2.0-py3-none-any.whl -
Subject digest:
b5a8a92bbbd74d28bb6cc9b1ffcd4cd50c445b20f2c38d79b50d411a443b62c0 - Sigstore transparency entry: 2195007154
- Sigstore integration time:
-
Permalink:
spencerahill/puffins@3ca738592577c9491a1a0428b62fc2a40406c815 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/spencerahill
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ca738592577c9491a1a0428b62fc2a40406c815 -
Trigger Event:
push
-
Statement type: