Scaling
In this example, the time evolution of type scaling is demonstrated. In the scenario, the emissions increase linearly from the year 2019 to the year 2039. The emissions in 2039 are set to be twice as much as in 2019.
Imports
If the openairclim package cannot be imported, make sure that you have
installed the package with pip or added the oac source folder to PYTHONPATH.
import xarray as xr
import matplotlib.pyplot as plt
import openairclim as oac
xr.set_options(display_expand_attrs=False)
WARNING:root:O3 response surface is not validated!
<xarray.core.options.set_options at 0x7f1a1930ba10>
Input files
In order to be able to execute this example simulation, three types of input are required.
Configuration file
scaling.tomlEmission inventories
ELK_aviation_2019_res5deg_flat.ncELK_aviation_2039_res5deg_flat.nc
Time evolution file for scaling:
time_scaling_linear_2019-2039.nc
Emission inventories
Source: DLR Project EmissionsLandKarte (ELK)
Resolution down-sampled to 5 deg resolution
Converted into format suitable for OpenAirClim
Inventory years
2019 (original)
2039 (same inventory as original, only year changed)
Time evolution
Time evolution with scaling of emissions
Time period: 2000 - 2050
Linear ramp-up between years 2019 and 2039
evo = xr.load_dataset("../input/time_scaling_linear_2019-2039.nc")
display(evo)
fig, ax = plt.subplots()
evo.scaling.plot(ax=ax)
ax.grid(True)
<xarray.Dataset> Size: 408B
Dimensions: (time: 51)
Coordinates:
* time (time) int32 204B 2000 2001 2002 2003 2004 ... 2047 2048 2049 2050
Data variables:
scaling (time) float32 204B 1.0 1.0 1.0 1.0 1.0 1.0 ... 2.0 2.0 2.0 2.0 2.0
Attributes: (5)
Simulation run
oac.run("scaling.toml")
WARNING:root:Longitude values have been automatically updated to be between 0 and 360 degrees to match pre-calculated data.
WARNING:root:Longitude values have been automatically updated to be between 0 and 360 degrees to match pre-calculated data.
WARNING:root:Found 1208 'plev' values outside the allowed range [70, 1000]. Observed plev values min=148.165, max=1013.25. Values were automatically clamped into the allowed range. Use results with caution.
WARNING:root:OpenAirClim is currently in development phase.
The computed output is not for scientific purposes until release of our publication.
Amongst others, the climate impact of longer species lifetimes in the stratosphere is not considered.
Results
Time series
Emission sums
Concentrations
Radiative forcings
Temperature changes
results_ds = xr.load_dataset("results/scaling.nc")
display(results_ds)
<xarray.Dataset> Size: 4kB
Dimensions: (ac: 2, time: 21)
Coordinates:
* ac (ac) <U7 56B 'DEFAULT' 'TOTAL'
* time (time) int64 168B 2019 2020 2021 2022 ... 2036 2037 2038 2039
Data variables:
emis_CO2 (ac, time) float64 336B 849.1 891.6 ... 1.656e+03 1.698e+03
emis_distance (ac, time) float64 336B 5.891e+10 6.185e+10 ... 1.178e+11
emis_H2O (ac, time) float64 336B 332.5 349.1 365.8 ... 648.4 665.0
conc_CO2 (ac, time) float64 336B 0.109 0.2175 0.3272 ... 2.634 2.797
RF_CO2 (ac, time) float64 336B 0.001705 0.003391 ... 0.03858 0.04083
RF_cont (ac, time) float64 336B 0.04657 0.04857 ... 0.08455 0.08655
RF_H2O (ac, time) float64 336B 0.004648 0.00488 ... 0.009296
dT_CO2 (ac, time) float64 336B 0.0001299 0.0003738 ... 0.01773
dT_cont (ac, time) float64 336B 0.002093 0.004044 ... 0.02689 0.02785
dT_H2O (ac, time) float64 336B 0.0004036 0.0007826 ... 0.0057
Attributes: (4)# Plot Radiative Forcing and Temperature Changes
ac = "TOTAL"
rf_cont = results_ds.RF_cont.sel(ac=ac) * 1000
rf_co2 = results_ds.RF_CO2.sel(ac=ac) * 1000
rf_h2o = results_ds.RF_H2O.sel(ac=ac) * 1000
dt_cont = results_ds.dT_cont.sel(ac=ac) * 1000
dt_co2 = results_ds.dT_CO2.sel(ac=ac) * 1000
dt_h2o = results_ds.dT_H2O.sel(ac=ac) * 1000
fig, ax = plt.subplots(ncols=2, figsize=(10,5))
ax[0].grid(True)
ax[1].grid(True)
rf_cont.plot(ax=ax[0], color="deepskyblue", label="cont")
rf_co2.plot(ax=ax[0], color="k", label="CO2")
rf_h2o.plot(ax=ax[0], color="steelblue", label="H2O")
dt_cont.plot(ax=ax[1], color="deepskyblue", label="cont")
dt_co2.plot(ax=ax[1], color="k", label="CO2")
dt_h2o.plot(ax=ax[1], color="steelblue", label="H2O")
ax[0].set_ylabel("Radiative Forcing [mW/m²]")
ax[1].set_ylabel("Temperature Change [mK]")
ax[0].legend()
ax[1].legend()
<matplotlib.legend.Legend at 0x7f1a17ebae90>