Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/#762 too many deprecation warnings #763

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions etrago/cluster/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,20 +417,20 @@ def gas_postprocessing(etrago, busmap, medoid_idx=None):
},
one_port_strategies={
"Generator": {
"marginal_cost": np.mean,
"capital_cost": np.mean,
"p_nom_max": np.sum,
"p_nom_min": np.sum,
"e_nom_max": np.sum,
"marginal_cost": "mean",
"capital_cost": "mean",
"p_nom_max": "sum",
"p_nom_min": "sum",
"e_nom_max": "sum",
},
"Store": {
"marginal_cost": np.mean,
"capital_cost": np.mean,
"e_nom": np.sum,
"marginal_cost": "mean",
"capital_cost": "mean",
"e_nom": "sum",
"e_nom_max": sum_with_inf,
},
"Load": {
"p_set": np.sum,
"p_set": "sum",
},
},
)
Expand Down
80 changes: 40 additions & 40 deletions etrago/cluster/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,38 +121,38 @@ def strategies_lines():
def strategies_one_ports():
return {
"StorageUnit": {
"marginal_cost": np.mean,
"capital_cost": np.mean,
"efficiency_dispatch": np.mean,
"standing_loss": np.mean,
"efficiency_store": np.mean,
"p_min_pu": np.min,
"marginal_cost": "mean",
"capital_cost": "mean",
"efficiency_dispatch": "mean",
"standing_loss": "mean",
"efficiency_store": "mean",
"p_min_pu": "min",
"p_nom_extendable": ext_storage,
"p_nom_max": sum_with_inf,
},
"Store": {
"marginal_cost": np.mean,
"capital_cost": np.mean,
"standing_loss": np.mean,
"e_nom": np.sum,
"e_nom_min": np.sum,
"marginal_cost": "mean",
"capital_cost": "mean",
"standing_loss": "mean",
"e_nom": "sum",
"e_nom_min": "sum",
"e_nom_max": sum_with_inf,
"e_initial": np.sum,
"e_min_pu": np.mean,
"e_max_pu": np.mean,
"e_initial": "sum",
"e_min_pu": "mean",
"e_max_pu": "mean",
},
}


def strategies_generators():
return {
"p_nom_min": np.min,
"p_nom_min": "min",
"p_nom_max": sum_with_inf,
"weight": np.sum,
"p_nom": np.sum,
"p_nom_opt": np.sum,
"marginal_cost": np.mean,
"capital_cost": np.mean,
"weight": "sum",
"p_nom": "sum",
"p_nom_opt": "sum",
"marginal_cost": "mean",
"capital_cost": "mean",
"e_nom_max": sum_with_inf,
}

Expand All @@ -163,30 +163,30 @@ def strategies_links():
"bus0": _make_consense_links,
"bus1": _make_consense_links,
"carrier": _make_consense_links,
"p_nom": np.sum,
"p_nom": "sum",
"p_nom_extendable": _make_consense_links,
"p_nom_max": sum_with_inf,
"capital_cost": np.mean,
"length": np.mean,
"capital_cost": "mean",
"length": "mean",
"geom": nan_links,
"topo": nan_links,
"type": nan_links,
"efficiency": np.mean,
"p_nom_min": np.sum,
"p_set": np.mean,
"p_min_pu": np.min,
"p_max_pu": np.max,
"marginal_cost": np.mean,
"efficiency": "mean",
"p_nom_min": "sum",
"p_set": "mean",
"p_min_pu": "min",
"p_max_pu": "max",
"marginal_cost": "mean",
"terrain_factor": _make_consense_links,
"p_nom_opt": np.mean,
"p_nom_opt": "mean",
"country": nan_links,
"build_year": np.mean,
"lifetime": np.mean,
"min_up_time": np.mean,
"min_down_time": np.mean,
"up_time_before": np.mean,
"down_time_before": np.mean,
"committable": np.all,
"build_year": "mean",
"lifetime": "mean",
"min_up_time": "mean",
"min_down_time": "mean",
"up_time_before": "mean",
"down_time_before": "mean",
"committable": "all",
}


Expand Down Expand Up @@ -255,7 +255,7 @@ def arrange_dc_bus0_bus1(network):
strategies.pop("topo")
strategies.pop("geom")

new_df = links.groupby(grouper, axis=0).agg(strategies)
new_df = links.groupby(grouper).agg(strategies)
new_df.index = flatten_multiindex(new_df.index).rename("name")
new_df = pd.concat(
[new_df, network.links.loc[~links_agg_b]], axis=0, sort=False
Expand All @@ -275,7 +275,7 @@ def arrange_dc_bus0_bus1(network):
df_agg = df_agg.multiply(
weighting.loc[df_agg.columns], axis=1
)
pnl_df = df_agg.groupby(grouper, axis=1).sum()
pnl_df = df_agg.T.groupby(grouper).sum().T
pnl_df.columns = flatten_multiindex(pnl_df.columns).rename(
"name"
)
Expand Down Expand Up @@ -759,7 +759,7 @@ def kmedoids_dijkstra_clustering(
kmeans.fit(points)

busmap = pd.Series(
data=kmeans.predict(buses.loc[buses_i, ["x", "y"]]),
data=kmeans.predict(buses.loc[buses_i, ["x", "y"]].values),
index=buses_i,
dtype=object,
)
Expand Down
1 change: 1 addition & 0 deletions etrago/tools/shapes_europe/shapes_europe.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added etrago/tools/shapes_europe/shapes_europe.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions etrago/tools/shapes_europe/shapes_europe.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added etrago/tools/shapes_europe/shapes_europe.shp
Binary file not shown.
Binary file added etrago/tools/shapes_europe/shapes_europe.shx
Binary file not shown.
8 changes: 5 additions & 3 deletions etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from collections.abc import Mapping
from copy import deepcopy
from pathlib import Path
import json
import logging
import math
Expand Down Expand Up @@ -287,9 +288,10 @@ def buses_by_country(self, apply_on="grid_model"):
con = self.engine
germany_sh = gpd.read_postgis(query, con, geom_col="geometry")

path = gpd.datasets.get_path("naturalearth_lowres")
shapes = gpd.read_file(path)
shapes = shapes[shapes.name.isin([*countries])].set_index(keys="name")
# read Europe borders. Original data downloaded from naturalearthdata.com/
# under Public Domain license
path = Path(".") / "tools" / "shapes_europe"
shapes = gpd.read_file(path).set_index("name")

# Use Germany borders from egon-data if not using the SH test case
if len(germany_sh.gen.unique()) > 1:
Expand Down