Skip to main content

puffins

A Python toolkit for large-scale atmospheric and climate dynamics research.

PyPI Docs CI Python 3.11+ License: Apache 2.0 Status: Alpha

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(therm_ross_num=0.1)

Functions accept planet-specific parameters (gravity, radius, rotation rate) so the same code works across planetary atmospheres.

Full documentation, including the API reference, is at puffins.readthedocs.io.

Installation

pip install puffins

To work on puffins itself, 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.11+ 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 on master and is only ever updated via git pull. Install it into each project's environment in editable mode (pip install -e /path/to/puffins-main, adding --no-deps when the environment already provides puffins' dependencies, e.g. from conda). Every project then imports pushed, CI-tested master, and a single pull updates 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

Spencer A. Hill

Metadata

Release files for puffins 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for puffins 0.3.0
File Size Uploaded
puffins-0.3.0.tar.gz 361.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for puffins 0.3.0
File Interpreter ABI Platform
puffins-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 598.6 kB

Release files / puffins-0.3.0.tar.gz

Download URL puffins-0.3.0.tar.gz
Size 361.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89bb905ccda5ad1508f29502936f0df0da388f90c31f5d9bc00e998590678e22
BLAKE2b-256 checksum
How to use checksums
6974099be0b4ccdba19cd7191a9989478a0effabcf525ca951297678b12534f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / puffins-0.3.0-py3-none-any.whl

Download URL puffins-0.3.0-py3-none-any.whl
Size 236.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ace0b06698e65740e4e8c3cd1fa368449ca124ab24fa7d5d995ef78d71eed881
BLAKE2b-256 checksum
How to use checksums
5ff3932d212b6cbf73ce1dffc714f3b9af544120a2d291f6115ffd7c7b8f3315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page