Open In Colab   Open in Kaggle

Tutorial 6: Large Scale Climate Variability - ENSO#

Week 1, Day 3, Remote Sensing

Content creators: Douglas Rao

Content reviewers: Katrina Dobson, Younkap Nina Duplex, Maria Gonzalez, Will Gregory, Nahid Hasan, Sherry Mi, Beatriz Cosenza Muralles, Jenna Pearson, Agustina Pesce, Chi Zhang, Ohad Zivan

Content editors: Jenna Pearson, Chi Zhang, Ohad Zivan

Production editors: Wesley Banfield, Jenna Pearson, Chi Zhang, Ohad Zivan

Our 2023 Sponsors: NASA TOPS and Google DeepMind

Tutorial Objectives#

In this tutorial, you will build upon the introduction to El Niño-Southern Oscillation (ENSO) from Day 1 and 2. ENSO is recognized as one of the most influential large-scale climate variabilities that impact weather and climate patterns.

By the end of this tutorial, you will:

  • Enhance your comprehension of the concept of ENSO and the three distinct phases associated with it.

  • Utilize satellite-derived sea surface temperature (SST) data to compute an index for monitoring ENSO.

Setup#

# installations ( uncomment and run this cell ONLY when using google colab or kaggle )

# # properly install cartopy in colab to avoid session crash
# !apt-get install libproj-dev proj-data proj-bin --quiet
# !apt-get install libgeos-dev --quiet
# !pip install cython --quiet
# !pip install cartopy --quiet
# !pip install geoviews

# !apt-get -qq install python-cartopy python3-cartopy  --quiet
# !pip uninstall -y shapely  --quiet
# !pip install shapely --no-binary shapely  --quiet

# !pip install boto3 --quiet

# you may need to restart the runtime after running this cell and that is ok
# imports
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
import os
import requests
import tarfile
import pooch
import os
import tempfile
import holoviews
from geoviews import Dataset as gvDataset
import geoviews.feature as gf
from geoviews import Image as gvImage

Figure settings#

Hide code cell source
# @title Figure settings
import ipywidgets as widgets  # interactive display

%config InlineBackend.figure_format = 'retina'
plt.style.use(
    "https://raw.githubusercontent.com/ClimateMatchAcademy/course-content/main/cma.mplstyle"
)

Helper functions#

Hide code cell source
# @title Helper functions

def pooch_load(filelocation=None, filename=None, processor=None):
    shared_location = "/home/jovyan/shared/data/tutorials/W1D3_RemoteSensingLandOceanandAtmosphere"  # this is different for each day
    user_temp_cache = tempfile.gettempdir()

    if os.path.exists(os.path.join(shared_location, filename)):
        file = os.path.join(shared_location, filename)
    else:
        file = pooch.retrieve(
            filelocation,
            known_hash=None,
            fname=os.path.join(user_temp_cache, filename),
            processor=processor,
        )

    return file

Video 1: Satellite Data and Climate Variability#

Section 1: El Niño-Southern Oscillation (ENSO)#

As you learned in Day 1 and 2, one of the most significant large-scale climate variabilities is El Niño-Southern Oscillation (ENSO). ENSO can change the global atmospheric circulation, which in turn, influences temperature and precipitation across the globe.

Despite being a single climate phenomenon, ENSO exhibits three distinct phases:

  • El Niño: A warming of the ocean surface, or above-average sea surface temperatures, in the central and eastern tropical Pacific Ocean.

  • La Niña: A cooling of the ocean surface, or below-average sea surface temperatures, in the central and eastern tropical Pacific Ocean.

  • Neutral: Neither El Niño or La Niña. Often tropical Pacific SSTs are generally close to average.

In Day 2, you practiced utilizing a variety of Xarray tools to examine variations in sea surface temperature (SST) during El Niño and La Niña events by calculating the Oceanic Niño Index (ONI) from reanalysis data over the time period 2000-2014.

In contrast to previous days, in this tutorial you will use satellite-based SST data to monitor ENSO over a longer time period starting in 1981.

Section 1.1: Calculate SST Anomaly#

Optimum Interpolation Sea Surface Temperature (OISST) is a long-term Climate Data Record that incorporates observations from different platforms (satellites, ships, buoys and Argo floats) into a regular global grid. OISST data is originally produced at daily and 1/4° spatial resolution. To avoid the large amount of data processing of daily data, we use the monthly aggregated OISST SST data provided by NOAA Physical Systems Laboratory.

