From 7e628f66c5b8adfe3f618ac2c8d5166f7749b59e Mon Sep 17 00:00:00 2001 From: Philipp Glaum Date: Wed, 15 Dec 2021 10:53:55 +0100 Subject: [PATCH] updated Snakefile and build_line_rating.py --- Snakefile | 8 ++++---- scripts/build_line_rating.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Snakefile b/Snakefile index b0dcc3b6..b02e4f33 100644 --- a/Snakefile +++ b/Snakefile @@ -215,13 +215,13 @@ if 'hydro' in config['renewable'].keys(): resources: mem=5000 script: 'scripts/build_hydro_profile.py' -if config['lines'].get('dynamic_line_rating', True): +if config['lines'].get('line_rating', False): rule build_line_rating: input: base_network="networks/base.nc", - cutout="cutouts/" + config["renewable"]['onwind']['cutout'] + ".nc" + cutout="cutouts/" + config["lines"]['cutout'] + ".nc" output: - output="networks/base_line_rating.nc" + output="networks/base_lr.nc" log: "logs/build_line_rating.log" benchmark: "benchmarks/build_line_rating" threads: 1 @@ -230,7 +230,7 @@ if config['lines'].get('dynamic_line_rating', True): rule add_electricity: input: - base_network = rules.build_line_rating.output[0] if config['lines'].get('dynamic_line_rating', True) else rules.base_network.output[0], + base_network = "networks/base_lr.nc" if config['lines'].get('line_rating', False) else "networks/base.nc", tech_costs=COSTS, regions="resources/regions_onshore.geojson", powerplants='resources/powerplants.csv', diff --git a/scripts/build_line_rating.py b/scripts/build_line_rating.py index 7e42419a..62291326 100644 --- a/scripts/build_line_rating.py +++ b/scripts/build_line_rating.py @@ -66,7 +66,6 @@ def add_line_rating(n): shapes = [Line([Point(x[b0], y[b0]), Point(x[b1], y[b1])]) for (b0, b1) in buses] shapes = gpd.GeoSeries(shapes, index=n.lines.index) cutout = atlite.Cutout(snakemake.input.cutout) - cutout.prepare(features=['temperature', "wnd100m", "height", "wnd_azimuth"]) s = np.sqrt(3) * cutout.line_rating(shapes, n.lines.r/n.lines.length) * 1e3 # in MW n.lines_t.s_max_pu=s.to_pandas().transpose()/n.lines.s_nom n.lines_t.s_max_pu.replace(np.inf, 1.0, inplace=True)