From d19a3bcb64a222d47a59ecd1b4e759117f366579 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 21 May 2024 14:22:21 +0200 Subject: [PATCH] time_aggregation: handle case where resolution is bool false --- scripts/time_aggregation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/time_aggregation.py b/scripts/time_aggregation.py index 3792a39f..1c01a08d 100644 --- a/scripts/time_aggregation.py +++ b/scripts/time_aggregation.py @@ -78,13 +78,13 @@ if __name__ == "__main__": resolution = snakemake.params.time_resolution # Representative snapshots - if "sn" in resolution.lower(): + if isinstance(resolution, str) and "sn" in resolution.lower(): logger.info("Use representative snapshots") # Output an empty csv; this is taken care of in prepare_sector_network.py pd.DataFrame().to_csv(snakemake.output.snapshot_weightings) # Plain resampling - elif "h" in resolution.lower(): + elif isinstance(resolution, str) and "h" in resolution.lower(): offset = resolution.lower() logger.info(f"Averaging every {offset} hours") snapshot_weightings = n.snapshot_weightings.resample(offset).sum() @@ -95,7 +95,7 @@ if __name__ == "__main__": snapshot_weightings.to_csv(snakemake.output.snapshot_weightings) # Temporal segmentation - elif "seg" in resolution.lower(): + elif isinstance(resolution, str) and "seg" in resolution.lower(): segments = int(resolution[:-3]) logger.info(f"Use temporal segmentation with {segments} segments")