# download the monthly sea surface temperature data from NOAA Physical System
# Laboratory. The data is processed using the OISST SST Climate Data Records
# from the NOAA CDR program.
# the data downloading may take 2-3 minutes to complete.
# filename=sst.mon.mean.nc
url_sst = "https://osf.io/6pgc2/download/"
filename = "sst.mon.mean.nc"

# we divide the data into small chunks to allow for easier memory manangement. this is all done automatically, no need for you to do anything
ds = xr.open_dataset(
    pooch_load(filelocation=url_sst, filename=filename),
    chunks={"time": 25, "latitude": 200, "longitude": 200},
)
ds
<xarray.Dataset> Size: 2GB
Dimensions:  (time: 499, lat: 720, lon: 1440)
Coordinates:
  * time     (time) datetime64[ns] 4kB 1981-09-01 1981-10-01 ... 2023-03-01
  * lat      (lat) float32 3kB -89.88 -89.62 -89.38 -89.12 ... 89.38 89.62 89.88
  * lon      (lon) float32 6kB 0.125 0.375 0.625 0.875 ... 359.4 359.6 359.9
Data variables:
    sst      (time, lat, lon) float32 2GB dask.array<chunksize=(25, 720, 1440), meta=np.ndarray>
Attributes:
    Conventions:    CF-1.5
    title:          NOAA/NCEI 1/4 Degree Daily Optimum Interpolation Sea Surf...
    institution:    NOAA/National Centers for Environmental Information
    source:         NOAA/NCEI https://www.ncei.noaa.gov/data/sea-surface-temp...
    References:     https://www.psl.noaa.gov/data/gridded/data.noaa.oisst.v2....
    dataset_title:  NOAA Daily Optimum Interpolation Sea Surface Temperature
    version:        Version 2.1
    comment:        Reynolds, et al.(2007) Daily High-Resolution-Blended Anal...

The monthly OISST data is available starting from September of 1981. We will use the Niño 3.4 (5N-5S, 170W-120W) region to monitor the ENSO as identified in the map below provided by NOAA Climate portal.

Location of four different nino regions

Credit: NOAA

The data is only available in full years starting 1982, so we will use 1982-2011 as the climatology period.

# get 30-year climatology from 1982-2011
sst_30yr = ds.sst.sel(time=slice("1982-01-01", "2011-12-01"))

# calculate monthly climatology
sst_clim = sst_30yr.groupby("time.month").mean()
sst_clim
<xarray.DataArray 'sst' (month: 12, lat: 720, lon: 1440)> Size: 50MB
dask.array<stack, shape=(12, 720, 1440), dtype=float32, chunksize=(1, 720, 1440), chunktype=numpy.ndarray>
Coordinates:
  * lat      (lat) float32 3kB -89.88 -89.62 -89.38 -89.12 ... 89.38 89.62 89.88
  * lon      (lon) float32 6kB 0.125 0.375 0.625 0.875 ... 359.4 359.6 359.9
  * month    (month) int64 96B 1 2 3 4 5 6 7 8 9 10 11 12
Attributes:
    long_name:      Monthly Mean of Sea Surface Temperature
    units:          degC
    valid_range:    [-3. 45.]
    precision:      2.0
    dataset:        NOAA High-resolution Blended Analysis
    var_desc:       Sea Surface Temperature
    level_desc:     Surface
    statistic:      Monthly Mean
    parent_stat:    Individual Observations
    actual_range:   [-1.8  32.14]
    standard_name:  sea_surface_temperature
# calculate monthly anomaly
sst_anom = ds.sst.groupby("time.month") - sst_clim
sst_anom
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/xarray/core/indexing.py:1430: PerformanceWarning: Slicing with an out-of-order index is generating 42 times more chunks
  return self.array[key]
<xarray.DataArray 'sst' (time: 499, lat: 720, lon: 1440)> Size: 2GB
dask.array<sub, shape=(499, 720, 1440), dtype=float32, chunksize=(1, 720, 1440), chunktype=numpy.ndarray>
Coordinates:
  * time     (time) datetime64[ns] 4kB 1981-09-01 1981-10-01 ... 2023-03-01
  * lat      (lat) float32 3kB -89.88 -89.62 -89.38 -89.12 ... 89.38 89.62 89.88
  * lon      (lon) float32 6kB 0.125 0.375 0.625 0.875 ... 359.4 359.6 359.9
    month    (time) int64 4kB 9 10 11 12 1 2 3 4 5 6 ... 6 7 8 9 10 11 12 1 2 3

