From 02c06017d3f1373c7eb2107b19d5ae2cfba51278 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 8 Apr 2022 10:27:23 +0200 Subject: [PATCH] prepare: add gas consumption limit through wildcard: CH4L --- scripts/prepare_network.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index 52e2eff4..2b4e6113 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -249,9 +249,17 @@ if __name__ == "__main__": logger.info("Setting CO2 limit according to config value.") break - gaslimit = snakemake.config["electricity"].get("gaslimit") - if gaslimit: - add_gaslimit(n, gaslimit, Nyears) + for o in opts: + if "CH4L" in o: + m = re.findall("[0-9]*\.?[0-9]+$", o) + if len(m) > 0: + limit = float(m[0]) * 1e6 + add_gaslimit(n, limit, Nyears) + logger.info("Setting gas usage limit according to wildcard value.") + else: + add_gaslimit(n, snakemake.config["electricity"].get("gaslimit"), Nyears) + logger.info("Setting gas usage limit according to config value.") + break for o in opts: oo = o.split("+")