Skip to content

Commit bf5fda0

Browse files
author
Ruixue Lui
committed
Add gdp timeseries plot to rff diagnostic
1 parent a67f88d commit bf5fda0

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

dscim/diagnostics/var_timeseries.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_rff_id(
4242
)
4343

4444
try:
45-
sccs = sccs.sel(discrate=discrate)
45+
sccs = sccs.sel(discrate=discrate, drop=True)
4646
except:
4747
pass
4848

@@ -104,7 +104,7 @@ def get_ssp_id(
104104
)
105105

106106
if disc == "constant":
107-
sccs = sccs.sel(discrate=discrate)
107+
sccs = sccs.sel(discrate=discrate, drop=True)
108108

109109
if kind == "p1":
110110
cutoff = sccs.quantile(0.01, ["simulation"])
@@ -236,6 +236,16 @@ def rff_timeseries(
236236
gmst_pulse_minus_control = gmst_pulse_minus_control.rename(
237237
"gmst_pulse_minus_control"
238238
)
239+
240+
# gdp
241+
gdp = (
242+
xr.open_dataset(
243+
"/shares/gcp/integration_replication/inputs/econ/rff_global_socioeconomics.nc4"
244+
)
245+
.drop('region')
246+
.rename({"runid": "rff_sp"})
247+
.gdp.sel(rff_sp=cw.rff_sp)
248+
)
239249

240250
data = xr.combine_by_coords(
241251
[
@@ -249,6 +259,7 @@ def rff_timeseries(
249259
c_emissions,
250260
gmst,
251261
gmst_pulse_minus_control,
262+
gdp,
252263
]
253264
]
254265
)
@@ -260,7 +271,7 @@ def rff_timeseries(
260271

261272
data = data.sel(runid=rff_ids).to_dataframe().reset_index()
262273

263-
fig, ax = plt.subplots(7, 1, figsize=(10, 15), sharex=True)
274+
fig, ax = plt.subplots(8, 1, figsize=(10, 15), sharex=True)
264275

265276
for i, yvar in enumerate(
266277
[
@@ -271,6 +282,7 @@ def rff_timeseries(
271282
"marginal_damages",
272283
"discount_factors",
273284
"discounted_damages",
285+
"gdp",
274286
]
275287
):
276288

@@ -397,6 +409,7 @@ def ssp_timeseries(
397409
if "coastal" not in sector:
398410
anomaly = anomaly.sel(gas=gas, drop=True)
399411

412+
400413
data = xr.combine_by_coords(
401414
[
402415
i.to_dataset()
@@ -420,7 +433,7 @@ def ssp_timeseries(
420433

421434
data = data.to_dataframe().reset_index()
422435

423-
fig, ax = plt.subplots(6, 1, figsize=(10, 15), sharex=True)
436+
fig, ax = plt.subplots(7, 1, figsize=(10, 15), sharex=True)
424437

425438
for i, yvar in enumerate(
426439
[

0 commit comments

Comments
 (0)