Skip to content

Commit 2ad9373

Browse files
Wegatriespythonglatterf42
authored andcommitted
Expand pop sdg beyond R11
1 parent a2477a0 commit 2ad9373

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

message_ix_models/model/water/report.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,12 @@ def pop_water_access(sc: Scenario, reg: str, sdgs: bool = False) -> pd.DataFrame
332332
for ur in ["urban", "rural"]:
333333
# CHANGE TO URBAN AND RURAL POP
334334
pop_tot = sc.timeseries(variable=("Population|" + ur.capitalize()))
335-
# ONLY R11!!! Need to fix when updating the reporting to work with any region
336-
pop_tot = pop_tot[pop_tot.region != "GLB region (R11)"]
335+
# Exclude global aggregate regions for both R11 and R12
336+
pop_tot = pop_tot[
337+
~pop_tot.region.str.contains(
338+
r"GLB\s+region|^World$|^Global$|Total", case=False, regex=True, na=False
339+
)
340+
]
337341
pop_reg = np.unique(pop_tot["region"])
338342
# need to change names
339343
reg_map = mp2.regions()
@@ -804,17 +808,17 @@ def report(sc: Scenario, reg: str, sdgs: bool = False) -> None:
804808
[
805809
"Water Withdrawal|Electricity|Cooling|Fresh Water",
806810
cooling_fresh_water,
807-
"MCM/yr"
811+
"MCM/yr",
808812
],
809813
[
810814
"Water Withdrawal|Electricity|Cooling|Once Through|Fresh Water",
811815
cooling_ot_fresh_water,
812-
"MCM/yr"
816+
"MCM/yr",
813817
],
814818
[
815819
"Water Withdrawal|Electricity|Cooling|Closed Loop|Fresh Water",
816820
cooling_cl_fresh_water,
817-
"MCM/yr"
821+
"MCM/yr",
818822
],
819823
[
820824
"Capacity Additions|Infrastructure|Water",
@@ -1422,6 +1426,7 @@ def weighted_average_safe(x):
14221426
report_pd = report_pd[-report_pd.variable.isin(water_hydro_var)]
14231427

14241428
# add water population
1429+
# FIXME add support for baseline
14251430
if sdgs != "baseline":
14261431
pop_sdg6 = pop_water_access(sc, reg, sdgs)
14271432
report_pd = pd.concat([report_pd, pop_sdg6])

0 commit comments

Comments
 (0)