[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-05-10 08:09:43 +00:00
parent e91068196b
commit b21965a986
2 changed files with 6 additions and 5 deletions

View File

@ -85,17 +85,17 @@ It further adds extendable ``generators`` with **zero** capacity for
"""
import logging
from itertools import product
import geopandas as gpd
import numpy as np
import pandas as pd
import powerplantmatching as pm
import pypsa
import scipy.sparse as sparse
import xarray as xr
from _helpers import configure_logging, update_p_nom_max
from powerplantmatching.export import map_country_bus
from itertools import product
import scipy.sparse as sparse
from shapely.prepared import prep
idx = pd.IndexSlice
@ -217,6 +217,7 @@ def load_powerplants(ppl_fn):
.replace({"carrier": carrier_dict})
)
def Shapes2Shapes(orig, dest):
"""
Adopted from vresutils.transfer.Shapes2Shapes()
@ -224,10 +225,10 @@ def Shapes2Shapes(orig, dest):
orig_prepped = list(map(prep, orig))
transfer = sparse.lil_matrix((len(dest), len(orig)), dtype=float)
for i,j in product(range(len(dest)), range(len(orig))):
for i, j in product(range(len(dest)), range(len(orig))):
if orig_prepped[j].intersects(dest[i]):
area = orig[j].intersection(dest[i]).area
transfer[i,j] = area/dest[i].area
transfer[i, j] = area / dest[i].area
return transfer

View File

@ -22,13 +22,13 @@ from _helpers import (
override_component_attrs,
update_config_with_sector_opts,
)
from add_electricity import calculate_annuity
from build_energy_totals import build_co2_totals, build_eea_co2, build_eurostat_co2
from networkx.algorithms import complement
from networkx.algorithms.connectivity.edge_augmentation import k_edge_augmentation
from pypsa.geo import haversine_pts
from pypsa.io import import_components_from_dataframe
from scipy.stats import beta
from add_electricity import calculate_annuity
logger = logging.getLogger(__name__)