build_renewable_profile: fix execution for one thread
This commit is contained in:
parent
f4847ba907
commit
701231fdca
@ -59,6 +59,9 @@ rule build_powerplants:
|
||||
|
||||
|
||||
rule base_network:
|
||||
params:
|
||||
countries=config["countries"],
|
||||
snapshots=config["snapshots"],
|
||||
input:
|
||||
eg_buses="data/entsoegridkit/buses.csv",
|
||||
eg_lines="data/entsoegridkit/lines.csv",
|
||||
|
@ -19,8 +19,6 @@ if config["enable"].get("retrieve_databundle", True):
|
||||
datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"])
|
||||
|
||||
rule retrieve_databundle:
|
||||
params:
|
||||
tutorial=config["tutorial"],
|
||||
output:
|
||||
expand("data/bundle/{file}", file=datafiles),
|
||||
log:
|
||||
|
@ -188,7 +188,7 @@ import geopandas as gpd
|
||||
import numpy as np
|
||||
import xarray as xr
|
||||
from _helpers import configure_logging
|
||||
from dask.distributed import Client, LocalCluster
|
||||
from dask.distributed import Client
|
||||
from pypsa.geo import haversine
|
||||
from shapely.geometry import LineString
|
||||
|
||||
@ -218,8 +218,7 @@ if __name__ == "__main__":
|
||||
logger.info(f"correction_factor is set as {correction_factor}")
|
||||
|
||||
if nprocesses > 1:
|
||||
# cluster = LocalCluster(n_workers=nprocesses, threads_per_worker=1)
|
||||
client = Client(n_workers=2, threads_per_worker=2, memory_limit="1GB")
|
||||
client = Client(n_workers=nprocesses, threads_per_worker=1)
|
||||
else:
|
||||
client = None
|
||||
|
||||
@ -293,7 +292,8 @@ if __name__ == "__main__":
|
||||
|
||||
potential = capacity_per_sqkm * availability.sum("bus") * area
|
||||
func = getattr(cutout, resource.pop("method"))
|
||||
resource["dask_kwargs"] = {"scheduler": client}
|
||||
if client is not None:
|
||||
resource["dask_kwargs"] = {"scheduler": client}
|
||||
capacity_factor = correction_factor * func(capacity_factor=True, **resource)
|
||||
layout = capacity_factor * area * capacity_per_sqkm
|
||||
profile, capacities = func(
|
||||
|
@ -53,7 +53,7 @@ if __name__ == "__main__":
|
||||
snakemake
|
||||
) # TODO Make logging compatible with progressbar (see PR #102)
|
||||
|
||||
if snakemake.params.tutorial:
|
||||
if snakemake.config["tutorial"]:
|
||||
url = "https://zenodo.org/record/3517921/files/pypsa-eur-tutorial-data-bundle.tar.xz"
|
||||
else:
|
||||
url = "https://zenodo.org/record/3517935/files/pypsa-eur-data-bundle.tar.xz"
|
||||
|
Loading…
Reference in New Issue
Block a user