Normalization
In this example, the time evolution of type normalization is demonstrated. A historic emission scenario is simulated with OpenAirClim.
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)
<xarray.core.options.set_options at 0x7f034eef8ec0>
Input files
In order to be able to execute this example simulation, three types of input are required.
Configuration file historic.toml
Emission inventory ELK_aviation_2019_res5deg_flat.nc
Time evolution file for fuel normalization time_norm_historic_SSP.nc
Emission inventory
Source: DLR Project EmissionsLandKarte (ELK)
Resolution down-sampled to 5 deg resolution
Converted into format suitable for OpenAirClim
Inventory year: 2019
inv = xr.load_dataset("source/demos/input/ELK_aviation_2019_res5deg_flat.nc")
display(inv)
<xarray.Dataset> Size: 2MB
Dimensions:   (index: 50854)
Dimensions without coordinates: index
Data variables:
    fuel      (index) float32 203kB 1.493e+04 7.459e+03 ... 7.471e+03 1.676e+03
    CO2       (index) float32 203kB 4.716e+04 2.356e+04 ... 2.36e+04 5.294e+03
    H2O       (index) float32 203kB 1.847e+04 9.227e+03 ... 9.242e+03 2.073e+03
    NOx       (index) float32 203kB 161.7 77.61 146.9 ... 965.8 134.5 23.91
    distance  (index) float32 203kB 2.266e+03 1.188e+03 ... 1.225e+03 272.1
    lat       (index) float64 407kB -67.5 -67.5 -67.5 -67.5 ... 87.5 87.5 87.5
    lon       (index) float64 407kB -167.5 -167.5 -167.5 ... 177.5 177.5 177.5
    plev      (index) float32 203kB 315.4 301.5 288.1 ... 197.5 179.4 171.0
Attributes: (9)Time evolution
Time evolution with normalization of fuel use
Time period: 1920 - 2019
evo = xr.load_dataset("source/demos/input/time_norm_historic_SSP.nc")
display(evo)
fig, ax = plt.subplots()
evo.fuel.plot(ax=ax)
ax.grid(True)
<xarray.Dataset> Size: 2kB
Dimensions:  (time: 100)
Coordinates:
  * time     (time) int64 800B 1920 1921 1922 1923 1924 ... 2016 2017 2018 2019
Data variables:
    fuel     (time) float64 800B 2.669 2.889 3.427 4.145 ... 264.7 274.1 283.5
Attributes: (5)
Simulation run
oac.run("source/demos/01_norm/historic.toml")
read_config ln. 254 in check_against_template INFO: Get default value for: responses CO2 rf method 
read_config ln. 254 in check_against_template INFO: Get default value for: responses cont method 
read_config ln. 183 in check_config INFO: Configuration file checked.
read_config ln. 376 in create_output_dir INFO: Create new output directory source/demos/01_norm/results/
read_netcdf ln. 98 in open_inventories WARNING: Longitude values have been automatically updated to be between 0 and 360 degrees to match pre-calculated data.
read_netcdf ln. 173 in open_inventories INFO: Emission inventories openend, attribute sections and time constraints checked successfully.
read_netcdf ln. 220 in split_inventory_by_aircraft WARNING: No ac coordinate found in emission inventory for year 2019. Reverting to 'DEFAULT' aircraft from config file.
main ln. 264 in run INFO: No subsequent species (PMO) defined in config.
main ln. 277 in run INFO: Execution time: 0.3641636371612549 sec
main ln. 280 in run WARNING: 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("source/demos/01_norm/results/historic.nc")
display(results_ds)
<xarray.Dataset> Size: 17kB
Dimensions:        (ac: 2, time: 100)
Coordinates:
  * time           (time) int64 800B 1920 1921 1922 1923 ... 2016 2017 2018 2019
  * ac             (ac) <U7 56B 'DEFAULT' 'TOTAL'
Data variables:
    emis_CO2       (ac, time) float64 2kB 8.432 9.125 10.83 ... 865.9 895.6
    emis_distance  (ac, time) float64 2kB 5.849e+08 6.33e+08 ... 6.213e+10
    emis_H2O       (ac, time) float64 2kB 3.302 3.573 4.239 ... 339.1 350.7
    conc_CO2       (ac, time) float64 2kB 0.001082 0.002194 ... 2.754 2.828
    RF_CO2         (ac, time) float64 2kB 1.885e-05 3.819e-05 ... 0.03625
    RF_cont        (ac, time) float64 2kB 0.0006469 0.0007001 ... 0.06871
    RF_H2O         (ac, time) float64 2kB 4.615e-05 4.995e-05 ... 0.004902
    dT_CO2         (ac, time) float64 2kB 1.435e-06 4.185e-06 ... 0.0214 0.02188
    dT_cont        (ac, time) float64 2kB 2.907e-05 5.731e-05 ... 0.02445
    dT_H2O         (ac, time) float64 2kB 4.007e-06 7.9e-06 ... 0.003293 0.00337
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 0x7f0343bcead0>
Climate metrics
Absolute Global Temperature Potential (AGTP)
Absolute Global Warming Potential (AGWP)
Average Temperature Response (ATR)
metrics_ds = xr.load_dataset("source/demos/01_norm/results/historic_metrics.nc")
display(metrics_ds)
<xarray.Dataset> Size: 128B
Dimensions:        (species: 4)
Coordinates:
  * species        (species) <U5 80B 'CO2' 'cont' 'H2O' 'total'
Data variables:
    AGTP_100_1920  (species) float32 16B 0.02188 0.02445 0.00337 0.0497
    AGWP_100_1920  (species) float32 16B 1.103 2.438 0.1739 3.715
    ATR_100_1920   (species) float32 16B 0.005989 0.008181 0.001128 0.0153
Attributes: (1)