{ "cells": [ { "cell_type": "markdown", "id": "981289d4-c970-4959-ac0f-f954d3201563", "metadata": {}, "source": [ "# Quickstart\n", "\n", "This notebook demonstrates how to use `pyCRO` in the simplest configuration of the Recharge Oscillator (RO) model, featuring linear dynamics and additive white-noise forcing.\n", "\n", "The RO model is written as:\n", "\n", "$\\displaystyle \\frac{dT}{dt} = RT + F_{1}h + \\sigma_{T}w_{T}$\n", "\n", "$\\displaystyle \\frac{dh}{dt} = -\\varepsilon h - F_{2}T + \\sigma_{h}w_{h}$\n", "\n", "where:\n", "\n", "- $T$ is the sea surface temperature (SST) anomaly,\n", "- $h$ is the thermocline depth anomaly (recharge-discharge state),\n", "- $w_T$ and $w_h$ are independent white-noise processes,\n", "- $R$, $F_1$, $F_2$, and $\\varepsilon$ are dynamical RO feedback parameters,\n", "- $\\sigma_T$ and $\\sigma_h$ control stochastic forcing amplitudes.\n", "\n", "This notebook was contributed by [Sen Zhao](https://senzhao.netlify.app/).\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "89234f6a", "metadata": { "execution": { "iopub.execute_input": "2026-07-06T03:31:44.203563Z", "iopub.status.busy": "2026-07-06T03:31:44.203395Z", "iopub.status.idle": "2026-07-06T03:31:45.736890Z", "shell.execute_reply": "2026-07-06T03:31:45.736483Z", "shell.execute_reply.started": "2026-07-06T03:31:44.203549Z" }, "lines_to_next_cell": 2, "scrolled": true }, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\")\n", "\n", "import os\n", "import sys\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "sys.path.append(os.path.abspath(\"../../../\"))\n", "\n", "import pyCRO" ] }, { "cell_type": "markdown", "id": "1a1adf00", "metadata": { "cell_marker": "\"\"\"" }, "source": [ "## Load precomputed RO parameters from ORAS5" ] }, { "cell_type": "code", "execution_count": 2, "id": "1bdb5445", "metadata": { "execution": { "iopub.execute_input": "2026-07-06T03:31:45.737651Z", "iopub.status.busy": "2026-07-06T03:31:45.737379Z", "iopub.status.idle": "2026-07-06T03:31:45.775152Z", "shell.execute_reply": "2026-07-06T03:31:45.774758Z", "shell.execute_reply.started": "2026-07-06T03:31:45.737636Z" }, "lines_to_next_cell": 2, "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "{'R': [-0.0731702636710546],\n", " 'F1': [0.017938268057197594],\n", " 'F2': [1.2939079422481348],\n", " 'epsilon': [0.008754185790444461],\n", " 'b_T': [],\n", " 'c_T': [],\n", " 'd_T': [],\n", " 'b_h': [],\n", " 'sigma_T': [0.21698921132838628],\n", " 'sigma_h': [1.5547824185851542],\n", " 'B': [],\n", " 'm_T': [],\n", " 'm_h': [],\n", " 'n_T': [1],\n", " 'n_h': [1],\n", " 'n_g': [2]}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "par = pyCRO.par_load(data_name=\"ORAS5\", ro_name = \"Linear-White-Additive\")\n", "par" ] }, { "cell_type": "markdown", "id": "e0b75f1f-1037-423c-990e-d440fad76ebb", "metadata": {}, "source": [ "## Conduct RO simulations" ] }, { "cell_type": "code", "execution_count": 3, "id": "a6790adb", "metadata": { "execution": { "iopub.execute_input": "2026-07-06T03:31:45.776095Z", "iopub.status.busy": "2026-07-06T03:31:45.775940Z", "iopub.status.idle": "2026-07-06T03:31:47.563718Z", "shell.execute_reply": "2026-07-06T03:31:47.563319Z", "shell.execute_reply.started": "2026-07-06T03:31:45.776082Z" } }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 48kB\n",
"Dimensions: (time: 1200, member: 2)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 10kB 1900-01-01 1900-02-01 ... 1999-12-01\n",
" * member (member) int64 16B 0 1\n",
"Data variables:\n",
" T (time, member) float64 19kB 1.0 1.0 0.4566 ... -1.924 0.8034 -2.128\n",
" h (time, member) float64 19kB 0.0 0.0 -2.964 ... -13.88 12.26 -12.31