diff --git a/pyproject.toml b/pyproject.toml index 6a05434..93f60dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,9 @@ requires = ["setuptools>=61.0.0", "wheel"] build-backend = "setuptools.build_meta" +[tool.setuptools] +packages = ["times_reader"] + [project] name = "times-excel-reader" version = "0.1.0" diff --git a/times_reader/__main__.py b/times_reader/__main__.py index 9340d08..8cb4938 100644 --- a/times_reader/__main__.py +++ b/times_reader/__main__.py @@ -304,9 +304,10 @@ def convert_parameter(tablename: str, df: DataFrame): sets = {m.times_name for m in config.times_xl_maps if "VALUE" not in m.col_map} - # Compute map fname -> tables: right now ALL_TS -> ts.dd, rest -> output.dd + # Compute map fname -> tables: put ALL_TS and MILESTONYR in separate files tables_in_file = { "ts.dd": ["ALL_TS"], + "milestonyr.dd": ["MILESTONYR"], "output.dd": [t for t in config.dd_table_order if t != "ALL_TS"], } diff --git a/times_reader/config/times_mapping.txt b/times_reader/config/times_mapping.txt index bec9585..308d0d1 100644 --- a/times_reader/config/times_mapping.txt +++ b/times_reader/config/times_mapping.txt @@ -48,6 +48,7 @@ G_YRFR[REG,ALL_TS,VALUE] = ~FI_T(Region,TimeSlice,VALUE,Attribute:G_YRFR) IRE_FLO[REG,DATAYEAR,PRC,COM,TSLVL,IE,COM,VALUE] = ~TODO(TODO) IRE_FLOSUM[REG,DATAYEAR,PRC,COM,TSLVL,IE,COM,IO,VALUE] = ~TODO(Region,Year,TechName,CommName,TimeSlice,TODO-IE,CommName,TODO-IO,TODO-IRE_FLOSUM) IRE_PRICE[REG,DATAYEAR,PRC,COM,TSLVL,REG,IE,CUR,VALUE] = ~FI_T(Region,Year,TechName,CommName,TimeSlice,Region,Other_Indexes,Curr,VALUE,Attribute:IRE_PRICE) +MILESTONYR[YEAR] = ~TimePeriods(M) MODLYEAR[DATAYEAR,TEXT] = ModelYear(Year,Year) NCAP_AFA[REG,DATAYEAR,PRC,BD,VALUE] = ~FI_T(Region,Year,TechName,LimType,VALUE,Attribute:NCAP_AFA) NCAP_AFC[REG,DATAYEAR,PRC,COM_GRP,TSLVL,VALUE] = ~FI_T(Region,Year,TechName,Other_Indexes,TimeSlice,VALUE,Attribute:NCAP_AFC) diff --git a/times_reader/gams_scaffold/scenario.run b/times_reader/gams_scaffold/scenario.run index 6339896..f88beaa 100644 --- a/times_reader/gams_scaffold/scenario.run +++ b/times_reader/gams_scaffold/scenario.run @@ -51,7 +51,7 @@ $ BATINCLUDE initmty.mod $IF NOT DECLARED REG_BNDCST $Abort "You need to use TIMES v2.3.1 or higher" $BATINCLUDE output.dd -SET MILESTONYR /2005,2006/; +$BATINCLUDE milestonyr.dd $ SET VEDAVDD 'YES' diff --git a/utils/run_benchmarks.py b/utils/run_benchmarks.py index 6ea428f..dcb4d0f 100644 --- a/utils/run_benchmarks.py +++ b/utils/run_benchmarks.py @@ -73,7 +73,6 @@ def run_gams_gdxdiff( f.write(f"$BATINCLUDE {file}.dd\n") continue f.write(line) - # TODO also get milestone years from benchmarks.yml # Create link to TIMES source if not path.exists(path.join(dd_folder, "source")): symlink(times_folder, path.join(dd_folder, "source"), True) @@ -271,7 +270,7 @@ def run_all_benchmarks( benchmark, times_folder=times_folder, skip_csv=True, - run_gams=True, + run_gams=run_gams, out_folder="out-main", verbose=verbose, ) @@ -400,7 +399,7 @@ def run_all_benchmarks( print(f"ERROR: could not find {args.run} in {args.benchmarks_yaml}") sys.exit(1) - runtime, _, _, _, _ = run_benchmark( + runtime, gms, acc, cor, add = run_benchmark( benchmarks_folder, benchmark, times_folder=args.times_dir, @@ -408,7 +407,10 @@ def run_all_benchmarks( skip_csv=args.skip_csv, verbose=args.verbose, ) - print(f"Ran {args.run} in {runtime:.2f}s") + print( + f"Ran {args.run} in {runtime:.2f}s. {acc}% ({cor} correct, {add} additional).\n" + f"GAMS: {gms}" + ) else: run_all_benchmarks( benchmarks_folder,