From 422c37827cf281b9b7fe59262eaa33298c0e0775 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sat, 25 May 2024 15:48:48 +0200 Subject: [PATCH] time_aggregation: handle case without any temporal aggregation --- scripts/prepare_sector_network.py | 5 ++++- scripts/time_aggregation.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 3f8dd022..03fdbaf4 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -3628,7 +3628,10 @@ def set_temporal_aggregation(n, resolution, snapshot_weightings): """ Aggregate time-varying data to the given snapshots. """ - if "sn" in resolution.lower(): + if not resolution: + logger.info("No temporal aggregation. Using native resolution.") + return n + elif "sn" in resolution.lower(): # Representative snapshots are dealt with directly sn = int(resolution[:-2]) logger.info("Use every %s snapshot as representative", sn) diff --git a/scripts/time_aggregation.py b/scripts/time_aggregation.py index 97bf180a..7ed69112 100644 --- a/scripts/time_aggregation.py +++ b/scripts/time_aggregation.py @@ -79,8 +79,8 @@ if __name__ == "__main__": resolution = snakemake.params.time_resolution # Representative snapshots - if isinstance(resolution, str) and "sn" in resolution.lower(): - logger.info("Use representative snapshots") + if not resolution or isinstance(resolution, str) and "sn" in resolution.lower(): + logger.info("Use representative snapshot or no aggregation at all") # Output an empty csv; this is taken care of in prepare_sector_network.py pd.DataFrame().to_csv(snakemake.output.snapshot_weightings)