Now, we can take a look at the SST anomaly of a given month. We use January of 1998 to show the specific change of SST during that time period.

# properly install cartopy in colab to avoid session crash

sst = sst_anom.sel(time="1998-01-01")

# initate plot
fig, ax = plt.subplots(
    subplot_kw={"projection": ccrs.Robinson(central_longitude=180)}, figsize=(9, 6)
)

# focus on the ocean with the central_longitude=180
ax.coastlines()
ax.gridlines()
sst.plot(
    ax=ax,
    transform=ccrs.PlateCarree(),
    vmin=-3,
    vmax=3,
    cmap="RdBu_r",
    cbar_kwargs=dict(shrink=0.5, label="OISST Anomaly (degC)"),
)
<cartopy.mpl.geocollection.GeoQuadMesh at 0x7fbbe60de610>
../../../_images/f1c3bba09a8a76128e950cf3f782bd52305a55a94616d877abee50685f89b605.png

Interactive Demo 1.1#

Use the slider bar below to explore maps of the anomalies through the year in 1998.

# note this code takes a while to load. probably an hour
# holoviews.extension('bokeh')

# dataset_plot = gvDataset(sst_anom.sel(time=slice('1998-01-01','1998-12-01'))) # taking only 12 months
# images = dataset_plot.to(gvImage, ['lon', 'lat'], ['sst'], 'time')
# images.opts(cmap='RdBu_r', colorbar=True, width=600, height=400,projection=ccrs.Robinson(),
#             clim=(-3,3),clabel ='OISST Anomaly (degC)') * gf.coastline

Section 1.2: Monitoring ENSO with Oceanic Niño Index#

As you learned in Day 2, the Oceanic Niño Index (ONI) is a common index used to monitor ENSO. It is calculated using the Niño 3.4 region (5N-5S, 170W-120W) and by applying a 3-month rolling mean to the mean SST anomalies in that region.

You may have noticed that the lon for the SST data from NOAA Physical Systems Laboratory is organized between 0°–360°E. Just as in Tutorial 1 of Day 2, we find that the region to subset with our dataset is (-5°–5°, 190–240°).

# extract SST data from the Nino 3.4 region
sst_nino34 = sst_anom.sel(lat=slice(-5, 5), lon=slice(190, 240))
sst_nino34
<xarray.DataArray 'sst' (time: 499, lat: 40, lon: 200)> Size: 16MB
dask.array<getitem, shape=(499, 40, 200), dtype=float32, chunksize=(1, 40, 200), chunktype=numpy.ndarray>
Coordinates:
  * time     (time) datetime64[ns] 4kB 1981-09-01 1981-10-01 ... 2023-03-01
  * lat      (lat) float32 160B -4.875 -4.625 -4.375 ... 4.375 4.625 4.875
  * lon      (lon) float32 800B 190.1 190.4 190.6 190.9 ... 239.4 239.6 239.9
    month    (time) int64 4kB 9 10 11 12 1 2 3 4 5 6 ... 6 7 8 9 10 11 12 1 2 3
# calculate the mean values for the Nino 3.4 region
nino34 = sst_nino34.mean(dim=["lat", "lon"])

# Pplot time series for Nino 3.4 mean anomaly
fig, ax = plt.subplots(figsize=(12, 6))
nino34.plot(ax=ax)
ax.set_ylabel("Nino3.4 Anomaly (degC)")
ax.axhline(y=0, color="k", linestyle="dashed")
<matplotlib.lines.Line2D at 0x7fbbcef7f340>
../../../_images/92765cdefac0ae474e2340d397a8ab74c0e88cd48979568c343cc55fa506f8a2.png

The ONI is defined as the 3-month rolling mean of the monthly regional average of the SST anomaly for the Nino 3.4 region. We can use .rolling() to calculate the ONI value for each month from the OISST monthly anomaly.

# calculate 3-month rolling mean of Nino 3.4 anomaly for the ONI
oni = nino34.rolling(time=3, center=True).mean()

# generate time series plot
fig, ax = plt.subplots(figsize=(12, 6))
nino34.plot(label="Nino 3.4", ax=ax)
oni.plot(color="k", label="ONI", ax=ax)
ax.set_ylabel("Anomaly (degC)")
ax.axhline(y=0, color="k", linestyle="dashed")
ax.legend()
<matplotlib.legend.Legend at 0x7fbbcfbf5a30>
../../../_images/f875611d3043f7ab3c78f60fd450f602e47d58ee32cc6c8dd60bf765d34de9b3.png

