{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"[](https://colab.research.google.com/github/neuromatch/climate-course-content/blob/main/tutorials/W1D5_IntroductiontoClimateModeling/student/W1D5_Tutorial1.ipynb)
"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {},
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# Tutorial 1: Radiation and the Greenhouse Effect\n",
"\n",
"**Week 1, Day 5, Introduction to Climate Modeling**\n",
"\n",
"**Content creators:** Jenna Pearson and Brian E. J. Rose\n",
"\n",
"**Content reviewers:** Mujeeb Abdulfatai, Nkongho Ayuketang Arreyndip, Jeffrey N. A. Aryee, Dionessa Biton, Younkap Nina Duplex, Will Gregory, Paul Heubel, Zahra Khodakaramimaghsoud, Peter Ohue, Abel Shibu, Derick Temfack, Yunlong Xu, Peizhen Yang, Chi Zhang, Ohad Zivan\n",
"\n",
"**Content editors:** Brodie Pearson, Abigail Bodner, Paul Heubel, Ohad Zivan, Chi Zhang\n",
"\n",
"**Production editors:** Wesley Banfield, Paul Heubel, Jenna Pearson, Konstantine Tsafatinos, Chi Zhang, Ohad Zivan\n",
"\n",
"**Our 2024 Sponsors:** CMIP, NFDI4Earth\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Tutorial Objectives\n",
"\n",
"*Estimated timing of tutorial:* 30 minutes\n",
"\n",
"In this tutorial, students will learn about blackbody radiation and greenhouse models for energy emitted from Earth.\n",
"\n",
"By the end of this tutorial students will be able to:\n",
"\n",
"- Understand what an emission temperature is, and how to find it given observed outgoing longwave radiation.\n",
"- Modify the blackbody radiation model to include the greenhouse effect.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Setup\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {}
},
"outputs": [],
"source": [
"# imports\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Install and import feedback gadget\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Install and import feedback gadget\n",
"\n",
"!pip3 install vibecheck datatops --quiet\n",
"\n",
"from vibecheck import DatatopsContentReviewContainer\n",
"def content_review(notebook_section: str):\n",
" return DatatopsContentReviewContainer(\n",
" \"\", # No text prompt\n",
" notebook_section,\n",
" {\n",
" \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n",
" \"name\": \"comptools_4clim\",\n",
" \"user_key\": \"l5jpxuee\",\n",
" },\n",
" ).render()\n",
"\n",
"\n",
"feedback_prefix = \"W1D5_T1\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Figure settings\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Figure settings\n",
"import ipywidgets as widgets # interactive display\n",
"\n",
"%config InlineBackend.figure_format = 'retina'\n",
"plt.style.use(\n",
" \"https://raw.githubusercontent.com/neuromatch/climate-course-content/main/cma.mplstyle\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Video 1: Speaker Introduction\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# @title Video 1: Speaker Introduction\n",
"\n",
"from ipywidgets import widgets\n",
"from IPython.display import YouTubeVideo\n",
"from IPython.display import IFrame\n",
"from IPython.display import display\n",
"\n",
"\n",
"class PlayVideo(IFrame):\n",
" def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n",
" self.id = id\n",
" if source == 'Bilibili':\n",
" src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'\n",
" elif source == 'Osf':\n",
" src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'\n",
" super(PlayVideo, self).__init__(src, width, height, **kwargs)\n",
"\n",
"\n",
"def display_videos(video_ids, W=400, H=300, fs=1):\n",
" tab_contents = []\n",
" for i, video_id in enumerate(video_ids):\n",
" out = widgets.Output()\n",
" with out:\n",
" if video_ids[i][0] == 'Youtube':\n",
" video = YouTubeVideo(id=video_ids[i][1], width=W,\n",
" height=H, fs=fs, rel=0)\n",
" print(f'Video available at https://youtube.com/watch?v={video.id}')\n",
" else:\n",
" video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,\n",
" height=H, fs=fs, autoplay=False)\n",
" if video_ids[i][0] == 'Bilibili':\n",
" print(f'Video available at https://www.bilibili.com/video/{video.id}')\n",
" elif video_ids[i][0] == 'Osf':\n",
" print(f'Video available at https://osf.io/{video.id}')\n",
" display(video)\n",
" tab_contents.append(out)\n",
" return tab_contents\n",
"\n",
"\n",
"video_ids = [('Youtube', 'O5UXu_ojXG8'), ('Bilibili', 'BV1xm4y1q7je')]\n",
"tab_contents = display_videos(video_ids, W=730, H=410)\n",
"tabs = widgets.Tab()\n",
"tabs.children = tab_contents\n",
"for i in range(len(tab_contents)):\n",
" tabs.set_title(i, video_ids[i][0])\n",
"display(tabs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Video 2: A Simple Greenhouse Model\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# @title Video 2: A Simple Greenhouse Model\n",
"\n",
"from ipywidgets import widgets\n",
"from IPython.display import YouTubeVideo\n",
"from IPython.display import IFrame\n",
"from IPython.display import display\n",
"\n",
"\n",
"class PlayVideo(IFrame):\n",
" def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n",
" self.id = id\n",
" if source == 'Bilibili':\n",
" src = f'https://player.bilibili.com/player.html?bvid={id}&page={page}'\n",
" elif source == 'Osf':\n",
" src = f'https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render'\n",
" super(PlayVideo, self).__init__(src, width, height, **kwargs)\n",
"\n",
"\n",
"def display_videos(video_ids, W=400, H=300, fs=1):\n",
" tab_contents = []\n",
" for i, video_id in enumerate(video_ids):\n",
" out = widgets.Output()\n",
" with out:\n",
" if video_ids[i][0] == 'Youtube':\n",
" video = YouTubeVideo(id=video_ids[i][1], width=W,\n",
" height=H, fs=fs, rel=0)\n",
" print(f'Video available at https://youtube.com/watch?v={video.id}')\n",
" else:\n",
" video = PlayVideo(id=video_ids[i][1], source=video_ids[i][0], width=W,\n",
" height=H, fs=fs, autoplay=False)\n",
" if video_ids[i][0] == 'Bilibili':\n",
" print(f'Video available at https://www.bilibili.com/video/{video.id}')\n",
" elif video_ids[i][0] == 'Osf':\n",
" print(f'Video available at https://osf.io/{video.id}')\n",
" display(video)\n",
" tab_contents.append(out)\n",
" return tab_contents\n",
"\n",
"\n",
"video_ids = [('Youtube', 'YtgRT0Esatw'), ('Bilibili', 'BV1ah4y1f7bw')]\n",
"tab_contents = display_videos(video_ids, W=730, H=410)\n",
"tabs = widgets.Tab()\n",
"tabs.children = tab_contents\n",
"for i in range(len(tab_contents)):\n",
" tabs.set_title(i, video_ids[i][0])\n",
"display(tabs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_A_Simple_Greenhouse_Model_Video\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"# @markdown\n",
"from ipywidgets import widgets\n",
"from IPython.display import IFrame\n",
"\n",
"link_id = \"3c8nq\"\n",
"\n",
"print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n",
"IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=854, height=480)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_A_Simple_Greenhouse_Model_Slides\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Section 1: A Radiating Earth"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Section 1.1: Planck's Law"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"All objects with a temperature emit **[electromagnetic radiation](https://www.noaa.gov/jetstream/satellites/electromagnetic-waves)**. This energy travels through space in the form of waves. In the lecture we discussed that blackbody radiation is a model of how Earth loses radiative energy to space. Although this is not a perfect model for Earth, we will use it as a basis to understand Earth's energy balance throughout tutorials 1-4. If we suppose Earth behaves as a perfect blackbody, then it emits energy at all wavelengths according to **[Planck's Law](https://glossary.ametsoc.org/wiki/Planck%27s_radiation_law)**:\n",
"\n",
"\\begin{align}\n",
"B(\\lambda,T) = \\frac{2 h c^2}{\\lambda^5}\\frac{1}{e^{hc/(\\kappa T)}-1}\n",
"\\end{align}\n",
"\n",
"where $h = 6.626075 \\times 10^{-34} \\text{ J s}$ is Planck's constant, $c= 2.99792 \\times 10^8 \\text{ m s}^{-1}$ is the speed of light, and $\\kappa = 1.3804 \\times 10^{23} \\text{ W K}^{-1}$ is Boltzmann's constant.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Interactive Demo 1.1"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"This interactive demo will allow you to visualize how the blackbody curve changes as Earth warms and cools relative to its current surface temperature of about 288 K. Use the slide bar to adjust the emission temperature. Give the code a few seconds to replot before choosing a new temperature.\n",
"\n",
"No need to worry about understanding the code here - this is conceptual. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Make sure you execute this cell to enable the widget! Please run this cell **twice** to be able to use the slides bar\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @markdown Make sure you execute this cell to enable the widget! Please run this cell **twice** to be able to use the slides bar\n",
"import holoviews as hv\n",
"import panel as pn\n",
"hv.extension(\"bokeh\")\n",
"\n",
"# define constants used in Planck's Law\n",
"h = 6.626075e-34 # J s\n",
"c = 2.99792e8 # m s^-1\n",
"k = 1.3804e-23 # W K^-1\n",
"\n",
"\n",
"# define the function for Planck's Law depedent on wavelength (lambda) and temeprature (T)\n",
"def planck(wavelength, temperature):\n",
" a = 2.0 * h * c**2\n",
" b = h * c / (wavelength * k * temperature)\n",
" intensity = a / ((wavelength**5) * (np.exp(b) - 1.0))\n",
"\n",
" lpeak = (2.898 * 1e-3) / temperature\n",
"\n",
" return intensity\n",
"\n",
"\n",
"def update_plot(emiss_temp):\n",
" # generate x-axis in increments from 1um to 100 micrometer in 1 nm increments\n",
" # starting at 1 nm to avoid wav = 0, which would result in division by zero.\n",
" wavelengths = np.arange(1e-6, 50e-6, 1e-9)\n",
"\n",
" # get the blackbody curve and peak emission wavelength for 288 K\n",
" intensity288 = planck(wavelengths, 288)\n",
"\n",
" # get the blackbody curve and peak emission wavelength for selected temperature\n",
" intensity = planck(wavelengths, emiss_temp)\n",
"\n",
" # # get the intensity at peak wavelength to limit the lines\n",
" # Ipeak,_ = planck(lpeak,emission_temperature)\n",
" # Ipeak288,_ = planck(lpeak288,288)\n",
"\n",
" # curves output\n",
" vary = zip(wavelengths * 1e6, intensity)\n",
" init_val = zip(wavelengths * 1e6, intensity288)\n",
"\n",
" # Specified individually\n",
" list_of_curves = [\n",
" hv.Curve(init_val, label=\"T=288K\").opts(ylim=(0, 1.0e7)),\n",
" hv.Curve(vary, label=\"T=\" + str(emiss_temp) + \"K\").opts(ylim=(0, 1.0e7)),\n",
" ]\n",
"\n",
" bb_plot = hv.Overlay(list_of_curves).opts(\n",
" height=300,\n",
" width=600,\n",
" xlabel=\"Wavelength (μm)\",\n",
" ylabel=\"B(λ,T) (W/(m³ steradian)\",\n",
" title=\"Spectral Radiance\",\n",
" )\n",
"\n",
" return bb_plot\n",
"\n",
"\n",
"emiss_temp_widget = pn.widgets.IntSlider(\n",
" name=\"Emission Temperature\", value=288, start=250, end=300\n",
")\n",
"bound_plot = pn.bind(update_plot, emiss_temp=emiss_temp_widget)\n",
"\n",
"pn.Row(emiss_temp_widget, bound_plot)"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Questions 1.1: Climate Connection"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"1. Recall from Tutorial 1 on Week 1 Day 3 the **electromagnetic spectrum** (shown below), which displays the different wavelengths of electromagnetic energy. According to our model and noting that 1 micrometer = $10^{-6}$ meters, with a surface temperature of 288 K what type of radiation does Earth primarily emit at? \n",
"\n",
"\n",
"Diagram of the Electromagnetic Spectrum. (Credit: [Wikipedia](https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/EM_spectrumrevised.png/1920px-EM_spectrumrevised.png))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_d8ea9414.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Questions_1_1\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Section 1.2: The Stefan-Boltzmann Law"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"If we integrate Planck's Law over all wavelengths and outward angles of emission, the total **outgoing longwave radiation (OLR)** for a given **emission temperature** ($\\mathbf{T}$) follows the **[Stefan-Boltzmann Law](https://glossary.ametsoc.org/wiki/Stefan-boltzmann_law)**.\n",
"\n",
"\\begin{align}\n",
"OLR = \\sigma T^4\n",
"\\end{align}\n",
"\n",
"Where the **[Stefan-Boltzmann constant](https://glossary.ametsoc.org/wiki/Stefan-boltzmann_constant)** is $\\sigma = 5.67 \\times 10^{-8}\\text{ W m}^{-2} \\text{ K}^{-4}$.\n",
"\n",
"Rearranging the equation above, we can solve for the emission temperature of Earth, $T$.\n",
"\n",
"\\begin{align}\n",
"T = \\sqrt[4]{\\frac{OLR}{\\sigma}}\n",
"\\end{align}\n",
"\n",
"Using $OLR = 239\\text{ W m}^{-2}$ we can calculate the value of $T$:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {},
"executionInfo": {
"elapsed": 33,
"status": "ok",
"timestamp": 1681268100158,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"outputs": [],
"source": [
"# define the Stefan-Boltzmann Constant, noting we are using 'e' for scientific notation\n",
"sigma = 5.67e-8 # W m^-2 K^-4\n",
"\n",
"# define the outgoing longwave radiation based on observations from the IPCC AR6 Figure 7.2\n",
"OLR = 239 # W m^-2\n",
"\n",
"# plug into equation\n",
"T = (OLR / sigma) ** (1 / 4)\n",
"\n",
"# display answer\n",
"print(\"Emission Temperature: \", T, \"K or\", T - 273, \"°C\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Questions 1.2: Climate Connection"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"1. How does this compare to the actual global mean surface temperature of $~288 \\text{ K} / 15\\text{°C}$?\n",
"2. Using $T = 288 \\text{ K}$ would you expect the corresponding outgoing longwave radiation to be higher or lower than the observed $239 \\text{ W m}^{-2}$?\n",
"3. What could be accounted for in this model to make it more realistic?"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_c67198fd.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Questions_1_2\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Coding Exercises 1.2"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"1. By modifying the code above and solving for OLR, find the outgoing longwave radiation expected for the observed surface temperature of $288 \\text{ K}$. This should help you answer Question 2 above."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {},
"executionInfo": {
"elapsed": 31,
"status": "ok",
"timestamp": 1681268100161,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"outputs": [],
"source": [
"# define the Stefan-Boltzmann Constant, noting we are using 'e' for scientific notation\n",
"sigma = ...\n",
"\n",
"# define the global mean surface temperature based on observations\n",
"T = ...\n",
"\n",
"# plug into equation\n",
"OLR = ...\n",
"\n",
"# display answer\n",
"print(\"OLR: \", OLR, \"W m^2\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {},
"executionInfo": {
"elapsed": 27,
"status": "ok",
"timestamp": 1681268100162,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_a2d0f592.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Coding_Exercises_1_2\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Section 2: The Greenhouse Effect"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Section 2.1: About greenhouse gases"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"The expected surface temperature using the blackbody radiation model is much colder than we observe it to be. In this model, we assumed there is nothing that lies between Earth's surface and space that interacts with Earth's emitted radiation. From the initial lecture on the global energy budget we know this is not true. Earth has an atmosphere, and within it are many gases that interact with radiation in the infrared range at which Earth primarily emits. The effect of these gases on radiation, called the **[greenhouse effect](https://glossary.ametsoc.org/wiki/Greenhouse_effect#:~:text=As%20used%20in%20the%20field,absorb%20and%20emit%20infrared%20radiation.)**, is what warms earth to a habitable temperature. \n",
"\n",
"The gases that are responsible for this ([carbon dioxide](https://glossary.ametsoc.org/wiki/Carbon_dioxide), [water vapor](https://glossary.ametsoc.org/wiki/Water_vapor), [methane](https://glossary.ametsoc.org/wiki/Methane), [ozone](https://glossary.ametsoc.org/wiki/Ozone), [nitrous oxide](https://glossary.ametsoc.org/wiki/Nitrous_oxide), and [chloroflourocarbons](https://glossary.ametsoc.org/wiki/Chlorofluorocarbons)) are termed **[greenhouse gases](https://glossary.ametsoc.org/wiki/Greenhouse_gases)**, and are all **[trace gases](https://glossarytest.ametsoc.net/wiki/Trace_gas)** present in very low concentrations in Earth's atmosphere. **[Anthropogenic](https://glossarytest.ametsoc.net/wiki/Anthropogenic)** climate change is caused to a large extent by increased concentrations of many of these trace gases due to emissions from human activities.\n",
" \n",
"The figure below shows the contributions to the global surface air temperature change relative to 1750. We can see that all of the greenhouse gases have contributed positively, that is towards warming Earth. Also, note that the total curve tracks the volcano curve quite well until around the 1850s when industrialization took hold. The total and volcanic curves begin to deviate here, and after the mid-1900s the total curve begins tracking the total anthropogenic curve instead."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
" \n",
"Figure 7.8 | Attributed global surface air temperature change (GSAT) from 1750 to 2019 produced using the two-layer emulator (Supplementary Material 7.SM.2), forced with ERF derived in this chapter (displayed in Figure 2.10) and climate response constrained to assessed ranges for key climate metrics described in Cross-Chapter Box 7.1. The results shown are the medians from a 2237-member ensemble that encompasses uncertainty in forcing and climate response (year-2019 best estimates and uncertainties are shown in Figure 7.7 for several components). Temperature contributions are expressed for carbon dioxide (CO2), methane (CH4), nitrous oxide (N2O), other well-mixed greenhouse gases (WMGHGs), ozone (O3), aerosols, and other anthropogenic forcings, as well as total anthropogenic, solar, volcanic, and total forcing. Shaded uncertainty bands show very likely (5–95%) ranges. Further details on data sources and processing are available in the chapter data table (Table 7.SM.14). (Credit [IPCC](https://www.ipcc.ch/report/ar6/wg1/downloads/figures/IPCC_AR6_WGI_Figure_7_8.png))"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"## Section 2.2: A simple greenhouse model"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"*This section draws content from [The Climate Laboratory](https://brian-rose.github.io/ClimateLaboratoryBook/) by Brian E. J. Rose.*\n",
"\n",
"As shown above, greenhouse gases are incredibly important for regulating Earth's energy balance and temperature. A first approach is to model the greenhouse effect on outgoing longwave radiation (OLR) to space by adding a transmissivity coefficient. The **transmissivity coeficient (**$\\mathbf{\\tau}$**)** is the fraction of \n",
"the radiation emitted from Earth that actually makes it to space. This coefficient $\\mathbf{\\tau}$ is a number that lies between 0 and 1, and represents the *effects* of all the greenhouse gases on radiation, rather than including them explicity in the model. This approach is called a **[parametrization](https://glossary.ametsoc.org/wiki/Parameterization)**.\n",
"\n",
"Applying this to the original model for blackbody radiation, the modified model is\n",
"\n",
"\\begin{align}\n",
"OLR = \\tau \\sigma T^4\n",
"\\end{align}\n",
"\n",
"Using $OLR = 239 \\text{ W m}^{-2}$ and $T = 288 \\text{ K}$, we can estimate $\\tau$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {},
"executionInfo": {
"elapsed": 22,
"status": "ok",
"timestamp": 1681268100163,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"outputs": [],
"source": [
"# define the Stefan-Boltzmann Constant, noting we are using 'e' for scientific notation\n",
"sigma = 5.67e-8 # W m^-2 K^-4\n",
"\n",
"# define the outgoing longwave radiation based on observations from the IPCC AR6 Figure 7.2\n",
"OLR = 239 # W m^-2\n",
"\n",
"# define the emission temperature based on observtions of global mean surface temperature\n",
"T = 288 # K\n",
"\n",
"# plug into equation\n",
"tau = OLR / (sigma * T**4) # unitless number between 0 and 1\n",
"\n",
"# display answer\n",
"print(\"Transmissivity Coefficient: \", tau)"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Questions 2.2: Climate Connection"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"1. For a generic planet, what could be said about the planet's atmosphere when $\\tau$ is close to 1? Close to 0? Use the OLR seen at the top of the atmosphere in your answer.\n",
"2. In terms of energy received from the sun, what does only modifying the _OLR_ to account for the greenhouse effect imply? Are there any greenhouse gases you think would make this implication problematic?\n",
"3. Is there any other part of the atmosphere aside from greenhouse gases that we have not discussed that would also affect $\\tau$?\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_517af88a.py)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Questions_2_2\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Coding Exercises 2.2"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"1. Using list comprehension, calculate the OLR for three values of $\\tau = 0.2,0.6114,0.8$. Then plot this on a bar chat to compare. This should help you answer question 1 above. Hint: what is [list comprehension](https://foundations.projectpythia.org/foundations/quickstart.html#lists)?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {},
"executionInfo": {
"elapsed": 401,
"status": "ok",
"timestamp": 1681268104208,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"outputs": [],
"source": [
"# define the Stefan-Boltzmann Constant, noting we are using 'e' for scientific notation\n",
"sigma = ...\n",
"\n",
"# define the emission temperature based on observtions of global mean surface temperature\n",
"T = ...\n",
"\n",
"# define values of tau\n",
"tau = ...\n",
"\n",
"# get values of OLR from tau using list comprehension\n",
"OLR = ...\n",
"\n",
"# convert tau to list of strings using list comprehension so we can create a categorical plot\n",
"tau = ...\n",
"\n",
"fig, ax = plt.subplots()\n",
"_ = ...\n",
"ax.set_xlabel(\"Transmissivity\")\n",
"ax.set_ylabel(\"Outgoing Longwave Radiation (W m$^{-2}$)\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {},
"executionInfo": {
"elapsed": 5,
"status": "ok",
"timestamp": 1681268133545,
"user": {
"displayName": "Jenna Pearson",
"userId": "05648130581702734913"
},
"user_tz": 420
}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_a6ad63d3.py)\n",
"\n",
"*Example output:*\n",
"\n",
"
\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Coding_Exercises_2_2\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Bonus Section 3: An Additional Exercise on Blackbody Radiation\n",
"\n",
"Want to explore the concept of Blackbody radiation a bit more? Try this additional exercise! Be aware that this will take at least another 15 minutes."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"### Coding Exercises 3\n",
"\n",
"**Instructions**\n",
"\n",
"By defining a function for Planck's Law, plot the blackbody radiation curve for the sun, assuming an emission temperature of $5800 \\text{ K}$. Underlay an approximation of the visible range from the electromagnetic spectrum. This exercise should help you understand why we see in color as well as why the sun's radiation headed towards Earth is called incoming shortwave radiation."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {}
},
"outputs": [],
"source": [
"# define the emission temperature of the sun\n",
"T_sun = ...\n",
"\n",
"\n",
"# define constants used in Planck's Law\n",
"h = 6.626075e-34 # J s\n",
"c = 2.99792e8 # m s^-1\n",
"k = 1.3804e-23 # W K^-1\n",
"\n",
"\n",
"# define the function for Planck's Law that returns the intensity as well\n",
"# as the peak wavelength defined by Wien's Law\n",
"def planck(wavelength, temperature):\n",
" ...\n",
" intensity = ...\n",
" lpeak = ...\n",
" return intensity, lpeak\n",
"\n",
"\n",
"# generate x-axis in increments from 1um to 100 micrometer in 1 nm increments\n",
"# starting at 1 nm to avoid wav = 0, which would result in division by zero.\n",
"wavelengths = np.arange(1e-7, 4e-6, 1e-9)\n",
"\n",
"# intensity and peak radiating wavelength at different temperatures\n",
"intensity, lpeak = planck(wavelengths, T_sun)\n",
"\n",
"# get the intensity at peak wavelength to limit the lines\n",
"Ipeak, _ = planck(lpeak, T_sun)\n",
"\n",
"# plot an approximation of the visible range by defining a dictionary with\n",
"# wavelength ranges and colors\n",
"rainbow_dict = {\n",
" (0.4, 0.44): \"#8b00ff\",\n",
" (0.44, 0.46): \"#4b0082\",\n",
" (0.46, 0.5): \"#0000ff\",\n",
" (0.5, 0.57): \"#00ff00\",\n",
" (0.57, 0.59): \"#ffff00\",\n",
" (0.59, 0.62): \"#ff7f00\",\n",
" (0.62, 0.75): \"#ff0000\",\n",
"}\n",
"\n",
"fig, ax = plt.subplots()\n",
"\n",
"for wv_range, rgb in rainbow_dict.items():\n",
" ax.axvspan(*wv_range, color=rgb, ec=\"none\")\n",
"\n",
"# add in wiens law\n",
"_ = ...\n",
"\n",
"# plot intensity curve\n",
"_ = ...\n",
"\n",
"ax.set_xlabel(\"Wavelength ($\\mu$m)\", labelpad=30)\n",
"ax.set_ylabel(\"$B_\\lambda(\\lambda,T)$ (W/(m$^3$ steradian)\")\n",
"\n",
"ax.set_title(\"Spectral Radiance\")\n",
"\n",
"# add legend\n",
"ax.legend(bbox_to_anchor=(0.5, 0.5))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"execution": {}
},
"source": [
"[*Click for solution*](https://github.com/neuromatch/climate-course-content/tree/main/tutorials/W1D5_IntroductiontoClimateModeling/solutions/W1D5_Tutorial1_Solution_46434603.py)\n",
"\n",
"*Example output:*\n",
"\n",
"
\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Submit your feedback\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"execution": {},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"# @title Submit your feedback\n",
"content_review(f\"{feedback_prefix}_Coding_Exercises_3\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Summary\n",
"In this tutorial, we've learned about the principles of blackbody and greenhouse radiation models, which are crucial to understanding Earth's energy emission. We explored the concept of emission temperature and how it's calculated using observed outgoing longwave radiation. We discovered that the simple blackbody model needs to be augmented by considering the greenhouse effect to accurately represent Earth's observed surface temperature. This led us to incorporate the transmissivity coefficient, a representation of greenhouse gases' impact, into our model."
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"# Resources"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {}
},
"source": [
"Useful links:\n",
"- [Planck's Law](https://glossary.ametsoc.org/wiki/Planck%27s_radiation_law)\n",
"- [Stefan-Boltzmann Law](https://glossary.ametsoc.org/wiki/Stefan-boltzmann_law)\n",
"- The [Greenhouse Effect](https://glossary.ametsoc.org/wiki/Greenhouse_effect#:~:text=As%20used%20in%20the%20field,absorb%20and%20emit%20infrared%20radiation.),\n",
"- The [Climate Laboratory](https://brian-rose.github.io/ClimateLaboratoryBook/) by Brian E. J. Rose"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"include_colab_link": true,
"name": "W1D5_Tutorial1",
"provenance": [],
"toc_visible": true
},
"kernel": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
}
},
"nbformat": 4,
"nbformat_minor": 4
}