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)
<xarray.core.options.set_options at 0x7f1f80a8cec0>
Input files
In order to be able to execute this example simulation, three types of input are required.
Configuration file scaling.toml
Emission inventories
ELK_aviation_2019_res5deg_flat.nc
ELK_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("source/demos/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("source/demos/02_scaling/scaling.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. 532 in check_metrics_time WARNING: Last year in metrics time with t_0 = 2019 and H = 20 is earlier than last year in time range.
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/02_scaling/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. 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.
read_netcdf ln. 220 in split_inventory_by_aircraft WARNING: No ac coordinate found in emission inventory for year 2039. 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.23559212684631348 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/02_scaling/results/scaling.nc")
display(results_ds)
<xarray.Dataset> Size: 4kB
Dimensions:        (ac: 2, time: 21)
Coordinates:
  * time           (time) int64 168B 2019 2020 2021 2022 ... 2036 2037 2038 2039
  * ac             (ac) <U7 56B 'DEFAULT' 'TOTAL'
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.001401 0.002776 ... 0.02962 0.03123
    RF_cont        (ac, time) float64 336B 0.0664 0.06811 ... 0.09881 0.1005
    RF_H2O         (ac, time) float64 336B 0.004648 0.00488 ... 0.009296
    dT_CO2         (ac, time) float64 336B 0.0001067 0.0003063 ... 0.01376
    dT_cont        (ac, time) float64 336B 0.002984 0.005714 ... 0.03282 0.03376
    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 0x7f1f75897610>