Skip to content

Commit 1c0a424

Browse files
committed
Remove commented outdated code
1 parent a334c33 commit 1c0a424

File tree

1 file changed

+2
-118
lines changed

1 file changed

+2
-118
lines changed

message_ix_models/model/water/data/water_for_ppl.py

Lines changed: 2 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -342,29 +342,9 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
342342
.drop(columns=1)
343343
)
344344

345-
# # Filter for rows where parent_tech is "csp_sm1_res"
346-
# csp_rows = cooling_df[cooling_df["parent_tech"] == "csp_sm1_res"].copy()
347-
348-
# # Define suffixes for historical years
349-
# hist_years = ["hist_2010", "hist_2015", "hist_2020"]
350-
351-
# # Expand the dataframe for csp historical caapcities
352-
# expanded_rows = []
353-
# for hist_year in hist_years:
354-
# temp_df = csp_rows.copy()
355-
# temp_df["parent_tech"] = temp_df["parent_tech"] + f"_{hist_year}"
356-
# temp_df["technology_name"] = temp_df["technology_name"].str.replace(
357-
# "csp_sm1_res", f"csp_sm1_res_{hist_year}"
358-
# )
359-
# expanded_rows.append(temp_df)
360-
361-
# # Concatenate with original dataframe
362-
# cooling_df = pd.concat([cooling_df] + expanded_rows, ignore_index=True)
363-
364345
scen = context.get_scenario()
365346

366347
# Extracting input database from scenario for parent technologies
367-
# Extracting input values from scenario
368348
ref_input = scen.par("input", {"technology": cooling_df["parent_tech"]})
369349
# list of tec in cooling_df["parent_tech"] that are not in ref_input
370350
missing_tec = cooling_df["parent_tech"][
@@ -443,17 +423,6 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
443423
input_cool["consumption_rate"] * input_cool["value_cool"]
444424
)
445425

446-
# def foo3(x):
447-
# """
448-
# This function is similar to foo2, but it returns electricity values
449-
# per unit of cooling for techs that require parasitic electricity demand
450-
# """
451-
# if "hpl" in x['index']:
452-
# return x['parasitic_electricity_demand_fraction']
453-
#
454-
# elif x['parasitic_electricity_demand_fraction'] > 0.0:
455-
# return x['parasitic_electricity_demand_fraction'] / x['cooling_fraction']
456-
457426
# Filter out technologies that requires parasitic electricity
458427
electr = input_cool[input_cool["parasitic_electricity_demand_fraction"] > 0.0]
459428

@@ -672,8 +641,8 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
672641
share_fut["value"] = np.where(share_fut["value"] < 0.45, 0.45, share_fut["value"])
673642
# keep only after 2050
674643
share_fut = share_fut[share_fut["year_act"] >= 2050]
675-
# append share_calib and share_fut
676-
results["share_commodity_up"] = pd.concat([share_calib, share_fut])
644+
# append share_calib and (share_fut only to add constraints on ot_saline)
645+
results["share_commodity_up"] = pd.concat([share_calib])
677646

678647
# Filtering out 2015 data to use for historical values
679648
input_cool_2015 = input_cool[
@@ -751,58 +720,6 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
751720
search_cols=search_cols,
752721
)
753722

754-
# changed_value_series = ref_hist_act.apply(
755-
# hist_act, axis=1, context=context, hold_cost=hold_cost
756-
# )
757-
# changed_value_series_flat = [
758-
# row for series in changed_value_series for row in series
759-
# ]
760-
# columns_act = [
761-
# "node_loc",
762-
# "technology",
763-
# "cooling_technology",
764-
# "year_act",
765-
# "value",
766-
# "new_value",
767-
# "unit",
768-
# ]
769-
# # dataframe for historical activities of cooling techs
770-
# act_value_df = pd.DataFrame(changed_value_series_flat, columns=columns_act)
771-
# act_value_df = act_value_df[act_value_df["new_value"] > 0]
772-
773-
# # now hist capacity
774-
# changed_value_series = ref_hist_cap.apply(
775-
# hist_cap, axis=1, context=context, hold_cost=hold_cost
776-
# )
777-
# changed_value_series_flat = [
778-
# row for series in changed_value_series for row in series
779-
# ]
780-
# columns_cap = [
781-
# "node_loc",
782-
# "technology",
783-
# "cooling_technology",
784-
# "year_vtg",
785-
# "value",
786-
# "new_value",
787-
# "unit",
788-
# ]
789-
# cap_value_df = pd.DataFrame(changed_value_series_flat, columns=columns_cap)
790-
# cap_value_df = cap_value_df[cap_value_df["new_value"] > 0]
791-
792-
# h_act = make_df(
793-
# "historical_activity",
794-
# node_loc=act_value_df["node_loc"],
795-
# technology=act_value_df["cooling_technology"],
796-
# year_act=act_value_df["year_act"],
797-
# mode="M1",
798-
# time="year",
799-
# value=act_value_df["new_value"],
800-
# # TODO finalize units
801-
# unit="GWa",
802-
# )
803-
804-
# results["historical_activity"] = h_act
805-
806723
# hist cap to be divided by cap_factor of the parent tec
807724
cap_fact_parent = scen.par(
808725
"capacity_factor", {"technology": cooling_df["parent_tech"]}
@@ -845,25 +762,6 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
845762
columns={"value": "cap_fact", "technology": "utype"}, inplace=True
846763
)
847764

848-
# # merge cap_fact_parent with cap_value_df
849-
# cap_value_df = pd.merge(cap_value_df, cap_fact_parent, how="left")
850-
# # divide new_value by cap_fact
851-
# cap_value_df["new_value"] = cap_value_df["new_value"] / cap_value_df["cap_fact"]
852-
# # drop cap_fact
853-
# cap_value_df.drop(columns="cap_fact", inplace=True)
854-
855-
# # Make model compatible df for histroical new capacity
856-
# h_cap = make_df(
857-
# "historical_new_capacity",
858-
# node_loc=cap_value_df["node_loc"],
859-
# technology=cap_value_df["cooling_technology"],
860-
# year_vtg=cap_value_df["year_vtg"],
861-
# value=cap_value_df["new_value"],
862-
# unit="GWa",
863-
# )
864-
865-
# results["historical_new_capacity"] = h_cap
866-
867765
# Manually removing extra technologies not required
868766
# TODO make it automatic to not include the names manually
869767
techs_to_remove = [
@@ -1043,20 +941,6 @@ def cool_tech(context: "Context") -> dict[str, pd.DataFrame]:
1043941
[results.get(param_name, pd.DataFrame()), df_param_share], ignore_index=True
1044942
)
1045943

1046-
# # Function to rename and add transformed parameters
1047-
# def rename_and_add(param_name, new_name, rename_dict):
1048-
# if param_name in results:
1049-
# df_transformed = (
1050-
# results[param_name].drop(columns="time").rename(columns=rename_dict)
1051-
# )
1052-
# results[new_name] = df_transformed
1053-
1054-
# # Apply renaming for multiple parameters
1055-
# rename_and_add("soft_activity_up", "soft_new_capacity_up", {"year_act": "year_vtg"})
1056-
# rename_and_add(
1057-
# "growth_activity_up", "growth_new_capacity_up", {"year_act": "year_vtg"}
1058-
# )
1059-
1060944
# add share constraints for cooling technologies based on SSP assumptions
1061945
df_share = cooling_shares_SSP_from_yaml(context)
1062946

0 commit comments

Comments
 (0)