Open In Colab   Open in Kaggle

Sea Level Rise#

Content creators: Aakash Sane, Karsten Haustein

Content reviewers: Brodie Pearson, Abigail Bodner, Jenna Pearson, Chi Zhang, Ohad Zivan

Content editors: Zane Mitrevica, Natalie Steinemann, Jenna Pearson, Chi Zhang, Ohad Zivan

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

Our 2023 Sponsors: NASA TOPS and Google DeepMind

# @title Project Background

from ipywidgets import widgets
from IPython.display import YouTubeVideo
from IPython.display import IFrame
from IPython.display import display

class PlayVideo(IFrame):
    def __init__(self, id, source, page=1, width=400, height=300, **kwargs): = id
        if source == "Bilibili":
            src = f"{id}&page={page}"
        elif source == "Osf":
            src = f"{id}/?direct%26mode=render"
        super(PlayVideo, self).__init__(src, width, height, **kwargs)

def display_videos(video_ids, W=400, H=300, fs=1):
    tab_contents = []
    for i, video_id in enumerate(video_ids):
        out = widgets.Output()
        with out:
            if video_ids[i][0] == "Youtube":
                video = YouTubeVideo(
                    id=video_ids[i][1], width=W, height=H, fs=fs, rel=0
                print(f"Video available at{}")
                video = PlayVideo(
                if video_ids[i][0] == "Bilibili":
                        f"Video available at{}"
                elif video_ids[i][0] == "Osf":
                    print(f"Video available at{}")
    return tab_contents

video_ids = [('Youtube', 'FzXJ00pg34g'), ('Bilibili', 'BV1J14y197TT')]
tab_contents = display_videos(video_ids, W=730, H=410)
tabs = widgets.Tab()
tabs.children = tab_contents
for i in range(len(tab_contents)):
    tabs.set_title(i, video_ids[i][0])
# @title Tutorial slides
# @markdown These are the slides for the videos in all tutorials today
from IPython.display import IFrame
link_id = "u7x62"

download_link = f"{link_id}/"
render_link = f"{link_id}/?direct%26mode=render%26action=download%26mode=render"
# @markdown
out = widgets.Output()
with out:
    print(f"If you want to download the slides: {download_link}")
    display(IFrame(src=f"{render_link}", width=730, height=410))

Sea level, or Sea Surface Height [SSH], describes the vertical position of the interface between the atmosphere and the ocean. It varies at numerous timescales attributable to different physical factors, such as hourly tides, daily to monthly perturbations caused by currents and storms, and alterations spanning several decades to centuries due to thermal expansion of seawater and the reduction of mass resulting from glaciers and ice sheets. Read more: NOAA 2022 Sea level rise technical report.

In this project, you will work on sea level rise data from ECCO model (recall W1D2 tutorial 4 outputs) and tidal gauge datasets.

Project Template#

Project Template

Note: The dashed boxes are socio-economic questions.

Data Exploration Notebook#

Project Setup#

# imports
import random
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import os
import pooch
import tempfile
# helper functions

def pooch_load(filelocation=None, filename=None, processor=None):
    shared_location = (
        "/home/jovyan/shared/Data/Projects/Sea_Level"  # 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)
        file = pooch.retrieve(
            fname=os.path.join(user_temp_cache, filename),

    return file

ECCO Sea Surface Height (SSH)#

In this project, you will analyse sea surface height (SSH) data using the ECCO reanalysis product which combines simulations and observations. ECCO stands for Estimating the Circulation and Climate of the Ocean and integrates observations with coupled ocean/sea-ice models. The netCDF data file contains SSH stored as monthly means from the year 1992 to 2017 on a 0.5 x 0.5 degree grid. Using the ECCO product, global and regional sea level obtained due to physical effects (such as thermal expansion of sea water, etc.) can be estimated. Further details about the dataset can be obtained here.

The sea surface height variable is called ‘SSH’ in the data. It is a variable with three gridded dimensions: time, latitude, and longitude. The code below shows how to load the SSH dataset and provides plotting examples. One example plots the time-series at a particular latitude and longitude while another example plots a colormap on the global grid. Those examples should equip you to tackle many of the questions on the template, so go ahead and explore!

Further resources about the dataset:

filename = ""
url = None
ds = xr.open_dataset(pooch_load(url, filename))
Downloading data from 'None' to file '/tmp/'.
AttributeError                            Traceback (most recent call last)
Cell In[5], line 3
      1 filename = ""
      2 url = None
----> 3 ds = xr.open_dataset(pooch_load(url, filename))
      4 ds

Cell In[4], line 13, in pooch_load(filelocation, filename, processor)
     11     file = os.path.join(shared_location, filename)
     12 else:
---> 13     file = pooch.retrieve(
     14         filelocation,
     15         known_hash=None,
     16         fname=os.path.join(user_temp_cache, filename),
     17         processor=processor,
     18     )
     20 return file

File /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pooch/, in retrieve(url, known_hash, fname, path, processor, downloader, progressbar)
    229 get_logger().info(
    230     "%s data from '%s' to file '%s'.",
    231     verb,
    232     url,
    233     str(full_path),
    234 )
    236 if downloader is None:
--> 237     downloader = choose_downloader(url, progressbar=progressbar)
    239 stream_download(url, full_path, known_hash, downloader, pooch=None)
    241 if known_hash is None:

File /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pooch/, in choose_downloader(url, progressbar)
     30 """
     31 Choose the appropriate downloader for the given URL based on the protocol.
     65 """
     66 known_downloaders = {
     67     "ftp": FTPDownloader,
     68     "https": HTTPDownloader,
     71     "doi": DOIDownloader,
     72 }
---> 74 parsed_url = parse_url(url)
     75 if parsed_url["protocol"] not in known_downloaders:
     76     raise ValueError(
     77         f"Unrecognized URL protocol '{parsed_url['protocol']}' in '{url}'. "
     78         f"Must be one of {known_downloaders.keys()}."
     79     )

File /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pooch/, in parse_url(url)
    148 def parse_url(url):
    149     """
    150     Parse a URL into 3 components:
    179     """
--> 180     if url.startswith("doi://"):
    181         raise ValueError(
    182             f"Invalid DOI link '{url}'. You must not use '//' after 'doi:'."
    183         )
    184     if url.startswith("doi:"):

AttributeError: 'NoneType' object has no attribute 'startswith'
ds["SSH"][:, 200, 134].plot()
NameError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 ds["SSH"][:, 200, 134].plot()

NameError: name 'ds' is not defined
ds["SSH"][100, :, :].plot.pcolormesh()
NameError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 ds["SSH"][100, :, :].plot.pcolormesh()

NameError: name 'ds' is not defined

Observations Dataset: Tidal Gauges#

Students can download any tidal gauge data of their choice from this website

It is recommended to download the NetCDF ‘daily’ data for a particular location and it can be compared to the nearest latitude-longitude from the ECCO dataset. When you download the tidal gauge data, you can select a location, right click on the NetCDF of the data you want, copy link address and paste as the url below.

The file will have the sea level stored as a variable called ‘sea_level’, which is a function of time. It can be fun to explore how close the tidal gauge data agree (or disagree) with the ECCO data!

# students can download any tidal gauge data of their choice from this website:
# instructions: select a location, right click on the netcdf of the data you want, copy link address and paste as the url below
# data source-specific functions
url_choosen = ""  # this is the link for "Cuxhaven Germany", change to your location
# example code after downloading tidal gauge data:
ds = xr.open_dataset(
    pooch.retrieve(url_choosen, known_hash=None)
)  # this is just an example, tidal gauge NetCDF file needs to be downloaded in order to load this.
Downloading data from '' to file '/home/runner/.cache/pooch/'.
SHA256 hash of downloaded file: c8afc45f9555ac43bfd67ecf4fe7dc7a4d96d43060fddad7e0565ae8417fa9b7
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
<xarray.Dataset> Size: 465kB
Dimensions:               (record_id: 1, time: 38718)
  * time                  (time) datetime64[ns] 310kB 1917-12-30T12:00:00 ......
  * record_id             (record_id) int16 2B 8250
Data variables:
    sea_level             (record_id, time) float32 155kB ...
    lat                   (record_id) float32 4B ...
    lon                   (record_id) float32 4B ...
    station_name          (record_id) |S8 8B ...
    station_country       (record_id) |S7 7B ...
    station_country_code  (record_id) float32 4B ...
    uhslc_id              (record_id) int16 2B ...
    gloss_id              (record_id) float32 4B ...
    ssc_id                (record_id) |S4 4B ...
    last_rq_date          (record_id) datetime64[ns] 8B ...
    title:                  UHSLC Fast Delivery Tide Gauge Data (daily)
    ncei_template_version:  NCEI_NetCDF_TimeSeries_Orthogonal_Template_v2.0
    featureType:            timeSeries
    Conventions:            CF-1.6, ACDD-1.3
    date_created:           2024-03-04T14:26:21Z
    publisher_name:         University of Hawaii Sea Level Center (UHSLC)
    summary:                The UHSLC assembles and distributes the Fast Deli...
    processing_level:       Fast Delivery (FD) data undergo a level 1 quality...
    acknowledgment:         The UHSLC Fast Delivery database is supported by ...

Further Reading#

  • 2022 Sea Level Rise Technical Report

  • Oppenheimer, M., B.C. Glavovic , J. Hinkel, R. van de Wal, A.K. Magnan, A. Abd-Elgawad, R. Cai, M. Cifuentes-Jara, R.M. DeConto, T. Ghosh, J. Hay, F. Isla, B. Marzeion, B. Meyssignac, and Z. Sebesvari, 2019: Sea Level Rise and Implications for Low-Lying Islands, Coasts and Communities. In: IPCC Special Report on the Ocean and Cryosphere in a Changing Climate [H.-O. Pörtner, D.C. Roberts, V. Masson-Delmotte, P. Zhai, M. Tignor, E. Poloczanska, K. Mintenbeck, A. Alegría, M. Nicolai, A. Okem, J. Petzold, B. Rama, N.M. Weyer (eds.)]. Cambridge University Press, Cambridge, UK and New York, NY, USA, pp. 321-445.

  • Domingues, R., Goni, G., Baringer, M., &Volkov, D. (2018). What caused theaccelerated sea level changes along theU.S. East Coast during 2010–2015?Geophysical Research Letters,45,13,367–13,376.

  • Church, J.A., P.U. Clark, A. Cazenave, J.M. Gregory, S. Jevrejeva, A. Levermann, M.A. Merrifield, G.A. Milne, R.S. Nerem, P.D. Nunn, A.J. Payne, W.T. Pfeffer, D. Stammer and A.S. Unnikrishnan, 2013: Sea Level Change. In: Climate Change 2013: The Physical Science Basis. Contribution of Working Group I to the Fifth Assessment Report of the Intergovernmental Panel on Climate Change [Stocker, T.F., D. Qin, G.-K. Plattner, M. Tignor, S.K. Allen, J. Boschung, A. Nauels, Y. Xia, V. Bex and P.M. Midgley (eds.)]. Cambridge University Press, Cambridge, United Kingdom and New York, NY, USA.

  • Gregory, J.M., Griffies, S.M., Hughes, C.W. et al. Concepts and Terminology for Sea Level: Mean, Variability and Change, Both Local and Global. Surv Geophys 40, 1251–1289 (2019).

  • Wang, J., Church, J. A., Zhang, X., Gregory, J. M., Zanna, L., & Chen, X. (2021). Evaluation of the Local Sea‐Level Budget at Tide Gauges Since 1958. Geophysical Research Letters, 48(20), e2021GL094502.

  • Cazenave, A. and Cozannet, G.L. (2014), Sea level rise and its coastal impacts. Earth’s Future, 2: 15-34.

  • Mimura N. Sea-level rise caused by climate change and its implications for society. Proc Jpn Acad Ser B Phys Biol Sci. 2013;89(7):281-301. doi: 10.2183/pjab.89.281. PMID: 23883609; PMCID: PMC3758961. doi: 10.2183/pjab.89.281


This tutorial uses data from the simulations conducted as part of the CMIP6 multi-model ensemble.

For examples on how to access and analyze data, please visit the Pangeo Cloud CMIP6 Gallery

For more information on what CMIP is and how to access the data, please see this page.