bugfixes and allow build_renewable_profiles on subset of cutout time scope
This commit is contained in:
parent
4bc60e42e4
commit
ef05d7576c
@ -233,7 +233,7 @@ rule determine_availability_matrix_MD_UA:
|
|||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/environment.yaml"
|
||||||
script:
|
script:
|
||||||
"scripts/determine_availability_matrix_MD_UA.py"
|
"../scripts/determine_availability_matrix_MD_UA.py"
|
||||||
|
|
||||||
|
|
||||||
# Optional input when having Ukraine (UA) or Moldova (MD) in the countries list
|
# Optional input when having Ukraine (UA) or Moldova (MD) in the countries list
|
||||||
|
@ -149,7 +149,8 @@ if __name__ == "__main__":
|
|||||||
configure_logging(snakemake)
|
configure_logging(snakemake)
|
||||||
|
|
||||||
n = pypsa.Network(snakemake.input.base_network)
|
n = pypsa.Network(snakemake.input.base_network)
|
||||||
cutout = atlite.Cutout(snakemake.input.cutout)
|
time = pd.date_range(freq="h", **snakemake.config["snapshots"])
|
||||||
|
cutout = atlite.Cutout(snakemake.input.cutout).sel(time=time)
|
||||||
|
|
||||||
da = calculate_line_rating(n, cutout)
|
da = calculate_line_rating(n, cutout)
|
||||||
da.to_netcdf(snakemake.output[0])
|
da.to_netcdf(snakemake.output[0])
|
||||||
|
@ -185,6 +185,7 @@ import time
|
|||||||
|
|
||||||
import atlite
|
import atlite
|
||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import xarray as xr
|
import xarray as xr
|
||||||
from _helpers import configure_logging
|
from _helpers import configure_logging
|
||||||
@ -222,7 +223,8 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
client = None
|
client = None
|
||||||
|
|
||||||
cutout = atlite.Cutout(snakemake.input.cutout)
|
sns = pd.date_range(freq="h", **snakemake.config["snapshots"])
|
||||||
|
cutout = atlite.Cutout(snakemake.input.cutout).sel(time=sns)
|
||||||
regions = gpd.read_file(snakemake.input.regions)
|
regions = gpd.read_file(snakemake.input.regions)
|
||||||
assert not regions.empty, (
|
assert not regions.empty, (
|
||||||
f"List of regions in {snakemake.input.regions} is empty, please "
|
f"List of regions in {snakemake.input.regions} is empty, please "
|
||||||
@ -380,4 +382,6 @@ if __name__ == "__main__":
|
|||||||
ds["profile"] = ds["profile"].where(ds["profile"] >= min_p_max_pu, 0)
|
ds["profile"] = ds["profile"].where(ds["profile"] >= min_p_max_pu, 0)
|
||||||
|
|
||||||
ds.to_netcdf(snakemake.output.profile)
|
ds.to_netcdf(snakemake.output.profile)
|
||||||
client.shutdown()
|
|
||||||
|
if client is not None:
|
||||||
|
client.shutdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user