Merge pull request #709 from PyPSA/bugfix-time
build_renewable_profiles considers subsets of cutout time scope
This commit is contained in:
commit
319c18b0d4
@ -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])
|
||||||
|
@ -186,6 +186,7 @@ import time
|
|||||||
import atlite
|
import atlite
|
||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
import xarray as xr
|
import xarray as xr
|
||||||
from _helpers import configure_logging
|
from _helpers import configure_logging
|
||||||
from dask.distributed import Client
|
from dask.distributed import Client
|
||||||
@ -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 "
|
||||||
@ -372,4 +374,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)
|
||||||
|
|
||||||
|
if client is not None:
|
||||||
client.shutdown()
|
client.shutdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user