Skip to main content
marEx logo

CI codecov PyPI version Documentation Status PyPI Downloads DOI

Weather & Climate Extremes Detection and Tracking

Efficient & scalable climatologies, anomalies, extreme detection, & event tracking for exascale climate data.

marEx computes climatologies and anomalies, identifies extremes, and tracks the resulting events through space and time in geospatial time series. The same calls detect marine and atmospheric heatwaves, cold spells, droughts and subsurface ocean extremes.

Full documentation on ReadTheDocs


Video: play on GitHub

Tracked marine heatwaves (white outlines) and atmospheric heatwaves in 2 m air temperature (cyan) through 2016, over the daily sea surface temperature anomaly. OSTIA SST and ERA5.


Key Features

  • High Performance: Process 100+ years of high-resolution daily global data in minutes.
  • Multiple Detection Methods: Hobday et al. (2016) and its generalisations, with four anomaly baselines and seasonal or constant-in-time percentile thresholds, on either tail, at daily, sub-daily or monthly cadence.
  • Larger-than-Memory: Intelligent chunking, lazy evaluation and on-disk staging compute the global climatologies, percentile thresholds and event tracks of datasets much larger than memory.
  • Cloud-Native Scaling: Identical code scales from a laptop to a supercomputer using 1024+ cores.
  • Advanced Event Tracking: Follows coherent events as they evolve, split and merge, keeping each event's identity and merge history.
  • Universal Grid Support: Regular lat/lon grids and unstructured meshes (FESOM, ICON, MPAS) through one API, with depth or level as an extra dimension in detection.

Core Modules

Step Returns Methods
1. Anomaly
marEx.anomaly.compute
The anomaly field, i.e. the input minus its seasonal climatology (dat_anomaly).
With detrend_harmonic, also standardised anomalies and their rolling standard deviation. marEx.anomaly.smoothed_rolling_climatology returns the shifting-baseline climatology itself.
shifting_baseline, fixed_baseline, detrend_harmonic, detrend_fixed_baseline
2. Extremes
marEx.extremes.identify
A boolean field flagging every extreme cell and time (extreme_events).
Also: the percentile threshold of every cell, resolved through the year when seasonal (thresholds).
seasonal_percentile or global_percentile, upper or lower tail, exact or histogram percentiles
3. Tracking
marEx.tracker(...).run()
An event-ID field labelling each tracked event in space and time (ID_field).
Also: each event's area and centroid through time, its start and end, and the full merge history.
overlap-based merging and splitting, gap filling, area filtering

marEx.preprocess_data runs steps 1 and 2 in one call. Chained together, from daily SST to tracked marine heatwaves:

import xarray as xr
import marEx

# In a script, run this under `if __name__ == "__main__":` (its worker processes re-import the script).
client = marEx.helper.start_local_cluster(n_workers=4, memory_limit="8GB")

sst = xr.open_dataset("sst_data.nc", chunks={"time": 25}).sst

anomalies = marEx.anomaly.compute(sst, method="shifting_baseline")
extremes = marEx.extremes.identify(anomalies, method="seasonal_percentile", threshold_percentile=95)

events = marEx.tracker(
    extremes.extreme_events,
    extremes.mask,
    R_fill=8,
    area_filter_absolute=100,
    allow_merging=True,
).run()

fig, ax, im = (events.ID_field > 0).mean("time").plotX.single_plot(
    marEx.PlotConfig(var_units="Event Frequency", cmap="hot_r", cperc=[0, 96])
)

Seven tracked North Atlantic marine heatwaves, 2017-18: four map snapshots above a timeline of each event's area and its contacts with the others

A family of seven tracked marine heatwaves in the North Atlantic, October 2017 to August 2018 (95th percentile, OSTIA SST). Each colour is one event, and ribbon thickness is its area. Grey bands mark when two events touch. The tracker resolves merges and splits there, and each event keeps its identity.


Performance

Stage Data Size Wall-time
Detect ICON SST, 14.9 M cells, 30 yr daily 1.3 TB 37 min
Detect Global SST 0.25°, 20 yr 6-hourly 243 GB 166 min
Detect Global SST 0.25°, 40 yr daily 122 GB 61 min
Track Global 0.25°, 20 yr 6-hourly 91 GB 139 min
Track ICON, 14.9 M cells, 3 yr daily 66 GB 70 min
Track Global 0.25°, 10 yr daily 16 GB 27 min

Sizing guidance is in the performance guide.


Installation

pip install marEx[full,hpc]

For HPC environments and optional dependencies, see the Installation Guide.


Documentation

Section What's there
Getting Started Installation and a five-minute quickstart
Tutorials End-to-end notebooks for gridded, regional and unstructured data
Applications Marine and atmospheric heatwaves, wind and precipitation droughts, subsurface ocean extremes and event catalogues
User Guide Anomalies, extremes, dimensions and time, tracking, performance, validation
What's New Changes in 5.0 and the migration table for renamed methods and parameters
Why marEx? The design choices, with a tracking-comparison video
API Reference Every public function and class
Troubleshooting Common issues and solutions

Development and Validation

I developed the scientific methodology and the implementation of marEx by hand up to and including v4.1 (April 2026), and have since used Claude Code as an aide to help optimise, generalise and test it. Since mid-2026 every change has been checked against reference outputs to round-off precision. The validation page describes what is tested.


Getting Help

When reporting an issue, include marEx.__version__, the Python version and OS, marEx.print_dependency_status(), a minimal reproducible example and the full traceback.


Citation

When using marEx in publications, please cite:


License

marEx is licensed under the GNU Affero General Public License v3.0 or later. You can use, study, modify and share it freely. If you distribute a modified version, or run one as a network service, you must release your changes under the same licence. Keep the NOTICE and cite marEx in published work.

The code and documentation are reserved from text and data mining, including AI model training (Art. 4(3) of the EU Directive 2019/790). For other licensing terms, get in touch.


Funding

  • The EERIE (European Eddy-Rich ESMs) Project
  • The European Union's Horizon Europe research and innovation programme under Grant Agreement No. 101081383
  • The Swiss State Secretariat for Education, Research and Innovation (SERI) under contract #22.00366

Contact

For questions, comments, or collaboration opportunities, please contact Aaron Wienkers.

Metadata

Release files for marEx 5.0.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 marEx 5.0.0
File Size Uploaded Provenance Actions
marex-5.0.0.tar.gz 17.4 MB With provenance Details for marex-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marEx 5.0.0
File Interpreter ABI Platform Actions
marex-5.0.0-py3-none-any.whl Python 3 none any Details for marex-5.0.0-py3-none-any.whl

Total release size: 17.7 MB

Release files / marex-5.0.0.tar.gz

Download URL marex-5.0.0.tar.gz
Size 17.4 MB
Tags Source
SHA-256 checksum
How to use checksums
e6c6892d082f516ffed4321b60ca0b292590ccaca220cad1c7f32bef2fa27aa8
BLAKE2b-256 checksum
How to use checksums
a5fa7d6bfbc2ca0af201415cf6facf34d6c2239d5548660fe4ff4096d21cc2da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / marex-5.0.0-py3-none-any.whl

Download URL marex-5.0.0-py3-none-any.whl
Size 296.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5a9621d57cd0a3ac246a3e31594391e8a963bd97f82ff34e93f47598bf87f2e
BLAKE2b-256 checksum
How to use checksums
057fb6f5bc8027459d8f058481bd73efb7f498940c7f734607ee8e9267dce375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for marEx 5.0.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for marex-5.0.0.tar.gz

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 Nov 1, 2026.

Transparency log

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.

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