Skip to content

Commit

Permalink
Minor changes while extracting data
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobDeutloff committed Nov 10, 2023
1 parent bf69f5c commit 68a688f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Code/Evaluate_Runs/Get table data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Collect data fro Table 2
"""

# %%
from Code.Read_data.Read_SSP_output import read_full_T, read_SSP_outout, read_TE_output
import pandas as pd

Expand All @@ -19,7 +19,7 @@

# Set up table DF
years = [2050, 2100, 2200, 2300, 2400, 2500]
ssps = ['ssp119', 'ssp126', 'ssp245', 'ssp370', 'ssp585']
ssps = ['ssp126', 'ssp245', 'ssp370', 'ssp585']
vals = ['T', 'carbon_dioxide', 'methane']
cols = pd.MultiIndex.from_product([ssps, vals, years])
quants = [0.05, 0.5, 0.95]
Expand All @@ -45,3 +45,5 @@
table_data.loc[quant, (ssp, 'methane', year)] = (cum_CH4[ssp].loc[year].quantile(quant) * 1e-3).round(1)



# %%
10 changes: 5 additions & 5 deletions Code/Plot/Plot Burning Ember.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def plot_burning_emeber(ssp, max_year=2500):
# %% Plot Burning Embers diagramm

for ssp in Probs_const['Years'].columns.levels[0]:
plot_burning_emeber(ssp, 2200)
plot_burning_emeber(ssp, 2500)
plt.tight_layout()
plt.savefig('Plots/Burning_ember_2500/' + ssp + '200.png', dpi=300)
plt.savefig('Plots/Burning_ember_2500/' + ssp + '.png', dpi=300)

# %% calculate total increase in probability of tippig for each SSP
elems = list(Probs_const['Years'].columns.levels[1])
Expand Down Expand Up @@ -157,12 +157,12 @@ def plot_burning_emeber(ssp, max_year=2500):
for elem in Probs_const['Years'].columns.levels[1]:
yrs_5 += [Probs_tip['Years'].loc[0.5, (ssp, elem)] - Probs_const['Years'].loc[0.5, (ssp, elem)]]
yrs_95 += [Probs_tip['Years'].loc[0.95, (ssp, elem)] - Probs_const['Years'].loc[0.95, (ssp, elem)]]
if yrs_95[-1] < -10:
print(ssp + ' ' + elem + ' ' + str(yrs_95[-1]))
if yrs_5[-1] < -10:
print(ssp + ' ' + elem + ' ' + str(yrs_5[-1]))

Y_diff_5[ssp] = yrs_5
Y_diff_95[ssp] = yrs_95

# %%
print('Mean Diff [years] at 50%: ' + str(np.nanmean(list(Y_diff_5.values()))))
print('Mean Diff [years] at 95%: ' + str(np.nanmean(list(Y_diff_95.values()))))

Expand Down

0 comments on commit 68a688f

Please sign in to comment.