From 001e34b6ab4edf363e4f1b2c517865bc543ca636 Mon Sep 17 00:00:00 2001 From: Mostapha Date: Fri, 19 Feb 2021 18:26:01 -0500 Subject: [PATCH] feat: update to pollination-honeybee-radiance:0.5.0 - added input to filter sensor grids - update tasks to work with the new functions - added support for models with sensor grid groups --- pollination/annual_daylight/_raytracing.py | 16 ++++++++-------- pollination/annual_daylight/entry.py | 17 ++++++++++++----- requirements.txt | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pollination/annual_daylight/_raytracing.py b/pollination/annual_daylight/_raytracing.py index 2bfb961..6894cc8 100644 --- a/pollination/annual_daylight/_raytracing.py +++ b/pollination/annual_daylight/_raytracing.py @@ -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 @@ -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( @@ -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 @@ -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, @@ -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, @@ -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' ) @@ -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' } ] diff --git a/pollination/annual_daylight/entry.py b/pollination/annual_daylight/entry.py index 6b6d4e4..c4f0fdb 100644 --- a/pollination/annual_daylight/entry.py +++ b/pollination/annual_daylight/entry.py @@ -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'], @@ -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'}, @@ -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, @@ -140,7 +147,7 @@ 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, @@ -148,7 +155,7 @@ def annual_daylight_raytracing( 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, diff --git a/requirements.txt b/requirements.txt index 3234654..5a8797e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pollination-honeybee-radiance==0.4.7 +pollination-honeybee-radiance==0.5.0 pollination-alias==0.2.1