Skip to content

Commit

Permalink
Merge pull request #149 from PyPSA/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Hofmann authored Jan 29, 2024
2 parents 15a6159 + ee6541a commit f3680e2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
hooks:
- id: check-yaml
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
Expand Down
6 changes: 3 additions & 3 deletions powerplantmatching/cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ def clean_technology(df, generalize_hydros=False):
tech[tech.str.contains("dam", case=False)] = "Reservoir"
tech = tech.replace({"Gas turbine": "OCGT"})
tech[tech.str.contains("combined cycle|combustion", case=False)] = "CCGT"
tech[
tech.str.contains("steam turbine|critical thermal", case=False)
] = "Steam Turbine"
tech[tech.str.contains("steam turbine|critical thermal", case=False)] = (
"Steam Turbine"
)
tech[tech.str.contains("ocgt|open cycle", case=False)] = "OCGT"
tech = (
tech.str.title()
Expand Down
12 changes: 6 additions & 6 deletions powerplantmatching/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,9 @@ def WEPP(raw=False, config=None):
wepp.Turbtype.fillna("", inplace=True)
# Correct technology infos:
wepp.loc[wepp.Technology.str.contains("LIG", case=False), "Fueltype"] = "Lignite"
wepp.loc[
wepp.Turbtype.str.contains("KAPLAN|BULB", case=False), "Technology"
] = "Run-Of-River"
wepp.loc[wepp.Turbtype.str.contains("KAPLAN|BULB", case=False), "Technology"] = (
"Run-Of-River"
)
wepp.Technology = wepp.Technology.replace(
{
"CONV/PS": "Pumped Storage",
Expand Down Expand Up @@ -1367,9 +1367,9 @@ def BNETZA(
"Pumpspeicher": "Pumped Storage",
}
for fuel in techmap:
bnetza.loc[
bnetza.Fueltype.str.contains(fuel, case=False), "Technology"
] = techmap[fuel]
bnetza.loc[bnetza.Fueltype.str.contains(fuel, case=False), "Technology"] = (
techmap[fuel]
)
# Fueltypes
bnetza.Fueltype.replace(
{
Expand Down
8 changes: 5 additions & 3 deletions powerplantmatching/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ def to_TIMES(df=None, use_scaled_capacity=False, baseyear=2015):
# are being filtered.
elif yr > baseyear:
series = ct_group.apply(
lambda x: x[cap_column]
if yr >= x["DateIn"] and yr <= x["YearRetire"]
else 0,
lambda x: (
x[cap_column]
if yr >= x["DateIn"] and yr <= x["YearRetire"]
else 0
),
axis=1,
)
else:
Expand Down
18 changes: 9 additions & 9 deletions powerplantmatching/heuristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def fill_missing_duration(df):
mean_duration = df[df.Set == "Store"].groupby("Fueltype").Duration.mean()
df = get_obj_if_Acc(df)
for store in mean_duration.index:
df.loc[
(df["Set"] == "Store") & (df["Fueltype"] == store), "Duration"
] = mean_duration.at[store]
df.loc[(df["Set"] == "Store") & (df["Fueltype"] == store), "Duration"] = (
mean_duration.at[store]
)
return df


Expand Down Expand Up @@ -482,13 +482,13 @@ def set_denmark_region_id(df):
# Workaround:
df.loc[(df.Country == "Denmark") & (df.lon >= 10.96), "Region"] = "DKE"
df.loc[(df.Country == "Denmark") & (df.lon < 10.96), "Region"] = "DKW"
df.loc[
df.Name.str.contains("Jegerspris", case=False).fillna(False), "Region"
] = "DKE"
df.loc[df.Name.str.contains("Jegerspris", case=False).fillna(False), "Region"] = (
"DKE"
)
df.loc[df.Name.str.contains("Jetsmark", case=False).fillna(False), "Region"] = "DKW"
df.loc[
df.Name.str.contains("Fellinggard", case=False).fillna(False), "Region"
] = "DKW"
df.loc[df.Name.str.contains("Fellinggard", case=False).fillna(False), "Region"] = (
"DKW"
)
# Copy the remaining ones without Region and handle in copy
dk_o = df.loc[(df.Country == "Denmark") & (df.Region.isnull())].reset_index(
drop=True
Expand Down

0 comments on commit f3680e2

Please sign in to comment.