FaIR: Specifying factors for GMST/GSAT conversion and amount of total Earth energy in the ocean#
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from scmdata import ScmRun
from openscm_runner.adapters import FAIR
from openscm_runner.run import run
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/scmdata/database/_database.py:9: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
import tqdm.autonotebook as tqdman
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/pymagicc/io/base.py:224: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
df = pd.read_csv(
fair = FAIR()
fair.get_version()
'1.6.4'
input_scenarios = ScmRun(
str(
Path("..")
/ ".."
/ ".."
/ ".."
/ "tests"
/ "test-data"
/ "rcmip_scen_ssp_world_emissions.csv"
),
lowercase_cols=True,
)
fair_results = run(
climate_models_cfgs={
"FAIR": [
{}, # passing an empty list of an empty dict will run with defaults
{"ohu_factor": 0.95, "gmst_factor": np.linspace(0.90, 1.00, 351)},
],
},
scenarios=input_scenarios,
output_variables=(
"Surface Air Ocean Blended Temperature Change",
"Heat Content|Ocean",
"Heat Uptake|Ocean",
),
)
/home/docs/checkouts/readthedocs.org/user_builds/openscm-runner/envs/latest/lib/python3.9/site-packages/scmdata/run.py:2632: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
pd.concat([ret._meta.to_frame(), *to_join_metas]).astype("category")
Note in the plots below that ‘model’ is the IAM that produced the scenario. In all cases, the climate model is FaIR.
fair_results.get_unique_meta("climate_model", no_duplicates=True)
'FaIRv1.6.4'
In the below we plot two runs per scenario. The first is with default OHU and GMST factors (0.92 and 1/1.04) and the second is with the specified factors (0.95 for OHU and a time-varying one for GMST).
ax = plt.figure(figsize=(12, 7)).add_subplot(111)
fair_results.filter(variable="Surface Air Ocean Blended Temperature Change").lineplot(
hue="scenario",
style="model",
ax=ax,
time_axis="year",
units="run_id",
estimator=None,
)
<Axes: xlabel='time', ylabel='K'>
ax = plt.figure(figsize=(12, 7)).add_subplot(111)
fair_results.filter(variable="Heat Uptake|Ocean").lineplot(
hue="scenario",
style="model",
ax=ax,
time_axis="year",
units="run_id",
estimator=None,
)
<Axes: xlabel='time', ylabel='W/m**2'>
ax = plt.figure(figsize=(12, 7)).add_subplot(111)
fair_results.filter(variable="Heat Content|Ocean").lineplot(
hue="scenario",
style="model",
ax=ax,
time_axis="year",
units="run_id",
estimator=None,
)
<Axes: xlabel='time', ylabel='J'>