Skip to content

Commit

Permalink
feat: update to pollination-honeybee-radiance:0.5.0
Browse files Browse the repository at this point in the history
- added input to filter sensor grids
- update tasks to work with the new functions
- added support for models with sensor grid groups
  • Loading branch information
mostaphaRoudsari committed Feb 19, 2021
1 parent f67b5b4 commit 001e34b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
16 changes: 8 additions & 8 deletions pollination/annual_daylight/_raytracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pollination.honeybee_radiance.grid import SplitGrid, MergeFiles
from pollination.honeybee_radiance.contrib import DaylightContribution
from pollination.honeybee_radiance.coefficient import DaylightCoefficient
from pollination.honeybee_radiance.sky import AddRemoveSkyMatrixWithConversion
from pollination.honeybee_radiance.sky import AddRemoveSkyMatrix


@dataclass
Expand All @@ -21,7 +21,7 @@ class AnnualDaylightRayTracing(DAG):

radiance_parameters = Inputs.str(
description='The radiance parameters for ray tracing',
default='-ab 2'
default='-ab 2 -ad 5000 -lw 2e-05'
)

octree_file_with_suns = Inputs.file(
Expand Down Expand Up @@ -75,7 +75,7 @@ def split_grid(self, sensor_count=sensor_count, input_grid=sensor_grid):
def direct_sunlight(
self,
radiance_parameters=radiance_parameters,
fixed_radiance_parameters='-aa 0.0 -I -fad -ab 0 -dc 1.0 -dt 0.0 -dj 0.0 -dr 0',
fixed_radiance_parameters='-aa 0.0 -I -faf -ab 0 -dc 1.0 -dt 0.0 -dj 0.0 -dr 0',
sensor_count='{{item.count}}', modifiers=sun_modifiers,
sensor_grid=split_grid._outputs.output_folder,
scene_file=octree_file_with_suns
Expand All @@ -95,7 +95,7 @@ def direct_sunlight(
def direct_sky(
self,
radiance_parameters=radiance_parameters,
fixed_radiance_parameters='-aa 0.0 -I -ab 1 -c 1 -fad',
fixed_radiance_parameters='-aa 0.0 -I -ab 1 -c 1 -faf',
sensor_count='{{item.count}}',
sky_matrix=sky_matrix_direct, sky_dome=sky_dome,
sensor_grid=split_grid._outputs.output_folder,
Expand All @@ -116,7 +116,7 @@ def direct_sky(
def total_sky(
self,
radiance_parameters=radiance_parameters,
fixed_radiance_parameters='-aa 0.0 -I -c 1 -fad',
fixed_radiance_parameters='-aa 0.0 -I -c 1 -faf',
sensor_count='{{item.count}}',
sky_matrix=sky_matrix, sky_dome=sky_dome,
sensor_grid=split_grid._outputs.output_folder,
Expand All @@ -130,7 +130,7 @@ def total_sky(
]

@task(
template=AddRemoveSkyMatrixWithConversion,
template=AddRemoveSkyMatrix,
needs=[split_grid, direct_sunlight, total_sky, direct_sky],
loop=split_grid._outputs.grids_list, sub_folder='final'
)
Expand All @@ -139,11 +139,11 @@ def output_matrix_math(
direct_sky_matrix='direct_sky/{{item.name}}.ill',
total_sky_matrix='total_sky/{{item.name}}.ill',
sunlight_matrix='direct_sunlight/{{item.name}}.ill',

conversion='47.4 119.9 11.6'
):
return [
{
'from': AddRemoveSkyMatrixWithConversion()._outputs.results_file,
'from': AddRemoveSkyMatrix()._outputs.results_file,
'to': '{{item.name}}.ill'
}
]
Expand Down
17 changes: 12 additions & 5 deletions pollination/annual_daylight/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class AnnualDaylightEntryPoint(DAG):
default='-ab 2 -ad 5000 -lw 2e-05'
)

sensor_grid = Inputs.str(
description='A grid name or a pattern to filter the sensor grids. By default '
'all the grids in HBJSON model will be exported.', default='*'
)

model = Inputs.file(
description='A Honeybee model in HBJSON file format.',
extensions=['json', 'hbjson'],
Expand All @@ -62,7 +67,7 @@ def generate_sunpath(self, north=north, wea=wea):
]

@task(template=CreateRadianceFolder)
def create_rad_folder(self, input_model=model):
def create_rad_folder(self, input_model=model, sensor_grid=sensor_grid):
"""Translate the input model to a radiance folder."""
return [
{'from': CreateRadianceFolder()._outputs.model_folder, 'to': 'model'},
Expand Down Expand Up @@ -109,13 +114,15 @@ def create_sky_dome(self):
]

@task(template=CreateSkyMatrix)
def create_total_sky(self, north=north, wea=wea):
def create_total_sky(self, north=north, wea=wea, sun_up_hours='sun-up-hours'):
return [
{'from': CreateSkyMatrix()._outputs.sky_matrix, 'to': 'resources/sky.mtx'}
]

@task(template=CreateSkyMatrix)
def create_direct_sky(self, north=north, wea=wea, sky_component='-d'):
def create_direct_sky(
self, north=north, wea=wea, sky_type='sun-only', sun_up_hours='sun-up-hours'
):
return [
{
'from': CreateSkyMatrix()._outputs.sky_matrix,
Expand All @@ -140,15 +147,15 @@ def parse_sun_up_hours(self, sun_modifiers=generate_sunpath._outputs.sun_modifie
],
loop=create_rad_folder._outputs.sensor_grids,
sub_folder='initial_results/{{item.name}}', # create a subfolder for each grid
sub_paths={'sensor_grid': 'grid/{{item.name}}.pts'} # sub_path for sensor_grid arg
sub_paths={'sensor_grid': 'grid/{{item.full_id}}.pts'} # sub_path for sensor_grid arg
)
def annual_daylight_raytracing(
self,
sensor_count=sensor_count,
radiance_parameters=radiance_parameters,
octree_file_with_suns=create_octree_with_suns._outputs.scene_file,
octree_file=create_octree._outputs.scene_file,
grid_name='{{item.name}}',
grid_name='{{item.full_id}}',
sensor_grid=create_rad_folder._outputs.model_folder,
sky_matrix=create_total_sky._outputs.sky_matrix,
sky_dome=create_sky_dome._outputs.sky_dome,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pollination-honeybee-radiance==0.4.7
pollination-honeybee-radiance==0.5.0
pollination-alias==0.2.1

0 comments on commit 001e34b

Please sign in to comment.