{ "cells": [ { "cell_type": "markdown", "id": "8b364e86-fc6c-4765-ba0a-fcb43cdf3e18", "metadata": {}, "source": [ "# `CRO` fitting with CMIP6 models\n", "\n", "This tutorial illustrates how to use the `pyCRO` to estimate RO parameters from all CMIP6 models\n", "\n", "This notebook was contributed by [Sen Zhao](https://senzhao.netlify.app/).\n" ] }, { "cell_type": "markdown", "id": "0f4e2cb2-dd0b-4bd2-a3c0-2ef8ce14f7e2", "metadata": {}, "source": [ "## Load library" ] }, { "cell_type": "code", "execution_count": 1, "id": "e89a1089", "metadata": { "execution": { "iopub.execute_input": "2026-07-06T02:51:26.631710Z", "iopub.status.busy": "2026-07-06T02:51:26.631573Z", "iopub.status.idle": "2026-07-06T02:51:28.234319Z", "shell.execute_reply": "2026-07-06T02:51:28.233856Z", "shell.execute_reply.started": "2026-07-06T02:51:26.631696Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "%config IPCompleter.greedy = True\n", "%matplotlib inline\n", "%config InlineBackend.figure_format='retina'\n", "\n", "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import os\n", "import sys\n", " \n", "import numpy as np\n", "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "\n", "## comment this if you install pyCRO already\n", "sys.path.append(os.path.abspath(\"../../../\"))\n", "\n", "import pyCRO" ] }, { "cell_type": "markdown", "id": "376b849b-f178-4ac1-b2ef-5b642efca915", "metadata": {}, "source": [ "## Load ENSO timeseries from CMIP6 models" ] }, { "cell_type": "code", "execution_count": 2, "id": "66ff7c12", "metadata": { "execution": { "iopub.execute_input": "2026-07-06T02:51:28.235118Z", "iopub.status.busy": "2026-07-06T02:51:28.234828Z", "iopub.status.idle": "2026-07-06T02:51:29.077771Z", "shell.execute_reply": "2026-07-06T02:51:29.077368Z", "shell.execute_reply.started": "2026-07-06T02:51:28.235101Z" }, "lines_to_next_cell": 2 }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 1MB\n",
"Dimensions: (model: 48, time: 1332)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 11kB 1900-01-01 1900-02-01 ... 2010-12-01\n",
" * model (model) <U15 3kB 'ACCESS-CM2' 'ACCESS-ESM1-5' ... 'UKESM1-0-LL'\n",
"Data variables:\n",
" Nino3 (model, time) float32 256kB ...\n",
" Nino34 (model, time) float32 256kB ...\n",
" Hm (model, time) float32 256kB ...\n",
" Hw (model, time) float32 256kB ...<xarray.Dataset> Size: 9kB\n",
"Dimensions: (model: 48, ac_0: 1)\n",
"Coordinates:\n",
" * model (model) <U15 3kB 'ACCESS-CM2' 'ACCESS-ESM1-5' ... 'UKESM1-0-LL'\n",
"Dimensions without coordinates: ac_0\n",
"Data variables: (12/16)\n",
" R (model, ac_0) float64 384B -0.0277 0.04347 ... 0.07818 0.006757\n",
" F1 (model, ac_0) float64 384B 0.03008 0.0195 ... 0.03125 0.02193\n",
" F2 (model, ac_0) float64 384B 1.138 1.671 1.259 ... 1.106 1.602 1.103\n",
" epsilon (model, ac_0) float64 384B 0.08306 0.1292 0.1211 ... 0.1831 0.09856\n",
" b_T (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" c_T (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" ... ...\n",
" B (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" m_T (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" m_h (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" n_T (model, ac_0) float64 384B 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n",
" n_h (model, ac_0) float64 384B 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n",
" n_g (model, ac_0) float64 384B 2.0 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0<xarray.Dataset> Size: 9kB\n",
"Dimensions: (model: 48, ac_0: 1)\n",
"Coordinates:\n",
" * model (model) <U15 3kB 'ACCESS-CM2' 'ACCESS-ESM1-5' ... 'UKESM1-0-LL'\n",
"Dimensions without coordinates: ac_0\n",
"Data variables: (12/16)\n",
" R (model, ac_0) float64 384B -0.02369 0.06183 ... 0.1074 0.0235\n",
" F1 (model, ac_0) float64 384B 0.03023 0.01987 ... 0.0325 0.02317\n",
" F2 (model, ac_0) float64 384B 1.129 1.654 1.259 ... 1.105 1.605 1.109\n",
" epsilon (model, ac_0) float64 384B 0.08266 0.1288 0.1332 ... 0.187 0.1002\n",
" b_T (model, ac_0) float64 384B 0.01088 -0.002446 ... 0.03614 0.03063\n",
" c_T (model, ac_0) float64 384B 0.0006461 0.00857 ... 0.005134 0.002772\n",
" ... ...\n",
" B (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" m_T (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" m_h (model, ac_0) float64 384B nan nan nan nan nan ... nan nan nan nan\n",
" n_T (model, ac_0) float64 384B 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n",
" n_h (model, ac_0) float64 384B 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n",
" n_g (model, ac_0) float64 384B 2.0 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0"
],
"text/plain": [
"