Skip to content

Commit

Permalink
Merge branch 'dev' into revision/update_build_system
Browse files Browse the repository at this point in the history
  • Loading branch information
fwitte committed Jun 27, 2024
2 parents 20fc94d + 5006df1 commit 0ea6652
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ docs/_build
.build
.ve
.env
.venv/
.cache
.pytest
.benchmarks
.bootstrap
.appveyor.token
*.bak
venv/

# Mypy Cache
.mypy_cache/
4 changes: 3 additions & 1 deletion src/demandlib/bdew/elec_slp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def create_bdew_load_profiles(self, dt_index, slp_types, holidays=None):
tmp_df.set_index(index, inplace=True)

# Create empty DataFrame to take the results.
new_df = pd.DataFrame(index=dt_index, columns=slp_types, dtype=float).fillna(0)
new_df = pd.DataFrame(
index=dt_index, columns=slp_types, dtype=float
).fillna(0)
new_df = add_weekdays2df(
new_df, holidays=holidays, holiday_is_sunday=True
)
Expand Down
8 changes: 5 additions & 3 deletions src/demandlib/bdew/heat_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def __init__(self, df_index, **kwargs):
self.wind_class = kwargs.get("wind_class")
self.building_class = kwargs.get("building_class", 0)
# raise error if building class is not 0 for non-residential buildings
if (self.shlp_type not in ["EFH", "MFH"]) and (self.building_class != 0):
if (self.shlp_type not in ["EFH", "MFH"]) and (
self.building_class != 0
):
raise ValueError(
"Building class must be 0 for non-residential buildings"
)
)
self.ww_incl = kwargs.get("ww_incl", True)
self.name = kwargs.get("name", self.shlp_type)

Expand Down Expand Up @@ -284,7 +286,7 @@ def get_sigmoid_parameters(self, filename="shlp_sigmoid_factors.csv"):
if len(sigmoid) != 1:
raise ValueError(
wrong_number_of_parameters_message.format(len(sigmoid))
)
)

# get sigmoid parameters, avoid warning
a = sigmoid["parameter_a"].iloc[0]
Expand Down
5 changes: 4 additions & 1 deletion src/demandlib/tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tools needed by the main classes
"""

import pandas as pd


Expand Down Expand Up @@ -44,6 +45,8 @@ def add_weekdays2df(time_df, holidays=None, holiday_is_sunday=False):
)

if holiday_is_sunday:
time_df.weekday = time_df.weekday.mask(cond=time_df.weekday == 0, other=7)
time_df.weekday = time_df.weekday.mask(
cond=time_df.weekday == 0, other=7
)

return time_df

0 comments on commit 0ea6652

Please sign in to comment.