Skip to content

Spin Up

plot_spin_up(olr, sw_net_down, t_surf, ax)

Function to plot how net TOA flux and mean global surface temperature evolve with time. Net flux should converge to zero, once spin up has finished.

olr, sw_net_down and t_surf are just variables saved in the dataset .nc file produced by Isca e.g. t_surf = ds.t_surf if ds is the dataset for the experiment.

Parameters:

Name Type Description Default
olr DataArray

Outgoing Longwave Radiation with time, longitude and latitude dimensions.

required
sw_net_down DataArray

Net downward shortwave radiation at top of atmosphere, accounting for any reflected due to the albedo or absorbed in the atmosphere due to shortwave optical depth.
This can be obtained with isca_tools.utils.radiation.frierson_net_toa_sw_dwn for the grey gas Isca simulation. Dimensions are time, longitude, latitude.

required
t_surf DataArray

Surface temperature with time, longitude and latitude dimensions.

required
ax Axes

Axes to plot results on.

required
Source code in isca_tools/plot/spin_up.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def plot_spin_up(olr: xr.DataArray, sw_net_down: xr.DataArray, t_surf: xr.DataArray, ax: plt.Axes):
    """
    Function to plot how net TOA flux and mean global surface temperature evolve with time.
    Net flux should converge to zero, once spin up has finished.

    `olr`, `sw_net_down` and `t_surf` are just variables saved in the dataset *.nc* file produced by *Isca*
    e.g. `t_surf = ds.t_surf` if `ds` is the dataset for the experiment.

    Args:
        olr: Outgoing Longwave Radiation with time, longitude and latitude dimensions.
        sw_net_down: Net downward shortwave radiation at top of atmosphere, accounting for any reflected due to
            the `albedo` or absorbed in the atmosphere due to shortwave optical depth.</br>
            This can be obtained with `isca_tools.utils.radiation.frierson_net_toa_sw_dwn` for the grey gas Isca
            simulation.
            Dimensions are time, longitude, latitude.
        t_surf: Surface temperature with time, longitude and latitude dimensions.
        ax: Axes to plot results on.
    """
    # When area weighted summed over whole globe, TOA OLR-SW should converge to zero
    olr_sum = area_weighting(olr).sum(dim=['lon', 'lat'])
    short_wave_sum = area_weighting(sw_net_down).sum(dim=['lon', 'lat'])
    net_flux = olr_sum - short_wave_sum
    net_flux.plot.line(ax=ax, color='b')
    ax.set_ylabel('TOA Net Outgoing FLux / $Wm^{-2}$\n$OLR - SW_{net}$', color='b')
    # Add second axes to show how the global average surface temperature evolves
    ax2 = ax.twinx()
    t_surf_mean = area_weighting(t_surf).mean(dim=['lon', 'lat']) - 273.15  # In Celsius
    t_surf_mean.plot.line(ax=ax2, color='r')
    ax2.set_ylabel('Surface Temperature / $°C$', color='r')
    try:
        ax.set_xlabel(t_surf.time.units)
    except AttributeError:
        pass