Skip to content

Commit

Permalink
Run black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
gnn committed Nov 10, 2022
1 parent 482466e commit b075f0f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 43 deletions.
1 change: 0 additions & 1 deletion src/egon/data/datasets/DSM_cts_ind.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ def dsm_cts_ind(
ind_cool_vent_share=0.039,
ind_vent_share=0.017,
):

"""
Execute methodology to create and implement components for DSM considering
a) CTS per osm-area: combined potentials of cooling, ventilation and air conditioning
Expand Down
7 changes: 4 additions & 3 deletions src/egon/data/datasets/chp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
(CHP) plants.
"""

from pathlib import Path

from geoalchemy2 import Geometry
from shapely.ops import nearest_points
from sqlalchemy import Boolean, Column, Float, Integer, Sequence, String
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.declarative import declarative_base
import geopandas as gpd
import pandas as pd
import pypsa

from egon.data import config, db
from egon.data.datasets import Dataset
Expand All @@ -18,6 +21,7 @@
assign_use_case,
existing_chp_smaller_10mw,
extension_per_federal_state,
extension_to_areas,
select_target,
)
from egon.data.datasets.power_plants import (
Expand All @@ -26,9 +30,6 @@
filter_mastr_geometry,
scale_prox2now,
)
import pypsa
from egon.data.datasets.chp.small_chp import extension_to_areas
from pathlib import Path

Base = declarative_base()

Expand Down
17 changes: 10 additions & 7 deletions src/egon/data/datasets/electrical_neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import zipfile

import geopandas as gpd
import pandas as pd
from shapely.geometry import LineString
from sqlalchemy.orm import sessionmaker
import geopandas as gpd
import pandas as pd

import egon.data.datasets.etrago_setup as etrago
import egon.data.datasets.scenario_parameters.parameters as scenario_parameters
from egon.data import config, db
from egon.data.datasets import Dataset
from egon.data.datasets.fill_etrago_gen import add_marginal_costs
from egon.data.datasets.scenario_parameters import get_sector_parameters
import egon.data.datasets.etrago_setup as etrago
import egon.data.datasets.scenario_parameters.parameters as scenario_parameters


class ElectricalNeighbours(Dataset):
Expand Down Expand Up @@ -1082,9 +1082,12 @@ def insert_storage(capacities, session=None):
)

# Add columns for additional parameters to df
store["dispatch"], store["store"], store["standing_loss"], store[
"max_hours"
] = (None, None, None, None)
(
store["dispatch"],
store["store"],
store["standing_loss"],
store["max_hours"],
) = (None, None, None, None)

# Insert carrier specific parameters

Expand Down
9 changes: 1 addition & 8 deletions src/egon/data/datasets/power_plants/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
"""The central module containing all code dealing with power plant data.
"""
from geoalchemy2 import Geometry
from sqlalchemy import (
BigInteger,
Column,
Float,
Integer,
Sequence,
String,
)
from sqlalchemy import BigInteger, Column, Float, Integer, Sequence, String
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Expand Down
2 changes: 1 addition & 1 deletion src/egon/data/datasets/renewable_feedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def heat_pump_cop():

# Calculate coefficient of performance for air sourced heat pumps
# according to Brown et. al
cop = 6.81 - 0.121 * delta_t + 0.00063 * delta_t ** 2
cop = 6.81 - 0.121 * delta_t + 0.00063 * delta_t**2

df = pd.DataFrame(
index=temperature.to_pandas().index,
Expand Down
20 changes: 11 additions & 9 deletions src/egon/data/datasets/scenario_capacities.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def create_table():


def nuts_mapping():

nuts_mapping = {
"BW": "DE1",
"NW": "DEA",
Expand Down Expand Up @@ -157,13 +156,15 @@ def insert_capacities_per_federal_state_nep():
df_windoff = pd.read_excel(
target_file,
sheet_name="WInd_Offshore_NEP",
).dropna(subset=['Bundesland', 'Netzverknuepfungspunkt'])
).dropna(subset=["Bundesland", "Netzverknuepfungspunkt"])

# Remove trailing whitespace from column Bundesland
df_windoff['Bundesland']= df_windoff['Bundesland'].str.strip()
df_windoff["Bundesland"] = df_windoff["Bundesland"].str.strip()

# Group and sum capacities per federal state
df_windoff_fs = df_windoff[['Bundesland', 'C 2035']].groupby(['Bundesland']).sum()
df_windoff_fs = (
df_windoff[["Bundesland", "C 2035"]].groupby(["Bundesland"]).sum()
)

# List federal state with an assigned wind offshore capacity
index_list = list(df_windoff_fs.index.values)
Expand All @@ -172,9 +173,9 @@ def insert_capacities_per_federal_state_nep():
# df_windoff_fs

for state in index_list:

df.at['Wind offshore', state] = df_windoff_fs.at[state, 'C 2035']/1000

df.at["Wind offshore", state] = (
df_windoff_fs.at[state, "C 2035"] / 1000
)

# sort NEP-carriers:
rename_carrier = {
Expand Down Expand Up @@ -216,7 +217,6 @@ def insert_capacities_per_federal_state_nep():
]

for bl in map_nuts.index:

data = pd.DataFrame(df[bl])

# if distribution to federal states is not provided,
Expand Down Expand Up @@ -687,7 +687,9 @@ def eGon100_capacities():
df.p_nom[f"residential_{merge_carrier}"]
+ df.p_nom[f"services_{merge_carrier}"]
),
"component": df.component[f"residential_{merge_carrier}"],
"component": df.component[
f"residential_{merge_carrier}"
],
},
)
)
Expand Down
28 changes: 14 additions & 14 deletions src/egon/data/datasets/storages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"""The central module containing all code dealing with power plant data.
"""
from geoalchemy2 import Geometry
from pathlib import Path

from geoalchemy2 import Geometry
from sqlalchemy import BigInteger, Column, Float, Integer, Sequence, String
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from egon.data.datasets.storages.pumped_hydro import (
select_mastr_pumped_hydro,
select_nep_pumped_hydro,
match_storage_units,
get_location,
apply_voltage_level_thresholds,
)
from egon.data.datasets.power_plants import assign_voltage_level
import geopandas as gpd
import pandas as pd

from egon.data import db, config
from egon.data import config, db
from egon.data.datasets import Dataset

from egon.data.datasets.power_plants import assign_voltage_level
from egon.data.datasets.storages.pumped_hydro import (
apply_voltage_level_thresholds,
get_location,
match_storage_units,
select_mastr_pumped_hydro,
select_nep_pumped_hydro,
)

Base = declarative_base()

Expand Down Expand Up @@ -353,9 +353,9 @@ def home_batteries_per_scenario(scenario):
sheet_name="1.Entwurf_NEP2035_V2021",
index_col="Unnamed: 0",
)
# Select target value in MW
target = capacities_nep.Summe["PV-Batteriespeicher"]*1000

# Select target value in MW
target = capacities_nep.Summe["PV-Batteriespeicher"] * 1000

else:
target = db.select_dataframe(
Expand Down

0 comments on commit b075f0f

Please sign in to comment.