Skip to main content

DOI

Description

The XRO is an eXtended nonlinear Recharge Oscillator model for El Niño-Southern Oscillation (ENSO) and other modes of variability in the global oceans. It builds on the legacies of the Hasselmann stochastic climate model capturing upper ocean memory in SST variability, and the recharge oscillator model for the oscillatory core dynamics of ENSO. It constitutes a parsimonious representation of the climate system in a reduced variable and parameter space that still captures the essential dynamics of interconnected global climate variability.

This is updated version of XRO, with the model equations can be written as:

$$ \frac{d}{dt} \begin{pmatrix} X_{\text{ENSO}} \ X_M \end{pmatrix} = L \begin{pmatrix} X_{\text{ENSO}} \ X_M \end{pmatrix} + \begin{pmatrix} N_{\text{ENSO}} \ N_M \end{pmatrix} + \sigma_{\xi} G \xi, \quad (1) $$

$$ \frac{d\xi}{dt} = -r_{\xi} \xi + w(t), \quad (2) $$

where

$$ X_{\text{ENSO}} = [T_{\text{ENSO}}, h ] $$

and

$$ X_M = [T_{\text{NPMM}}, T_{\text{SPMM}}, T_{\text{IOB}}, T_{\text{IOD}}, T_{\text{SIOD}}, T_{\text{TNA}}, T_{\text{ATL3}}, T_{\text{SASD}}] $$

are state vectors of ENSO and other climate modes, respectively. This model allows for two-way interactions between ENSO and the other modes. $L$, $N$, $G(X)$ describe linear, nonlinear, multiplicative noise dynamics. For the detailed formulation of XRO model, please refer to our paper Zhao et al. (2024)[1] in Nature (v0.1).

This repository hosts the python package for XRO model. We have designed XRO to be user-friendly, aiming to be a valuable tool not only for research but also for operational forecasting and as an educational resource in the classroom. We hope that XRO proves to be both a practical and accessible tool that enhances your research and teaching experiences.

If you encounter problems in running XRO or have questions, please feel free to contact Sen Zhao (zhaos@hawaii.edu).


Installation

You can install XRO in two ways:

From PyPI

pip install XRO

From GitHub (latest development version)

pip install git+https://github.com/senclimate/XRO.git

Quick Start

XRO_Cookbook.ipynb is a Jupyter Notebook showing how to use XRO and reproduce the analysis of Zhao et al. 2024[1]. To successfully run the example, these open-source python modules may be necessary: numpy, xarray, climpred, matplotlib, and datetime.

XRO_realtime_states_forecasts.ipynb is a Jupyter Notebook showing how to calculate latest XRO state vectors from ORAS5 and conduct the realtime forecasts. Opertional XRO forecasts can be found at https://senzhao.netlify.app/climate/xro/.

XRO functionalities

XRO model is implemented in python with dependencies on only numpy and xarray. Key functionalities include:

  • XRO.fit_matrix is a precedure to train nonlinear XRO parameters from the observational and climate model outputs
  • XRO.simulate is a precedure to perform stochastic simulations with the trained parameters
  • XRO.reforecastis a precedue to perform reforecasting or forecasting using the trained parameters and initial condictions

Additional helper utilities are provided for data preprocessing and statistical analysis, including:

  • calc_XRO_indices – Compute the climate mode indices required by the XRO model (e.g., Niño3.4, WWV, NPMM, IOD, ATL3).
  • detrend – Remove linear or quadratic trends from xarray.DataArray or xarray.Dataset objects.
  • skew – Compute the skewness of climate variables.
  • kurt – Compute the kurtosis of climate variables.
  • pmtm - Thomson’s multitaper power spectral density (PSD) estimate
  • xcorr - Cross correlations
  • other functions can be found at stats.py state.py and visual.py

Applications

  • The repository Recharge Oscillator (RO) Practical for the ENSO Winter School 2025. The practical covers theoretical and computational aspects of the RO framework, its applications in ENSO simulations, and forecasting. When other climate modes are not considered, the XRO simplifies to the RO, making it well-suited for use in this practical context.

Acknowledgement

Kindly requested to cite our paper Zhao et al. (2024) [1] and code [2] if use the XRO model in your published works.

References

[1] Zhao, S., Jin, F.-F., Stuecker, M.F., Thompson, P.R., Kug, J.-S., McPhaden, M.J., Cane, M.A., Wittenberg, A.T., Cai, W., (2024). Explainable El Niño predictability from climate mode interactions. Nature. https://doi.org/10.1038/s41586-024-07534-6

[2] Zhao, S. (2024). Extended nonlinear Recharge Oscillator (XRO) model for "Explainable El Niño predictability from climate mode interactions". Zenodo. https://doi.org/10.5281/zenodo.10681114

Metadata

Release files for XRO 1.0.4

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

Source distribution (sdist)

Source distribution for XRO 1.0.4
File Size Uploaded
xro-1.0.4.tar.gz 37.8 kB Details

Built distribution (wheel)

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

Total release size: 75.1 kB

Release files / xro-1.0.4.tar.gz

Download URL xro-1.0.4.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bbe3cade9c549ed8a71335c1b30053f352c371450e3ff442b9275702d0ec4d98
BLAKE2b-256 checksum
How to use checksums
d720de470a39032fb341beeb5f211ed4dbb7a193095e1544fa91d71a7b01281d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 28, 2026.

Transparency log

Release files / xro-1.0.4-py3-none-any.whl

Download URL xro-1.0.4-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
048c47f1c880d32ecb4e6763dca1cedaad011060535641fde2585da921b797e7
BLAKE2b-256 checksum
How to use checksums
3bdb54126c6a000614d84f2cdaff0a2ef9f9b0b6b2e2b2e1d45d5889b7fe0794
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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