The different phases of ENSO are nominally defined based on a threshold of \(\pm\) 0.5 with the ONI index.

  • El Niño [ONI values higher than 0.5]: surface waters in the east-central tropical Pacific are at least 0.5 degrees Celsius warmer than normal.

  • La Niña [ONI values lower than -0.5]: surface waters ub the west tropical Pacific are at least 0.5 degrees Celsius cooler than normal.

The neutral phase is when ONI values are in between these two thresholds. We can make the ONI plot that is used by NOAA and other organizations to monitor ENSO phases.

# set up the plot size
fig, ax = plt.subplots(figsize=(12, 6))

# create the filled area when ONI values are above 0.5 for El Nino
ax.fill_between(
    oni.time.data,
    oni.where(oni >= 0.5).data,
    0.5,
    color="red",
    alpha=0.9,
)

# create the filled area when ONI values are below -0.5 for La Nina
ax.fill_between(
    oni.time.data,
    oni.where(oni <= -0.5).data,
    -0.5,
    color="blue",
    alpha=0.9,
)

# create the time series of ONI
oni.plot(color="black", ax=ax)

# add the threshold lines on the plot
ax.axhline(0, color="black", lw=0.5)
ax.axhline(0.5, color="red", linewidth=0.5, linestyle="dotted")
ax.axhline(-0.5, color="blue", linewidth=0.5, linestyle="dotted")
ax.set_title("Oceanic Niño Index")
Text(0.5, 1.0, 'Oceanic Niño Index')
../../../_images/1706711433a785ed599246e4fe3b501e264bd6d56b6ebd3673a7b041c16bc364.png

From the plot, we can see the historical ENSO phases swing from El Nino to La Nina events. The major ENSO events like 1997-1998 shows up very clearly on the ONI plot.

We will use the ONI data to perform analysis to understand the impact of ENSO on precipitation. So you can export the ONI time series into a netCDF file for future use via .to_netcdf(). For our purposes, we will download a dataset that has been previously saved in the next tutorial. If you wanted to save the data when working on your own computer, this is the code you could use.

# oni.to_netcdf('t6_oceanic-nino-index.nc')

Coding Exercises 1.2#

As we learned here, ENSO is monitored using the anomaly of SST data for a specific region (e.g., Nino 3.4). We also learned previously that the reference periods used to calculate climatolgies are updated regularly to reflect the most up to date ‘normal’.

  1. Compare the ONI time series calculated using two different climatology reference periods (1982-2011 v.s. 1991-2020).

# select data from 1991-2020.
sst_30yr_later = ...

# calculate climatology
sst_clim_later = ...

# calculate anomaly
sst_anom_later = ...

# calculate mean over Nino 3.4 region
nino34_later = ...

# compute 3 month rolling mean
oni_later = ...

# compare the two ONI time series and visualize the difference as a time series plot
fig, ax = plt.subplots(figsize=(12, 6))
# oni.plot(color="k", label="ONI (1982-2011)", ax=ax)
# oni_later.plot(color="r", label="ONI (1991-2020)", ax=ax)
ax.set_ylabel("Anomaly (degC)")
ax.axhline(y=0, color="k", linestyle="dashed")
ax.legend()
No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
<matplotlib.legend.Legend at 0x7fbbcfcb08e0>
../../../_images/079b8bd3109e911629931c03f21dcc7db1525888824870ece21f46adf6c8f41a.png

Click for solution

Example output:

Solution hint

Questions 1.2: Climate Connection#

  1. What is the main difference you note about this plot?

  2. What does this tell you about the climatology calculated from 1982-2011 versus 1991-2020?

  3. Why is it important to use appropriate climatologies when finding anomalies?

Click for solution

Summary#

In this tutorial, you revisted the foundational principles of ENSO and explored how satellite data can be employed to track this phenomenon.

  • As one of the most potent climate influences on Earth, ENSO has the capacity to alter global atmospheric circulation with impacts around the world.

  • You observed the three phases of ENSO by utilizing SST data gathered from satellites and calculating the Oceanic Niño Index.

In the forthcoming tutorial, we will utilize the ONI, calculated in this session, to evaluate the influence of ENSO on precipitation in select regions.

Resources#

Data from this tutorial can be accessed here.