add input file handling of pypsa-eur-sec rules using cutout

This commit is contained in:
Fabian Neumann 2023-03-06 15:07:09 +01:00
parent d27fee7e77
commit 7334913e11
8 changed files with 17 additions and 15 deletions

View File

@ -661,7 +661,8 @@ if config.get("retrieve_cost_data", True):
rule build_population_layouts:
input:
nuts3_shapes='resources/' + RDIR + 'nuts3_shapes.geojson',
urban_percent="data/urban_percent.csv"
urban_percent="data/urban_percent.csv",
cutout="cutouts/" + CDIR + config["atlite"]["default_cutout"] + ".nc",
output:
pop_layout_total="resources/" + RDIR + "pop_layout_total.nc",
pop_layout_urban="resources/" + RDIR + "pop_layout_urban.nc",
@ -677,7 +678,8 @@ rule build_clustered_population_layouts:
pop_layout_total="resources/" + RDIR + "pop_layout_total.nc",
pop_layout_urban="resources/" + RDIR + "pop_layout_urban.nc",
pop_layout_rural="resources/" + RDIR + "pop_layout_rural.nc",
regions_onshore='resources/' + RDIR + 'regions_onshore_elec_s{simpl}_{clusters}.geojson'
regions_onshore='resources/' + RDIR + 'regions_onshore_elec_s{simpl}_{clusters}.geojson',
cutout="cutouts/" + CDIR + config["atlite"]["default_cutout"] + ".nc",
output:
clustered_pop_layout="resources/" + RDIR + "pop_layout_elec_s{simpl}_{clusters}.csv"
resources: mem_mb=10000
@ -755,7 +757,8 @@ else:
rule build_heat_demands:
input:
pop_layout="resources/" + RDIR + "pop_layout_{scope}.nc",
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson"
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
cutout="cutouts/" + CDIR + config["atlite"]["default_cutout"] + ".nc",
output:
heat_demand="resources/" + RDIR + "heat_demand_{scope}_elec_s{simpl}_{clusters}.nc"
resources: mem_mb=20000
@ -767,7 +770,8 @@ rule build_heat_demands:
rule build_temperature_profiles:
input:
pop_layout="resources/" + RDIR + "pop_layout_{scope}.nc",
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson"
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
cutout="cutouts/" + CDIR + config["atlite"]["default_cutout"] + ".nc",
output:
temp_soil="resources/" + RDIR + "temp_soil_{scope}_elec_s{simpl}_{clusters}.nc",
temp_air="resources/" + RDIR + "temp_air_{scope}_elec_s{simpl}_{clusters}.nc",
@ -800,7 +804,8 @@ rule build_cop_profiles:
rule build_solar_thermal_profiles:
input:
pop_layout="resources/" + RDIR + "pop_layout_{scope}.nc",
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson"
regions_onshore="resources/" + RDIR + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
cutout="cutouts/" + CDIR + config["atlite"]["default_cutout"] + ".nc",
output:
solar_thermal="resources/" + RDIR + "solar_thermal_{scope}_elec_s{simpl}_{clusters}.nc",
resources: mem_mb=20000

View File

@ -138,7 +138,7 @@ electricity:
atlite:
cutout: ../pypsa-eur/cutouts/europe-2013-era5.nc
default_cutout: europe-2013-era5
nprocesses: 4
show_progress: false # false saves time
cutouts:

View File

@ -18,7 +18,7 @@ if __name__ == "__main__":
clusters=48,
)
cutout = atlite.Cutout(snakemake.config["atlite"]["cutout"])
cutout = atlite.Cutout(snakemake.input.cutout)
clustered_regions = (
gpd.read_file(snakemake.input.regions_onshore)

View File

@ -25,8 +25,7 @@ if __name__ == "__main__":
client = Client(cluster, asynchronous=True)
time = pd.date_range(freq="h", **snakemake.config["snapshots"])
cutout_config = snakemake.config["atlite"]["cutout"]
cutout = atlite.Cutout(cutout_config).sel(time=time)
cutout = atlite.Cutout(snakemake.input.cutout).sel(time=time)
clustered_regions = (
gpd.read_file(snakemake.input.regions_onshore)

View File

@ -23,7 +23,7 @@ if __name__ == "__main__":
logging.basicConfig(level=snakemake.config["logging"]["level"])
cutout = atlite.Cutout(snakemake.config["atlite"]["cutout"])
cutout = atlite.Cutout(snakemake.input.cutout)
grid_cells = cutout.grid.geometry

View File

@ -220,7 +220,7 @@ if __name__ == "__main__":
cluster = LocalCluster(n_workers=nprocesses, threads_per_worker=1)
client = Client(cluster, asynchronous=True)
cutout = atlite.Cutout(snakemake.input["cutout"])
cutout = atlite.Cutout(snakemake.input.cutout)
regions = gpd.read_file(snakemake.input.regions)
assert not regions.empty, (
f"List of regions in {snakemake.input.regions} is empty, please "

View File

@ -27,8 +27,7 @@ if __name__ == "__main__":
config = snakemake.config["solar_thermal"]
time = pd.date_range(freq="h", **snakemake.config["snapshots"])
cutout_config = snakemake.config["atlite"]["cutout"]
cutout = atlite.Cutout(cutout_config).sel(time=time)
cutout = atlite.Cutout(snakemake.input.cutout).sel(time=time)
clustered_regions = (
gpd.read_file(snakemake.input.regions_onshore)

View File

@ -25,8 +25,7 @@ if __name__ == "__main__":
client = Client(cluster, asynchronous=True)
time = pd.date_range(freq="h", **snakemake.config["snapshots"])
cutout_config = snakemake.config["atlite"]["cutout"]
cutout = atlite.Cutout(cutout_config).sel(time=time)
cutout = atlite.Cutout(snakemake.input.cutout).sel(time=time)
clustered_regions = (
gpd.read_file(snakemake.input.regions_onshore)