Skip to content

Commit

Permalink
Clarifying report comment and recoding water supply fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adrivinca committed Oct 23, 2024
1 parent cb98f9f commit 15ea9ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions message_ix_models/model/water/data/water_supply.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ def map_basin_region_wat(context: "Context") -> pd.DataFrame:
# Reading data, the data is spatially and temporally aggregated from GHMs
df_sw["BCU_name"] = df_x["BCU_name"]

if context.type_reg == "country":
df_sw["MSGREG"] = context.map_ISO_c[context.regions]
else:
df_sw["MSGREG"] = (
f"{context.regions}_" + df_sw["BCU_name"].str.split("|").str[-1]
)
df_sw["MSGREG"] = (

Check warning on line 97 in message_ix_models/model/water/data/water_supply.py

View check run for this annotation

Codecov / codecov/patch

message_ix_models/model/water/data/water_supply.py#L97

Added line #L97 was not covered by tests
context.map_ISO_c[context.regions]
if context.type_reg == "country"
else f"{context.regions}_" + df_sw["BCU_name"].str.split("|").str[-1]
)

df_sw = df_sw.set_index(["MSGREG", "BCU_name"])
df_sw.drop(columns="Unnamed: 0", inplace=True)
Expand Down
3 changes: 2 additions & 1 deletion message_ix_models/model/water/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ def report(sc: Scenario, reg: str, sdgs: bool = False) -> None:
for ur in ["urban", "rural"]:
# CHANGE TO URBAN AND RURAL POP
pop_tot = sc.timeseries(variable=("Population|" + ur.capitalize()))
pop_tot = pop_tot[-(pop_tot.region == "GLB region (R11)")] # ONLY R11!!!
# ONLY R11!!! Need to fix when updating the reporting to work with any region
pop_tot = pop_tot[-(pop_tot.region == "GLB region (R11)")]
pop_reg = np.unique(pop_tot["region"])
# need to change names
reg_map = mp2.regions()
Expand Down

0 comments on commit 15ea9ed

Please sign in to comment.