Skip to content

Commit

Permalink
fix(entry): Add visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp committed Jan 9, 2025
1 parent e2d83aa commit b70a092
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
61 changes: 61 additions & 0 deletions pollination/leed_daylight_option_one/_visualization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from dataclasses import dataclass
from pollination_dsl.dag import Inputs, GroupedDAG, task, Outputs
from pollination.honeybee_display.translate import ModelToVis
from pollination.path.copy import CopyFolder
from pollination.honeybee_radiance_postprocess.leed import DaylightOptionOneVisMetadata


@dataclass
class DaylightOptionOneVisualization(GroupedDAG):
"""Create visualization."""

# inputs
model = Inputs.file(
description='Input Honeybee model.',
extensions=['json', 'hbjson', 'pkl', 'hbpkl', 'zip']
)

pass_fail = Inputs.folder(
description='Pass/fail results.',
path='results'
)

@task(template=CopyFolder)
def copy_pass_fail(self, src=pass_fail):
return [
{
'from': CopyFolder()._outputs.dst,
'to': 'visualization'
}
]

@task(
template=DaylightOptionOneVisMetadata,
)
def create_vis_metadata(self):
return [
{
'from': DaylightOptionOneVisMetadata()._outputs.vis_metadata_folder,
'to': 'visualization'
}
]

@task(
template=ModelToVis,
needs=[copy_pass_fail, create_vis_metadata]
)
def create_vsf(
self, model=model, grid_data='visualization',
active_grid_data='DA', output_format='vsf'
):
return [
{
'from': ModelToVis()._outputs.output_file,
'to': 'visualization.vsf'
}
]

visualization = Outputs.file(
source='visualization.vsf',
description='Visualization in VisualizationSet format.'
)
25 changes: 25 additions & 0 deletions pollination/leed_daylight_option_one/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
daylight_autonomy_results, leed_one_hourly_pct_above_results, \
leed_one_shade_transmittance_results

from ._visualization import DaylightOptionOneVisualization


@dataclass
class LeedDaylightOptionIEntryPoint(DAG):
Expand Down Expand Up @@ -132,6 +134,29 @@ def leed_daylight_option_one(
}
]

@task(
template=DaylightOptionOneVisualization,
needs=[run_two_phase_daylight_coefficient, leed_daylight_option_one],
sub_paths={
'pass_fail': 'pass_fail'
}
)
def create_visualization(
self, model=model, pass_fail=leed_daylight_option_one._outputs.leed_summary
):
return [
{
'from': DaylightOptionOneVisualization()._outputs.visualization,
'to': 'visualization.vsf'
}
]


visualization = Outputs.file(
source='visualization.vsf',
description='Visualization in VisualizationSet format.'
)

results = Outputs.folder(
source='results', description='Folder with raw result files (.ill) that '
'contain illuminance matrices for each sensor at each timestep of the analysis.'
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pollination-two-phase-daylight-coefficient==1.1.33
pollination-honeybee-display==0.1.17

0 comments on commit b70a092

Please sign in to comment.