Fix zone label, move subfolder creation to after calculations.
@@ -56,8 +56,6 @@ def main():
args = parse_command_line(sys.argv)
settings = load_settings(path=args.settings_file)
- out_folder = DATA_PATHS["results"] / args.results_folder
- out_folder.mkdir(exist_ok=True)
pudl_engine, pudl_out = init_pudl_connection(freq="YS")
@@ -74,14 +72,14 @@ def main():
)
zones = settings["model_regions"]
- zone_num_map = {
- zone: f"{number}" for zone, number in zip(zones, range(len(zones)))
- }
+ zone_num_map = {zone: f"{number}" for zone, number in zip(zones, range(len(zones)))}
gen_clusters = create_region_technology_clusters(
pudl_engine=pudl_engine, pudl_out=pudl_out, settings=settings
)
- gen_clusters['zone'] = gen_clusters.index.get_level_values('region').map(zone_num_map)
+ gen_clusters["zone"] = gen_clusters.index.get_level_values("region").map(
+ zone_num_map
+ )
load = load_curves(pudl_engine=pudl_engine, settings=settings)
@@ -89,6 +87,9 @@ def main():
pudl_engine=pudl_engine, settings=settings
)
+ out_folder = DATA_PATHS["results"] / args.results_folder
+ out_folder.mkdir(exist_ok=True)
+
gen_clusters.to_csv(
out_folder / f"generator_clusters_{args.results_folder}.csv",
float_format="%.2f",
