Open In Colab   Open in Kaggle

Tutorial 1 : A Simple Greenhouse Model#

Week 1, Day 5, Climate Modeling

Content creators: Jenna Pearson

Content reviewers: Dionessa Biton, Younkap Nina Duplex, Zahra Khodakaramimaghsoud, Will Gregory, Peter Ohue, Derick Temfack, Yunlong Xu, Peizhen Yang, Chi Zhang, Ohad Zivan

Content editors: Brodie Pearson, Abigail Bodner, Ohad Zivan, Chi Zhang

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

Our 2023 Sponsors: NASA TOPS and Google DeepMind

Tutorial Objectives#

In this tutorial students will learn about blackbody radiation and greenhouse models for energy emitted from Earth.

By the end of this tutorial students will be able to:

  • Understand what an emission temperature is, and how to find it given observed outgoing longwave radiation.

  • Modify the blackbody radiation model to include the greenhouse effect.


# imports
import matplotlib.pyplot as plt
import numpy as np

Figure settings#

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

%config InlineBackend.figure_format = 'retina'

Video 1: Speaker Introduction#

Video 2: A Simple Greenhouse Model#

Section 1 : A Radiating Earth#

Section 1.1 Planck’s Law#

All objects with a temperature emit electromagnetic radiation. 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:

(4)#\[\begin{align} B(\lambda,T) = \frac{2 h c^2}{\lambda^5}\frac{1}{e^{hc/(\kappa T)}-1} \end{align}\]

where \(h = 6.626075 \times 10^{-34} J s\) is Planck’s constant, \(c= 2.99792 \times 108 m s^{-1}\) is the speed of light, and \(\kappa = 1.3804 \times 10^{23} W K^{-1}\) is Boltzmann’s constant.

Interactive Demo 1.1#

This interactive demo will allow you to visualize how to blackbody curve changes as Earth warms and cools relative to it’s current surface temperature of about 288K. Use the slide bar to adjust the emission temperature. Give the code few seconds to replot before choosing a new temperature.

No need to worry about understanding the code here - this is conceptual.

Make sure you execute this cell to enable the widget! Please run this cell twice to be able to use the slides bar

Hide code cell 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
import holoviews as hv
import panel as pn

# define constants used in Planck's Law
h = 6.626075e-34  # J s
c = 2.99792e8  # m s^-1
k = 1.3804e-23  # W K^-1

# define the function for Planck's Law depedent on wavelength (lambda) and temeprature (T)
def planck(wavelength, temperature):
    a = 2.0 * h * c**2
    b = h * c / (wavelength * k * temperature)
    intensity = a / ((wavelength**5) * (np.exp(b) - 1.0))

    lpeak = (2.898 * 1e-3) / temperature

    return intensity

def update_plot(emiss_temp):
    # generate x-axis in increments from 1um to 100 micrometer in 1 nm increments
    # starting at 1 nm to avoid wav = 0, which would result in division by zero.
    wavelengths = np.arange(1e-6, 50e-6, 1e-9)

    # get the blackbody curve and peak emission wavelength for 288 K
    intensity288 = planck(wavelengths, 288)

    # get the blackbody curve and peak emission wavelength for selected temperature
    intensity = planck(wavelengths, emiss_temp)

    #     # get the intensity at peak wavelength to limit the lines
    #     Ipeak,_ = planck(lpeak,emission_temperature)
    #     Ipeak288,_ = planck(lpeak288,288)

    # curves output
    vary = zip(wavelengths * 1e6, intensity)
    init_val = zip(wavelengths * 1e6, intensity288)

    # Specified individually
    list_of_curves = [
        hv.Curve(init_val, label="T=288K").opts(ylim=(0, 1.0e7)),
        hv.Curve(vary, label="T=" + str(emiss_temp) + "K").opts(ylim=(0, 1.0e7)),

    bb_plot = hv.Overlay(list_of_curves).opts(
        xlabel="Wavelength (μm)",
        ylabel="B(λ,T) (W/(m³ steradian)",
        title="Spectral Radiance",

    return bb_plot

emiss_temp_widget = pn.widgets.IntSlider(
    name="Emission Temperature", value=288, start=250, end=300
bound_plot = pn.bind(update_plot, emiss_temp=emiss_temp_widget)

pn.Row(emiss_temp_widget, bound_plot)