Skip to content

Commit

Permalink
Merge branch 'main' into olex/subres-regions
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro authored Feb 4, 2025
2 parents 033dbb6 + 0b4b369 commit 72985d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ REF_demos_xlsx="7d2e8e0c44eae22e28a14837cd0c031b61eea3ff"
REF_demos_dd="c3b53ceae1de72965559f95016171ec67f333fc7"
REF_tim_xlsx="e820d8002adc6b1526a3bffcc439219b28d0eed5"
REF_tim_gams="cfe2628dbb5974b99c8a5664a9358849324e31ac"
REF_TIMES_NZ="4170d720e1c5cb0e31537a3168188169209ceb4d"
REF_TIMES_NZ="64c48461690fd2458d112b97c68e788c63490461"

# If no GitHub token is provided, try to clone using SSH
if [ -z "$GH_PAT_DEMOS_XLSX" ]; then
Expand Down
7 changes: 5 additions & 2 deletions xl2times/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def convert_xl_to_times(
transforms.harmonise_tradelinks,
transforms.include_tables_source,
transforms.process_processes,
transforms.create_model_topology,
transforms.fill_in_column_defaults,
transforms.create_model_topology,
transforms.generate_uc_properties,
transforms.expand_rows_parallel, # slow
transforms.process_tradelinks,
Expand Down Expand Up @@ -444,12 +444,15 @@ def convert_parameter(tablename: str, df: DataFrame):
"ts.dd": ["ALL_TS"],
"milestonyr.dd": ["MILESTONYR"],
"output.dd": [
t for t in config.dd_table_order if t not in ["ALL_TS", "MILESTONYR"]
t for t in config.dd_table_order if t not in {"ALL_TS", "MILESTONYR"}
],
}

for fname, tablenames in tables_in_file.items():
with open(os.path.join(output_dir, fname), "w", encoding=encoding) as fout:
# Include GAMS dollar control options
if fname == "output.dd":
fout.write("$ONEPS\n$ONWARNING\n\n")
for tablename in [t for t in tablenames if t in tables]:
df = tables[tablename]
if tablename in sets:
Expand Down
8 changes: 4 additions & 4 deletions xl2times/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1521,10 +1521,10 @@ def complete_model_trade(
veda_set_ext_reg_mapping = {"IMP": "IMPEXP", "EXP": "IMPEXP", "MIN": "MINRNW"}
veda_ire_sets = model.custom_sets

ire_prc = pd.DataFrame(columns=["region", "process"])
df = model.processes
ire_prc = pd.concat([ire_prc, df.loc[df["sets"] == "IRE", ["region", "process"]]])
ire_prc = ire_prc.drop_duplicates(keep="last")
# Index of IRE processes in model.processes
i = model.processes["sets"] == "IRE"
# IRE processes by region
ire_prc = model.processes[["region", "process"]][i].drop_duplicates(keep="last")

# Generate inter-regional exchange topology
top_ire = model.topology[["region", "process", "commodity", "io"] + list(dm_cols)]
Expand Down

0 comments on commit 72985d6

Please sign in to comment.