From aff5e091957e87e793622402837368b15db2dc1b Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 25 Jul 2022 17:04:56 +0200 Subject: [PATCH] hydro: store corrected eia stats --- Snakefile | 4 +++- scripts/build_hydro_profile.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Snakefile b/Snakefile index 34c77981..9e964115 100644 --- a/Snakefile +++ b/Snakefile @@ -234,7 +234,9 @@ rule build_hydro_profile: eia_hydro_capacity='data/eia_hydro_annual_capacity.csv', era5_runoff='data/era5-annual-runoff-per-country.csv', cutout=f"cutouts/{config['renewable']['hydro']['cutout']}.nc" if "hydro" in config["renewable"] else "config['renewable']['hydro']['cutout'] not configured", - output: 'resources/profile{weather_year}_hydro.nc' + output: + profile='resources/profile{weather_year}_hydro.nc', + eia_hydro='resources/eia_hydro_annual_generation.csv', log: "logs/build_hydro_profile{weather_year}.log" resources: mem_mb=5000 script: 'scripts/build_hydro_profile.py' diff --git a/scripts/build_hydro_profile.py b/scripts/build_hydro_profile.py index b8d2eec8..4a9fc409 100644 --- a/scripts/build_hydro_profile.py +++ b/scripts/build_hydro_profile.py @@ -180,6 +180,8 @@ if __name__ == "__main__": fn = snakemake.input.era5_runoff eia_stats = approximate_missing_eia_stats(eia_stats, fn, countries) + eia_stats.to_csv(snakemake.output.eia_hydro) + weather_year = snakemake.wildcards.weather_year norm_year = config_hydro.get('eia_norm_year') if norm_year: @@ -195,4 +197,4 @@ if __name__ == "__main__": if 'clip_min_inflow' in config_hydro: inflow = inflow.where(inflow > config_hydro['clip_min_inflow'], 0) - inflow.to_netcdf(snakemake.output[0]) + inflow.to_netcdf(snakemake.output.profile)