{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Calculate ENSO Skill as a Function of Initial Month vs. Lead Time" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### In this example, we demonstrate: \n", "1. How to remotely access data from the North American Multi-model Ensemble (NMME) hindcast database and set it up to be used in `climpred`. \n", "2. How to calculate the Anomaly Correlation Coefficient (ACC) using monthly data\n", "3. How to calculate and plot historical forecast skill of the Nino3.4 index as function of initialization month and lead time." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The North American Multi-model Ensemble (NMME)\n", "\n", "Further information on NMME is available from [Kirtman et al. 2014](https://journals.ametsoc.org/doi/full/10.1175/BAMS-D-12-00050.1) and the [NMME project website](https://www.cpc.ncep.noaa.gov/products/NMME/)\n", "\n", "The NMME public database is hosted on the International Research Institute for Climate and Society (IRI) data server http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/\n", "\n", "Since the NMME data server is accessed via this notebook, the time for the notebook to run may take a few minutes and vary depending on the speed that data is downloaded." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Definitions\n", "\n", "**Anomalies**\n", ": Departure from normal, where normal is defined as the climatological value based on the average value for each month over all years.\n", "\n", "**Nino3.4**\n", ": An index used to represent the evolution of the El Nino-Southern Oscillation (ENSO). Calculated as the average sea surface temperature (SST) anomalies in the region 5S-5N; 190-240" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2020-01-06T20:26:56.235431Z", "start_time": "2020-01-06T20:26:54.064651Z" } }, "outputs": [], "source": [ "import warnings\n", "\n", "import matplotlib.pyplot as plt\n", "import xarray as xr\n", "import pandas as pd\n", "import numpy as np\n", "from tqdm.auto import tqdm\n", "\n", "from climpred import HindcastEnsemble\n", "import climpred" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2020-01-06T20:26:56.238990Z", "start_time": "2020-01-06T20:26:56.236743Z" } }, "outputs": [], "source": [ "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Function to set 360 calendar to 360_day calendar and decond cf times" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2020-01-06T20:26:56.595041Z", "start_time": "2020-01-06T20:26:56.592324Z" } }, "outputs": [], "source": [ "def decode_cf(ds, time_var):\n", " if ds[time_var].attrs['calendar'] == '360':\n", " ds[time_var].attrs['calendar'] = '360_day'\n", " ds = xr.decode_cf(ds, decode_times=True)\n", " return ds" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load the monthly sea surface temperature (SST) hindcast data for the NCEP-CFSv2 model from the NMME data server. This is a large dataset, so we allow dask to chunk the data as it chooses. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2020-01-06T20:26:57.233967Z", "start_time": "2020-01-06T20:26:56.904799Z" } }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (L: 10, M: 24, S: 348, X: 360, Y: 181)\n", "Coordinates:\n", " * S (S) object 1982-01-01 00:00:00 ... 2010-12-01 00:00:00\n", " * M (M) float32 1.0 2.0 3.0 4.0 5.0 6.0 ... 20.0 21.0 22.0 23.0 24.0\n", " * X (X) float32 0.0 1.0 2.0 3.0 4.0 ... 355.0 356.0 357.0 358.0 359.0\n", " * L (L) float32 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5\n", " * Y (Y) float32 -90.0 -89.0 -88.0 -87.0 -86.0 ... 87.0 88.0 89.0 90.0\n", "Data variables:\n", " sst (S, L, M, Y, X) float32 dask.array<chunksize=(6, 5, 8, 181, 360), meta=np.ndarray>\n", "Attributes:\n", " Conventions: IRIDL" ], "text/plain": [ "
<xarray.Dataset>\n", "Dimensions: (T: 405, X: 360, Y: 181)\n", "Coordinates:\n", " * Y (Y) float32 -90.0 -89.0 -88.0 -87.0 -86.0 ... 87.0 88.0 89.0 90.0\n", " * X (X) float32 0.0 1.0 2.0 3.0 4.0 ... 355.0 356.0 357.0 358.0 359.0\n", " * T (T) object 1982-01-16 00:00:00 ... 2015-09-16 00:00:00\n", "Data variables:\n", " sst (T, Y, X) float32 ...\n", "Attributes:\n", " Conventions: IRIDL" ], "text/plain": [ "