diff --git a/message_ix_models/model/material/data_ammonia_new.py b/message_ix_models/model/material/data_ammonia_new.py index b72041cfb9..5be5b12d16 100644 --- a/message_ix_models/model/material/data_ammonia_new.py +++ b/message_ix_models/model/material/data_ammonia_new.py @@ -46,7 +46,7 @@ def gen_all_NH3_fert( def broadcast_years( - df_new: pd.DataFrame, max_lt: int, act_years, vtg_years + df_new: pd.DataFrame, max_lt: int, act_years: pd.Series, vtg_years: pd.Series ) -> pd.DataFrame: if "year_act" in df_new.columns: df_new = df_new.pipe(same_node).pipe(broadcast, year_act=act_years) diff --git a/message_ix_models/model/material/data_cement.py b/message_ix_models/model/material/data_cement.py index e8ace6122b..ce9f3e565c 100644 --- a/message_ix_models/model/material/data_cement.py +++ b/message_ix_models/model/material/data_cement.py @@ -174,7 +174,6 @@ def gen_data_cement( context.datafile = "Global_steel_cement_MESSAGE.xlsx" # Techno-economic assumptions - # TEMP: now add cement sector as well data_cement = read_sector_data(scenario, "cement", "Global_cement_MESSAGE.xlsx") # Special treatment for time-dependent Parameters data_cement_ts = read_timeseries(scenario, "cement", "Global_cement_MESSAGE.xlsx") @@ -183,7 +182,7 @@ def gen_data_cement( # List of data frames, to be concatenated together at end results = defaultdict(list) - # For each technology there are differnet input and output combinations + # For each technology there are different input and output combinations # Iterate over technologies yv_ya = s_info.yv_ya @@ -191,7 +190,6 @@ def gen_data_cement( # Do not parametrize GLB region the same way nodes = nodes_ex_world(s_info.N) - # for t in s_info.set['technology']: for t in config["technology"]["add"]: t = t.id params = data_cement.loc[(data_cement["technology"] == t), "parameter"].unique() diff --git a/message_ix_models/model/material/data_generic.py b/message_ix_models/model/material/data_generic.py index 8686101e0c..74a29d6780 100644 --- a/message_ix_models/model/material/data_generic.py +++ b/message_ix_models/model/material/data_generic.py @@ -1,7 +1,7 @@ from collections import defaultdict import pandas as pd -from message_ix import make_df +from message_ix import Scenario, make_df import message_ix_models.util from message_ix_models import ScenarioInfo @@ -40,7 +40,9 @@ def read_data_generic(scenario: Scenario) -> (pd.DataFrame, pd.DataFrame): return data_generic, data_generic_ts -def gen_data_generic(scenario: Scenario, dry_run: bool = False) -> dict[str, pd.DataFrame]: +def gen_data_generic( + scenario: Scenario, dry_run: bool = False +) -> dict[str, pd.DataFrame]: # Load configuration config = read_config()["material"]["generic"] diff --git a/message_ix_models/model/material/data_petro.py b/message_ix_models/model/material/data_petro.py index e9ee217bd4..e7fbe66263 100644 --- a/message_ix_models/model/material/data_petro.py +++ b/message_ix_models/model/material/data_petro.py @@ -1,5 +1,5 @@ from collections import defaultdict -from typing import List +from typing import List, Set import message_ix import pandas as pd @@ -166,7 +166,7 @@ def get_demand_t1_with_income_elasticity( def gen_data_petro_ts( - data_petro_ts: pd.DataFrame, results: dict[list], tec_ts, nodes + data_petro_ts: pd.DataFrame, results: dict[list], tec_ts: Set[str], nodes: List[str] ) -> None: for t in tec_ts: common = dict( @@ -234,7 +234,7 @@ def assign_input_outpt( split: str, param_name: str, regions: pd.DataFrame, - val, + val: float | int, t: str, rg: str, global_region: str, @@ -480,23 +480,7 @@ def gen_data_petro_chemicals( ) results["demand"].append(demand_hvc) - # df_e = make_df(paramname, level='final_material', commodity="ethylene", \ - # value=demand_e.value, unit='t',year=demand_e.year, time='year', \ - # node=demand_e.node)#.pipe(broadcast, node=nodes) - # results["demand"].append(df_e) - # - # df_p = make_df(paramname, level='final_material', commodity="propylene", \ - # value=demand_p.value, unit='t',year=demand_p.year, time='year', \ - # node=demand_p.node)#.pipe(broadcast, node=nodes) - # results["demand"].append(df_p) - # - # df_BTX = make_df(paramname, level='final_material', commodity="BTX", \ - # value=demand_BTX.value, unit='t',year=demand_BTX.year, time='year', \ - # node=demand_BTX.node)#.pipe(broadcast, node=nodes) - # results["demand"].append(df_BTX) - # Special treatment for time-varying params - tec_ts = set(data_petro_ts.technology) # set of tecs in timeseries sheet gen_data_petro_ts(data_petro_ts, results, tec_ts, nodes) diff --git a/message_ix_models/model/material/data_util.py b/message_ix_models/model/material/data_util.py index ca201b3c7d..6bf5a8ad89 100644 --- a/message_ix_models/model/material/data_util.py +++ b/message_ix_models/model/material/data_util.py @@ -2159,7 +2159,7 @@ def gen_te_projections( def get_ssp_soc_eco_data( - context: "Context", model: str, measure: str, tec + context: "Context", model: str, measure: str, tec: str ) -> pd.DataFrame: """ Function to update scenario GDP and POP timeseries to SSP 3.0 diff --git a/message_ix_models/model/material/material_demand/material_demand_calc.py b/message_ix_models/model/material/material_demand/material_demand_calc.py index 2434f676c9..fa007d865b 100644 --- a/message_ix_models/model/material/material_demand/material_demand_calc.py +++ b/message_ix_models/model/material/material_demand/material_demand_calc.py @@ -62,7 +62,7 @@ def steel_function(x: pd.DataFrame | float, a: float, b: float, m: float): return a * np.exp(b / gdp_pcap) * (1 - m) ** del_t -def cement_function(x: pd.DataFrame | float, a, b): +def cement_function(x: pd.DataFrame | float, a: float, b: float): gdp_pcap = x[0] return a * np.exp(b / gdp_pcap)