Open In Colab   Open in Kaggle

Intro#

Overview#

Today you will be introduced to climate models, which are one of the primary tools of climate science. There are numerous types of climate models, each with their distinct complexity, utility, and limitations. In today’s tutorials you will engage with a hierarchy of climate models with differing levels of complexity. You will begin by creating a simple climate model to predict Earth’s global mean surface temperature based on incoming and outgoing radiation. In later tutorials, you will extend this model to include more complexity through the addition of physics (albedo; [de]glaciation; convection) and dimensions (vertical structure of the atmosphere; latitudinal insolation variations). At the end of the day you will access and analyze surface heat flux data in a highly-complex climate model, CESM2, which is an Earth System Model (ESM) from the most recent Coupled Model Intercomparison Project, CMIP6.

Video 1: Climate Modeling#

# @markdown

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):
    self.id = id
    if source == 'Bilibili':
      src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'
    elif source == 'Osf':
      src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{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 https://youtube.com/watch?v={video.id}')
      else:
        video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,
                          height=H, fs=fs, autoplay=False)
        if video_ids[i][0] == 'Bilibili':
          print(f'Video available at https://www.bilibili.com/video/{video.id}')
        elif video_ids[i][0] == 'Osf':
          print(f'Video available at https://osf.io/{video.id}')
      display(video)
    tab_contents.append(out)
  return tab_contents


video_ids = [('Youtube', 'w0_ALij7bFY'), ('Bilibili', 'BV1rX4y1t7MD')]
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])
display(tabs)

Slides#

# @markdown
from ipywidgets import widgets
from IPython.display import IFrame

link_id = "y2bdn"

download_link = f"https://osf.io/download/{link_id}/"
render_link = f"https://mfr.ca-1.osf.io/render?url=https://osf.io/{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))
display(out)