Skip to content

Commit

Permalink
fix(dynamic): Add simplified option
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp committed Jul 18, 2023
1 parent 5043cb5 commit a57f849
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions honeybee_radiance_postprocess/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,17 @@ def filter_by_identifiers(self, identifiers):
filter_dyn_sch.add_aperture_group_schedule(group)
return filter_dyn_sch

def to_dict(self):
def to_dict(self, simplified=False):
"""Return DynamicSchedule as a dictionary."""
base = {}
for identifier, group in self.dynamic_schedule.items():
base[identifier] = group.to_dict()
if not simplified:
base[identifier] = group.to_dict()
else:
base[identifier] = group.to_dict()['schedule']
return base

def to_json(self, folder=None, file_name=None, indent=None):
def to_json(self, folder=None, file_name=None, indent=None, simplified=False):
"""Write a DynamicSchedule to JSON.
Args:
Expand All @@ -213,7 +216,7 @@ def to_json(self, folder=None, file_name=None, indent=None):
json_file: Path to JSON file.
"""
# create dictionary of the DynamicSchedule
dyn_sch_dict = self.to_dict()
dyn_sch_dict = self.to_dict(simplified=simplified)

# set up name and folder for the JSON
file_name = file_name if file_name else 'dynamic_schedule'
Expand Down

0 comments on commit a57f849

Please sign in to comment.