time_aggregation: handle case without any temporal aggregation

This commit is contained in:
Fabian Neumann 2024-05-25 15:48:48 +02:00
parent 8b0600b02c
commit 422c37827c
2 changed files with 6 additions and 3 deletions

View File

@ -3628,7 +3628,10 @@ def set_temporal_aggregation(n, resolution, snapshot_weightings):
""" """
Aggregate time-varying data to the given snapshots. 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 # Representative snapshots are dealt with directly
sn = int(resolution[:-2]) sn = int(resolution[:-2])
logger.info("Use every %s snapshot as representative", sn) logger.info("Use every %s snapshot as representative", sn)

View File

@ -79,8 +79,8 @@ if __name__ == "__main__":
resolution = snakemake.params.time_resolution resolution = snakemake.params.time_resolution
# Representative snapshots # Representative snapshots
if isinstance(resolution, str) and "sn" in resolution.lower(): if not resolution or isinstance(resolution, str) and "sn" in resolution.lower():
logger.info("Use representative snapshots") logger.info("Use representative snapshot or no aggregation at all")
# Output an empty csv; this is taken care of in prepare_sector_network.py # Output an empty csv; this is taken care of in prepare_sector_network.py
pd.DataFrame().to_csv(snakemake.output.snapshot_weightings) pd.DataFrame().to_csv(snakemake.output.snapshot_weightings)