Multiple emission inventories
In this example, no time evolution file is given, but multiple emission inventories are given as input. OpenAirClim will interpolate between discrete inventory years.
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 zenodo_get
import openairclim as oac
xr.set_options(display_expand_attrs=False)
<xarray.core.options.set_options at 0x7f7ae980c6e0>
Input files
In order to be able to execute this example simulation, two types of input are required.
Configuration file multi_inv.toml
Emission inventories emi_inv_20XX.nc
Emission inventories
Source: DLR research study DEPA 2050
Inventory years: 2030, 2040, 2050
Available for download in suitable OpenAirClim format
%%capture
# Download inventories from zenodo
zenodo_get.zenodo_get(["https://doi.org/10.5281/zenodo.11442322", "-g", "emi_inv_20[3-5]0.nc", "-o", "source/demos/input/"])
Simulation run
oac.run("source/demos/03_multi_inv/multi_inv.toml")
Results
Time series
Emission sums
Concentrations
Radiative forcings
Temperature changes
results_ds = xr.load_dataset("source/demos/03_multi_inv/results/multi_inv.nc")
display(results_ds)
<xarray.Dataset> Size: 4kB
Dimensions: (ac: 2, time: 21)
Coordinates:
* ac (ac) <U7 56B 'DEFAULT' 'TOTAL'
* time (time) int64 168B 2030 2031 2032 2033 ... 2047 2048 2049 2050
Data variables:
emis_CO2 (ac, time) float64 336B 1.075e+03 1.101e+03 ... 1.712e+03
emis_distance (ac, time) float64 336B 6.371e+10 6.478e+10 ... 8.757e+10
emis_H2O (ac, time) float64 336B 431.4 441.9 452.5 ... 671.8 686.8
conc_CO2 (ac, time) float64 336B 0.1379 0.2718 0.4038 ... 2.823 2.984
RF_CO2 (ac, time) float64 336B 0.00208 0.004084 ... 0.03992 0.04207
RF_cont (ac, time) float64 336B 0.04683 0.04708 ... 0.05769 0.05863
RF_H2O (ac, time) float64 336B 0.002381 0.002407 ... 0.003386
dT_CO2 (ac, time) float64 336B 0.0001585 0.000452 ... 0.01868
dT_cont (ac, time) float64 336B 0.002105 0.003987 ... 0.01958 0.02008
dT_H2O (ac, time) float64 336B 0.0002068 0.0003929 ... 0.002155
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 0x7f7ae967a900>