Skip to content

Commit

Permalink
fix: use TransformProfile when we add new plants, even without scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Dec 9, 2020
1 parent 688866f commit 2283056
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions powersimdata/scenario/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,10 @@ def prepare_profile(self, kind, profile_as=None):
profile = TransformProfile(
self._data_access, self._scenario_info, self.grid, self.ct
)
if bool(profile.scale_keys[kind] & set(self.ct.keys())):
self._prepare_scaled_profile(kind, profile)
if "new_plant" in self.ct.keys():
new_plant_types = {plant["type"] for plant in self.ct["new_plant"]}
if bool(profile.scale_keys[kind] & (new_plant_types | set(self.ct.keys()))):
self._prepare_transformed_profile(kind, profile)
else:
self._create_link_to_base_profile(kind)
else:
Expand Down Expand Up @@ -432,7 +434,7 @@ def _create_link_to_base_profile(self, kind):
if len(stderr.readlines()) != 0:
raise IOError("Failed to create link to %s profile." % kind)

def _prepare_scaled_profile(self, kind, profile):
def _prepare_transformed_profile(self, kind, profile):
"""Loads, scales and writes on local machine a base profile.
:param powersimdata.input.transform_profile.TransformProfile profile: a
Expand Down

0 comments on commit 2283056

Please sign in to comment.