build_renewable_profiles: use dask client instead of kwargs
This commit is contained in:
parent
4e60e8d675
commit
d18867ce61
@ -189,6 +189,7 @@ import logging
|
|||||||
from pypsa.geo import haversine
|
from pypsa.geo import haversine
|
||||||
from shapely.geometry import LineString
|
from shapely.geometry import LineString
|
||||||
import time
|
import time
|
||||||
|
from dask.distributed import Client
|
||||||
|
|
||||||
from _helpers import configure_logging
|
from _helpers import configure_logging
|
||||||
|
|
||||||
@ -216,6 +217,7 @@ if __name__ == '__main__':
|
|||||||
if correction_factor != 1.:
|
if correction_factor != 1.:
|
||||||
logger.info(f'correction_factor is set as {correction_factor}')
|
logger.info(f'correction_factor is set as {correction_factor}')
|
||||||
|
|
||||||
|
client = Client(n_workers=nprocesses)
|
||||||
|
|
||||||
cutout = atlite.Cutout(snakemake.input['cutout'])
|
cutout = atlite.Cutout(snakemake.input['cutout'])
|
||||||
regions = gpd.read_file(snakemake.input.regions).set_index('name').rename_axis('bus')
|
regions = gpd.read_file(snakemake.input.regions).set_index('name').rename_axis('bus')
|
||||||
@ -266,7 +268,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
potential = capacity_per_sqkm * availability.sum('bus') * area
|
potential = capacity_per_sqkm * availability.sum('bus') * area
|
||||||
func = getattr(cutout, resource.pop('method'))
|
func = getattr(cutout, resource.pop('method'))
|
||||||
resource['dask_kwargs'] = {'num_workers': nprocesses}
|
# resource['dask_kwargs'] = {'num_workers': nprocesses, "scheduler": "threading"}
|
||||||
capacity_factor = correction_factor * func(capacity_factor=True, **resource)
|
capacity_factor = correction_factor * func(capacity_factor=True, **resource)
|
||||||
layout = capacity_factor * area * capacity_per_sqkm
|
layout = capacity_factor * area * capacity_per_sqkm
|
||||||
profile, capacities = func(matrix=availability.stack(spatial=['y','x']),
|
profile, capacities = func(matrix=availability.stack(spatial=['y','x']),
|
||||||
|
Loading…
Reference in New Issue
Block a user