From d968f354b57ea8f2ab291d410a94a1730236a8da Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Wed, 9 Mar 2022 18:12:30 -0500 Subject: [PATCH] fix(thermal_map): Refactor DAGs to be more elegant an efficient --- .../comfort_mapping_entry_point.py | 2 +- .../dynamic_behavior_entry_point.py | 148 -------------- .../radiance_contrib_entry_point.py | 181 +++++++++++++---- .../dynamic_contribution_entry_point.py | 191 +++--------------- .../radiance_mapping_entry_point.py | 2 +- lbt_recipes/adaptive_comfort_map/flow/main.py | 20 +- lbt_recipes/adaptive_comfort_map/run.py | 2 +- .../comfort_mapping_entry_point.py | 2 +- .../dynamic_behavior_entry_point.py | 148 -------------- .../radiance_contrib_entry_point.py | 181 +++++++++++++---- .../dynamic_contribution_entry_point.py | 191 +++--------------- .../radiance_mapping_entry_point.py | 2 +- lbt_recipes/pmv_comfort_map/flow/main.py | 24 ++- lbt_recipes/pmv_comfort_map/package.json | 2 +- lbt_recipes/pmv_comfort_map/run.py | 2 +- 15 files changed, 371 insertions(+), 727 deletions(-) delete mode 100644 lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py delete mode 100644 lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py diff --git a/lbt_recipes/adaptive_comfort_map/flow/dependencies/comfort_mapping_entry_point.py b/lbt_recipes/adaptive_comfort_map/flow/dependencies/comfort_mapping_entry_point.py index 61db97cd..7c52eac7 100644 --- a/lbt_recipes/adaptive_comfort_map/flow/dependencies/comfort_mapping_entry_point.py +++ b/lbt_recipes/adaptive_comfort_map/flow/dependencies/comfort_mapping_entry_point.py @@ -598,7 +598,7 @@ def output_artifacts(self): }] -class _ComfortMappingEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask): +class _ComfortMappingEntryPoint_eb938b5bOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py b/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py deleted file mode 100644 index 9c42a30b..00000000 --- a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py +++ /dev/null @@ -1,148 +0,0 @@ -""" -This file is auto-generated from a Queenbee recipe. It is unlikely that -you should be editing this file directly. Instead try to edit the recipe -itself and regenerate the code. - -Contact the recipe maintainers with additional questions. - chris: chris@ladybug.tools - ladybug-tools: info@ladybug.tools - -This file is licensed under "PolyForm Shield License 1.0.0". -See https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt for more information. -""" - - -import luigi -import os -import pathlib -from queenbee_local import QueenbeeTask -from queenbee_local import load_input_param as qb_load_input_param - - -_default_inputs = { 'aperture_id': None, - 'direct_specular': None, - 'grid_name': None, - 'indirect_diffuse': None, - 'indirect_specular': None, - 'params_folder': '__params', - 'ref_diffuse': None, - 'ref_specular': None, - 'result_sql': None, - 'simulation_folder': '.', - 'sun_up_hours': None} - - -class CreateIrradianceContribMap(QueenbeeTask): - """Get .ill files with maps of irradiance contributions from dynamic windows.""" - - # DAG Input parameters - _input_params = luigi.DictParameter() - - # Task inputs - @property - def aperture_id(self): - return self._input_params['aperture_id'] - - @property - def name(self): - return self._input_params['grid_name'] - - @property - def result_sql(self): - value = pathlib.Path(self._input_params['result_sql']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def direct_specular(self): - value = pathlib.Path(self._input_params['direct_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_specular(self): - value = pathlib.Path(self._input_params['indirect_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_specular(self): - value = pathlib.Path(self._input_params['ref_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_diffuse(self): - value = pathlib.Path(self._input_params['indirect_diffuse']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_diffuse(self): - value = pathlib.Path(self._input_params['ref_diffuse']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def sun_up_hours(self): - value = pathlib.Path(self._input_params['sun_up_hours']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - def command(self): - return 'ladybug-comfort map irradiance-contrib result.sql direct_spec.ill indirect_spec.ill ref_spec.ill indirect_diff.ill ref_diff.ill sun-up-hours.txt --aperture-id "{aperture_id}" --folder output'.format(aperture_id=self.aperture_id) - - def output(self): - return { - 'result_folder': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix() - ) - } - - @property - def input_artifacts(self): - return [ - {'name': 'result_sql', 'to': 'result.sql', 'from': self.result_sql, 'optional': False}, - {'name': 'direct_specular', 'to': 'direct_spec.ill', 'from': self.direct_specular, 'optional': False}, - {'name': 'indirect_specular', 'to': 'indirect_spec.ill', 'from': self.indirect_specular, 'optional': False}, - {'name': 'ref_specular', 'to': 'ref_spec.ill', 'from': self.ref_specular, 'optional': False}, - {'name': 'indirect_diffuse', 'to': 'indirect_diff.ill', 'from': self.indirect_diffuse, 'optional': False}, - {'name': 'ref_diffuse', 'to': 'ref_diff.ill', 'from': self.ref_diffuse, 'optional': False}, - {'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}] - - @property - def output_artifacts(self): - return [ - { - 'name': 'result-folder', 'from': 'output', - 'to': pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix(), - 'optional': False, - 'type': 'folder' - }] - - -class _DynamicBehaviorEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask): - """Runs all the tasks in this module.""" - # user input for this module - _input_params = luigi.DictParameter() - - @property - def input_values(self): - params = dict(_default_inputs) - params.update(dict(self._input_params)) - return params - - def requires(self): - yield [CreateIrradianceContribMap(_input_params=self.input_values)] diff --git a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py b/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py index 81cb271f..82c2ab23 100644 --- a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py +++ b/lbt_recipes/adaptive_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py @@ -26,13 +26,120 @@ 'octree_file_with_suns': None, 'params_folder': '__params', 'radiance_parameters': '-ab 2 -ad 5000 -lw 2e-05', + 'ref_sensor_grid': None, + 'result_sql': None, 'sensor_count': None, 'sensor_grid': None, 'simulation_folder': '.', 'sky_dome': None, 'sky_matrix': None, 'sky_matrix_direct': None, - 'sun_modifiers': None} + 'sun_modifiers': None, + 'sun_up_hours': None} + + +class CreateIrradianceContribMap(QueenbeeTask): + """Get .ill files with maps of irradiance contributions from dynamic windows.""" + + # DAG Input parameters + _input_params = luigi.DictParameter() + + # Task inputs + @property + def aperture_id(self): + return self._input_params['group_name'] + + @property + def grid(self): + return self._input_params['grid_name'] + + @property + def result_sql(self): + value = pathlib.Path(self._input_params['result_sql']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def direct_specular(self): + value = pathlib.Path(self.input()['DirectSunGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def indirect_specular(self): + value = pathlib.Path(self.input()['OutputMatrixMathGroup']['results_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def ref_specular(self): + value = pathlib.Path(self.input()['GroundReflectedSkySpecGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def indirect_diffuse(self): + value = pathlib.Path(self.input()['TotalSkyDiffGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def ref_diffuse(self): + value = pathlib.Path(self.input()['GroundReflectedSkyDiffGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def sun_up_hours(self): + value = pathlib.Path(self._input_params['sun_up_hours']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def execution_folder(self): + return pathlib.Path(self._input_params['simulation_folder']).as_posix() + + @property + def initiation_folder(self): + return pathlib.Path(self._input_params['simulation_folder']).as_posix() + + @property + def params_folder(self): + return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() + + def command(self): + return 'ladybug-comfort map irradiance-contrib result.sql direct_spec.ill indirect_spec.ill ref_spec.ill indirect_diff.ill ref_diff.ill sun-up-hours.txt --aperture-id "{aperture_id}" --folder output'.format(aperture_id=self.aperture_id) + + def requires(self): + return {'DirectSunGroup': DirectSunGroup(_input_params=self._input_params), 'OutputMatrixMathGroup': OutputMatrixMathGroup(_input_params=self._input_params), 'GroundReflectedSkySpecGroup': GroundReflectedSkySpecGroup(_input_params=self._input_params), 'TotalSkyDiffGroup': TotalSkyDiffGroup(_input_params=self._input_params), 'GroundReflectedSkyDiffGroup': GroundReflectedSkyDiffGroup(_input_params=self._input_params)} + + def output(self): + return { + 'result_folder': luigi.LocalTarget( + pathlib.Path(self.execution_folder, 'dynamic/final/{grid}/{aperture_id}'.format(grid=self.grid, aperture_id=self.aperture_id)).resolve().as_posix() + ) + } + + @property + def input_artifacts(self): + return [ + {'name': 'result_sql', 'to': 'result.sql', 'from': self.result_sql, 'optional': False}, + {'name': 'direct_specular', 'to': 'direct_spec.ill', 'from': self.direct_specular, 'optional': False}, + {'name': 'indirect_specular', 'to': 'indirect_spec.ill', 'from': self.indirect_specular, 'optional': False}, + {'name': 'ref_specular', 'to': 'ref_spec.ill', 'from': self.ref_specular, 'optional': False}, + {'name': 'indirect_diffuse', 'to': 'indirect_diff.ill', 'from': self.indirect_diffuse, 'optional': False}, + {'name': 'ref_diffuse', 'to': 'ref_diff.ill', 'from': self.ref_diffuse, 'optional': False}, + {'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}] + + @property + def output_artifacts(self): + return [ + { + 'name': 'result-folder', 'from': 'output', + 'to': pathlib.Path(self.execution_folder, 'dynamic/final/{grid}/{aperture_id}'.format(grid=self.grid, aperture_id=self.aperture_id)).resolve().as_posix(), + 'optional': False, + 'type': 'folder' + }] class DirectSkyGroup(QueenbeeTask): @@ -43,11 +150,11 @@ class DirectSkyGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -86,7 +193,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -114,7 +221,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -131,7 +238,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -146,11 +253,11 @@ class DirectSunGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -189,7 +296,7 @@ def modifiers(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -217,7 +324,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_spec/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -233,7 +340,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_spec/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -247,11 +354,11 @@ class GroundReflectedSkyDiffGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] @property @@ -294,7 +401,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}_ref.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['ref_sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -322,7 +429,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_diff/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -339,7 +446,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_diff/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -353,11 +460,11 @@ class GroundReflectedSkySpecGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] @property @@ -400,7 +507,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}_ref.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['ref_sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -428,7 +535,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -445,7 +552,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -459,11 +566,11 @@ class OutputMatrixMathGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] conversion = luigi.Parameter(default=' ') @@ -505,7 +612,7 @@ def requires(self): def output(self): return { 'results_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/indirect_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/indirect_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -520,7 +627,7 @@ def output_artifacts(self): return [ { 'name': 'results-file', 'from': 'final.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/indirect_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/indirect_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -534,11 +641,11 @@ class TotalSkyDiffGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -581,7 +688,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -609,7 +716,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_diff/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -626,7 +733,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_diff/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -640,11 +747,11 @@ class TotalSkySpecGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -683,7 +790,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -711,7 +818,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -728,13 +835,13 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] -class _RadianceContribEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask): +class _RadianceContribEntryPoint_eb938b5bOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() @@ -746,4 +853,4 @@ def input_values(self): return params def requires(self): - yield [DirectSunGroup(_input_params=self.input_values), GroundReflectedSkyDiffGroup(_input_params=self.input_values), GroundReflectedSkySpecGroup(_input_params=self.input_values), OutputMatrixMathGroup(_input_params=self.input_values), TotalSkyDiffGroup(_input_params=self.input_values)] + yield [CreateIrradianceContribMap(_input_params=self.input_values)] diff --git a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py b/lbt_recipes/adaptive_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py index 811e06df..ef632a61 100644 --- a/lbt_recipes/adaptive_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py +++ b/lbt_recipes/adaptive_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py @@ -17,8 +17,7 @@ import pathlib from queenbee_local import QueenbeeTask from queenbee_local import load_input_param as qb_load_input_param -from .dependencies.dynamic_behavior_entry_point import _DynamicBehaviorEntryPoint_5e24b5e4Orchestrator as DynamicBehaviorEntryPoint_5e24b5e4Workerbee -from .dependencies.radiance_contrib_entry_point import _RadianceContribEntryPoint_5e24b5e4Orchestrator as RadianceContribEntryPoint_5e24b5e4Workerbee +from .dependencies.radiance_contrib_entry_point import _RadianceContribEntryPoint_eb938b5bOrchestrator as RadianceContribEntryPoint_eb938b5bWorkerbee _default_inputs = { 'group_name': None, @@ -84,165 +83,6 @@ def output_parameters(self): return [{'name': 'data', 'from': 'input_path', 'to': pathlib.Path(self.params_folder, 'input_path').resolve().as_posix()}] -class RunDynamicBehaviorContribLoop(luigi.Task): - """No description is provided.""" - - # DAG Input parameters - _input_params = luigi.DictParameter() - - # Task inputs - @property - def aperture_id(self): - return self._input_params['group_name'] - - @property - def grid_name(self): - return self.item['full_id'] - - @property - def result_sql(self): - value = pathlib.Path(self._input_params['result_sql']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def direct_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/direct_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/indirect_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/reflected_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_diffuse(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/total_diff'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_diffuse(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/reflected_diff'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def sun_up_hours(self): - value = pathlib.Path(self._input_params['sun_up_hours']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - # get item for loop - try: - item = luigi.DictParameter() - except Exception: - item = luigi.Parameter() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder'], 'shortwave').resolve().as_posix() - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - @property - def map_dag_inputs(self): - """Map task inputs to DAG inputs.""" - inputs = { - 'simulation_folder': self.execution_folder, - 'result_sql': self.result_sql, - 'direct_specular': self.direct_specular, - 'indirect_specular': self.indirect_specular, - 'ref_specular': self.ref_specular, - 'indirect_diffuse': self.indirect_diffuse, - 'ref_diffuse': self.ref_diffuse, - 'sun_up_hours': self.sun_up_hours, - 'aperture_id': self.aperture_id, - 'grid_name': self.grid_name - } - try: - inputs['__debug__'] = self._input_params['__debug__'] - except KeyError: - # not debug mode - pass - - return inputs - - def run(self): - yield [DynamicBehaviorEntryPoint_5e24b5e4Workerbee(_input_params=self.map_dag_inputs)] - done_file = pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done') - done_file.parent.mkdir(parents=True, exist_ok=True) - done_file.write_text('done!') - - def requires(self): - return {'ReadGrids': ReadGrids(_input_params=self._input_params), 'RunRadianceWindowContrib': RunRadianceWindowContrib(_input_params=self._input_params)} - - def output(self): - return { - 'is_done': luigi.LocalTarget(pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done').resolve().as_posix()) - } - - -class RunDynamicBehaviorContrib(luigi.Task): - """No description is provided.""" - # global parameters - _input_params = luigi.DictParameter() - @property - def data(self): - value = pathlib.Path(self.input()['ReadGrids']['data'].path) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def items(self): - try: - # assume the input is a file - return qb_load_input_param(self.data) - except: - # it is a parameter - return self.input()['ReadGrids']['data'].path - - def run(self): - yield [RunDynamicBehaviorContribLoop(item=item, _input_params=self._input_params) for item in self.items] - done_file = pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done') - done_file.parent.mkdir(parents=True, exist_ok=True) - done_file.write_text('done!') - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - def requires(self): - return {'ReadGrids': ReadGrids(_input_params=self._input_params), 'RunRadianceWindowContrib': RunRadianceWindowContrib(_input_params=self._input_params)} - - def output(self): - return { - 'is_done': luigi.LocalTarget(pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done').resolve().as_posix()) - } - - class RunRadianceWindowContribLoop(luigi.Task): """No description is provided.""" @@ -290,6 +130,12 @@ def sensor_grid(self): return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property + def ref_sensor_grid(self): + value = pathlib.Path(self._input_params['sensor_grid_folder'], '{item_full_id}_ref.pts'.format(item_full_id=self.item['full_id'])) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property def sky_dome(self): value = pathlib.Path(self._input_params['sky_dome']) @@ -314,6 +160,18 @@ def sun_modifiers(self): return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property + def result_sql(self): + value = pathlib.Path(self._input_params['result_sql']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def sun_up_hours(self): + value = pathlib.Path(self._input_params['sun_up_hours']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + # get item for loop try: item = luigi.DictParameter() @@ -344,11 +202,14 @@ def map_dag_inputs(self): 'group_name': self.group_name, 'grid_name': self.grid_name, 'sensor_grid': self.sensor_grid, + 'ref_sensor_grid': self.ref_sensor_grid, 'sensor_count': self.sensor_count, 'sky_dome': self.sky_dome, 'sky_matrix': self.sky_matrix, 'sky_matrix_direct': self.sky_matrix_direct, - 'sun_modifiers': self.sun_modifiers + 'sun_modifiers': self.sun_modifiers, + 'result_sql': self.result_sql, + 'sun_up_hours': self.sun_up_hours } try: inputs['__debug__'] = self._input_params['__debug__'] @@ -359,7 +220,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [RadianceContribEntryPoint_5e24b5e4Workerbee(_input_params=self.map_dag_inputs)] + yield [RadianceContribEntryPoint_eb938b5bWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_window_contrib.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -419,7 +280,7 @@ def output(self): } -class _DynamicContributionEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask): +class _DynamicContributionEntryPoint_eb938b5bOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() @@ -431,4 +292,4 @@ def input_values(self): return params def requires(self): - yield [RunDynamicBehaviorContrib(_input_params=self.input_values)] + yield [RunRadianceWindowContrib(_input_params=self.input_values)] diff --git a/lbt_recipes/adaptive_comfort_map/flow/dependencies/radiance_mapping_entry_point.py b/lbt_recipes/adaptive_comfort_map/flow/dependencies/radiance_mapping_entry_point.py index 2351df61..44c8cfcb 100644 --- a/lbt_recipes/adaptive_comfort_map/flow/dependencies/radiance_mapping_entry_point.py +++ b/lbt_recipes/adaptive_comfort_map/flow/dependencies/radiance_mapping_entry_point.py @@ -730,7 +730,7 @@ def output_artifacts(self): }] -class _RadianceMappingEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask): +class _RadianceMappingEntryPoint_eb938b5bOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/adaptive_comfort_map/flow/main.py b/lbt_recipes/adaptive_comfort_map/flow/main.py index e01c847e..7512996b 100644 --- a/lbt_recipes/adaptive_comfort_map/flow/main.py +++ b/lbt_recipes/adaptive_comfort_map/flow/main.py @@ -17,9 +17,9 @@ import pathlib from queenbee_local import QueenbeeTask from queenbee_local import load_input_param as qb_load_input_param -from .dependencies.comfort_mapping_entry_point import _ComfortMappingEntryPoint_5e24b5e4Orchestrator as ComfortMappingEntryPoint_5e24b5e4Workerbee -from .dependencies.dynamic_contribution_entry_point import _DynamicContributionEntryPoint_5e24b5e4Orchestrator as DynamicContributionEntryPoint_5e24b5e4Workerbee -from .dependencies.radiance_mapping_entry_point import _RadianceMappingEntryPoint_5e24b5e4Orchestrator as RadianceMappingEntryPoint_5e24b5e4Workerbee +from .dependencies.comfort_mapping_entry_point import _ComfortMappingEntryPoint_eb938b5bOrchestrator as ComfortMappingEntryPoint_eb938b5bWorkerbee +from .dependencies.dynamic_contribution_entry_point import _DynamicContributionEntryPoint_eb938b5bOrchestrator as DynamicContributionEntryPoint_eb938b5bWorkerbee +from .dependencies.radiance_mapping_entry_point import _RadianceMappingEntryPoint_eb938b5bOrchestrator as RadianceMappingEntryPoint_eb938b5bWorkerbee _default_inputs = { 'additional_idf': None, @@ -1821,7 +1821,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [ComfortMappingEntryPoint_5e24b5e4Workerbee(_input_params=self.map_dag_inputs)] + yield [ComfortMappingEntryPoint_eb938b5bWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_comfort_map.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -2024,7 +2024,7 @@ def octree_file_with_suns(self): @property def sensor_grid_folder(self): - value = pathlib.Path(self.input()['SplitGridFolder']['output_folder'].path) + value = pathlib.Path('radiance/shortwave/grids') return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -2110,7 +2110,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [DynamicContributionEntryPoint_5e24b5e4Workerbee(_input_params=self.map_dag_inputs)] + yield [DynamicContributionEntryPoint_eb938b5bWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_dynamic_contribution.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -2295,7 +2295,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [RadianceMappingEntryPoint_5e24b5e4Workerbee(_input_params=self.map_dag_inputs)] + yield [RadianceMappingEntryPoint_eb938b5bWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_simulation.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -2370,6 +2370,8 @@ def use_visible(self): def exterior_offset(self): return '0.02' + dynamic_behavior = luigi.Parameter(default='dynamic') + @property def model(self): value = pathlib.Path(self._input_params['model']) @@ -2389,7 +2391,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-energy edit modifiers-from-constructions model.hbjson --{use_visible} --exterior-offset {exterior_offset} --output-file new_model.hbjson'.format(use_visible=self.use_visible, exterior_offset=self.exterior_offset) + return 'honeybee-energy edit modifiers-from-constructions model.hbjson --{use_visible} --{dynamic_behavior}-groups --exterior-offset {exterior_offset} --output-file new_model.hbjson'.format(use_visible=self.use_visible, dynamic_behavior=self.dynamic_behavior, exterior_offset=self.exterior_offset) def output(self): return { @@ -2517,7 +2519,7 @@ def output_parameters(self): return [{'name': 'sensor-grids', 'from': 'output_folder/_info.json', 'to': pathlib.Path(self.params_folder, 'output_folder/_info.json').resolve().as_posix()}] -class _Main_5e24b5e4Orchestrator(luigi.WrapperTask): +class _Main_eb938b5bOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/adaptive_comfort_map/run.py b/lbt_recipes/adaptive_comfort_map/run.py index a44a8440..ca9a2718 100644 --- a/lbt_recipes/adaptive_comfort_map/run.py +++ b/lbt_recipes/adaptive_comfort_map/run.py @@ -43,7 +43,7 @@ class LetAdaptiveComfortMapFly(luigi.WrapperTask): _input_params = luigi.DictParameter() def requires(self): - yield [adaptive_comfort_map_workerbee._Main_5e24b5e4Orchestrator(_input_params=self._input_params)] + yield [adaptive_comfort_map_workerbee._Main_eb938b5bOrchestrator(_input_params=self._input_params)] def start(project_folder, user_values, workers): diff --git a/lbt_recipes/pmv_comfort_map/flow/dependencies/comfort_mapping_entry_point.py b/lbt_recipes/pmv_comfort_map/flow/dependencies/comfort_mapping_entry_point.py index 48912112..a81cc193 100644 --- a/lbt_recipes/pmv_comfort_map/flow/dependencies/comfort_mapping_entry_point.py +++ b/lbt_recipes/pmv_comfort_map/flow/dependencies/comfort_mapping_entry_point.py @@ -705,7 +705,7 @@ def output_artifacts(self): }] -class _ComfortMappingEntryPoint_97d86f51Orchestrator(luigi.WrapperTask): +class _ComfortMappingEntryPoint_e67309aaOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py b/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py deleted file mode 100644 index ecc72202..00000000 --- a/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/dynamic_behavior_entry_point.py +++ /dev/null @@ -1,148 +0,0 @@ -""" -This file is auto-generated from a Queenbee recipe. It is unlikely that -you should be editing this file directly. Instead try to edit the recipe -itself and regenerate the code. - -Contact the recipe maintainers with additional questions. - chris: chris@ladybug.tools - ladybug-tools: info@ladybug.tools - -This file is licensed under "PolyForm Shield License 1.0.0". -See https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt for more information. -""" - - -import luigi -import os -import pathlib -from queenbee_local import QueenbeeTask -from queenbee_local import load_input_param as qb_load_input_param - - -_default_inputs = { 'aperture_id': None, - 'direct_specular': None, - 'grid_name': None, - 'indirect_diffuse': None, - 'indirect_specular': None, - 'params_folder': '__params', - 'ref_diffuse': None, - 'ref_specular': None, - 'result_sql': None, - 'simulation_folder': '.', - 'sun_up_hours': None} - - -class CreateIrradianceContribMap(QueenbeeTask): - """Get .ill files with maps of irradiance contributions from dynamic windows.""" - - # DAG Input parameters - _input_params = luigi.DictParameter() - - # Task inputs - @property - def aperture_id(self): - return self._input_params['aperture_id'] - - @property - def name(self): - return self._input_params['grid_name'] - - @property - def result_sql(self): - value = pathlib.Path(self._input_params['result_sql']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def direct_specular(self): - value = pathlib.Path(self._input_params['direct_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_specular(self): - value = pathlib.Path(self._input_params['indirect_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_specular(self): - value = pathlib.Path(self._input_params['ref_specular']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_diffuse(self): - value = pathlib.Path(self._input_params['indirect_diffuse']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_diffuse(self): - value = pathlib.Path(self._input_params['ref_diffuse']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def sun_up_hours(self): - value = pathlib.Path(self._input_params['sun_up_hours']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - def command(self): - return 'ladybug-comfort map irradiance-contrib result.sql direct_spec.ill indirect_spec.ill ref_spec.ill indirect_diff.ill ref_diff.ill sun-up-hours.txt --aperture-id "{aperture_id}" --folder output'.format(aperture_id=self.aperture_id) - - def output(self): - return { - 'result_folder': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix() - ) - } - - @property - def input_artifacts(self): - return [ - {'name': 'result_sql', 'to': 'result.sql', 'from': self.result_sql, 'optional': False}, - {'name': 'direct_specular', 'to': 'direct_spec.ill', 'from': self.direct_specular, 'optional': False}, - {'name': 'indirect_specular', 'to': 'indirect_spec.ill', 'from': self.indirect_specular, 'optional': False}, - {'name': 'ref_specular', 'to': 'ref_spec.ill', 'from': self.ref_specular, 'optional': False}, - {'name': 'indirect_diffuse', 'to': 'indirect_diff.ill', 'from': self.indirect_diffuse, 'optional': False}, - {'name': 'ref_diffuse', 'to': 'ref_diff.ill', 'from': self.ref_diffuse, 'optional': False}, - {'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}] - - @property - def output_artifacts(self): - return [ - { - 'name': 'result-folder', 'from': 'output', - 'to': pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix(), - 'optional': False, - 'type': 'folder' - }] - - -class _DynamicBehaviorEntryPoint_97d86f51Orchestrator(luigi.WrapperTask): - """Runs all the tasks in this module.""" - # user input for this module - _input_params = luigi.DictParameter() - - @property - def input_values(self): - params = dict(_default_inputs) - params.update(dict(self._input_params)) - return params - - def requires(self): - yield [CreateIrradianceContribMap(_input_params=self.input_values)] diff --git a/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py b/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py index d1578e83..30a28fe3 100644 --- a/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py +++ b/lbt_recipes/pmv_comfort_map/flow/dependencies/dependencies/radiance_contrib_entry_point.py @@ -26,13 +26,120 @@ 'octree_file_with_suns': None, 'params_folder': '__params', 'radiance_parameters': '-ab 2 -ad 5000 -lw 2e-05', + 'ref_sensor_grid': None, + 'result_sql': None, 'sensor_count': None, 'sensor_grid': None, 'simulation_folder': '.', 'sky_dome': None, 'sky_matrix': None, 'sky_matrix_direct': None, - 'sun_modifiers': None} + 'sun_modifiers': None, + 'sun_up_hours': None} + + +class CreateIrradianceContribMap(QueenbeeTask): + """Get .ill files with maps of irradiance contributions from dynamic windows.""" + + # DAG Input parameters + _input_params = luigi.DictParameter() + + # Task inputs + @property + def aperture_id(self): + return self._input_params['group_name'] + + @property + def grid(self): + return self._input_params['grid_name'] + + @property + def result_sql(self): + value = pathlib.Path(self._input_params['result_sql']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def direct_specular(self): + value = pathlib.Path(self.input()['DirectSunGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def indirect_specular(self): + value = pathlib.Path(self.input()['OutputMatrixMathGroup']['results_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def ref_specular(self): + value = pathlib.Path(self.input()['GroundReflectedSkySpecGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def indirect_diffuse(self): + value = pathlib.Path(self.input()['TotalSkyDiffGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def ref_diffuse(self): + value = pathlib.Path(self.input()['GroundReflectedSkyDiffGroup']['result_file'].path) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def sun_up_hours(self): + value = pathlib.Path(self._input_params['sun_up_hours']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def execution_folder(self): + return pathlib.Path(self._input_params['simulation_folder']).as_posix() + + @property + def initiation_folder(self): + return pathlib.Path(self._input_params['simulation_folder']).as_posix() + + @property + def params_folder(self): + return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() + + def command(self): + return 'ladybug-comfort map irradiance-contrib result.sql direct_spec.ill indirect_spec.ill ref_spec.ill indirect_diff.ill ref_diff.ill sun-up-hours.txt --aperture-id "{aperture_id}" --folder output'.format(aperture_id=self.aperture_id) + + def requires(self): + return {'DirectSunGroup': DirectSunGroup(_input_params=self._input_params), 'OutputMatrixMathGroup': OutputMatrixMathGroup(_input_params=self._input_params), 'GroundReflectedSkySpecGroup': GroundReflectedSkySpecGroup(_input_params=self._input_params), 'TotalSkyDiffGroup': TotalSkyDiffGroup(_input_params=self._input_params), 'GroundReflectedSkyDiffGroup': GroundReflectedSkyDiffGroup(_input_params=self._input_params)} + + def output(self): + return { + 'result_folder': luigi.LocalTarget( + pathlib.Path(self.execution_folder, 'dynamic/final/{grid}/{aperture_id}'.format(grid=self.grid, aperture_id=self.aperture_id)).resolve().as_posix() + ) + } + + @property + def input_artifacts(self): + return [ + {'name': 'result_sql', 'to': 'result.sql', 'from': self.result_sql, 'optional': False}, + {'name': 'direct_specular', 'to': 'direct_spec.ill', 'from': self.direct_specular, 'optional': False}, + {'name': 'indirect_specular', 'to': 'indirect_spec.ill', 'from': self.indirect_specular, 'optional': False}, + {'name': 'ref_specular', 'to': 'ref_spec.ill', 'from': self.ref_specular, 'optional': False}, + {'name': 'indirect_diffuse', 'to': 'indirect_diff.ill', 'from': self.indirect_diffuse, 'optional': False}, + {'name': 'ref_diffuse', 'to': 'ref_diff.ill', 'from': self.ref_diffuse, 'optional': False}, + {'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}] + + @property + def output_artifacts(self): + return [ + { + 'name': 'result-folder', 'from': 'output', + 'to': pathlib.Path(self.execution_folder, 'dynamic/final/{grid}/{aperture_id}'.format(grid=self.grid, aperture_id=self.aperture_id)).resolve().as_posix(), + 'optional': False, + 'type': 'folder' + }] class DirectSkyGroup(QueenbeeTask): @@ -43,11 +150,11 @@ class DirectSkyGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -86,7 +193,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -114,7 +221,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -131,7 +238,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -146,11 +253,11 @@ class DirectSunGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -189,7 +296,7 @@ def modifiers(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -217,7 +324,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_spec/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -233,7 +340,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/direct_spec/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/direct_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -247,11 +354,11 @@ class GroundReflectedSkyDiffGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] @property @@ -294,7 +401,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}_ref.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['ref_sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -322,7 +429,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_diff/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -339,7 +446,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_diff/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -353,11 +460,11 @@ class GroundReflectedSkySpecGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] @property @@ -400,7 +507,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}_ref.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['ref_sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -428,7 +535,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -445,7 +552,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/reflected_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/reflected_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -459,11 +566,11 @@ class OutputMatrixMathGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def g_name(self): + def group(self): return self._input_params['group_name'] conversion = luigi.Parameter(default=' ') @@ -505,7 +612,7 @@ def requires(self): def output(self): return { 'results_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/indirect_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/indirect_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -520,7 +627,7 @@ def output_artifacts(self): return [ { 'name': 'results-file', 'from': 'final.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{g_name}/indirect_spec/{name}.ill'.format(g_name=self.g_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/indirect_spec/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -534,11 +641,11 @@ class TotalSkyDiffGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -581,7 +688,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -609,7 +716,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_diff/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -626,7 +733,7 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_diff/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_diff/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -640,11 +747,11 @@ class TotalSkySpecGroup(QueenbeeTask): # Task inputs @property - def name(self): + def grid(self): return self._input_params['grid_name'] @property - def group_name(self): + def group(self): return self._input_params['group_name'] @property @@ -683,7 +790,7 @@ def sky_dome(self): @property def sensor_grid(self): - value = pathlib.Path('grids/{name}.pts'.format(name=self.name)) + value = pathlib.Path(self._input_params['sensor_grid']) return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -711,7 +818,7 @@ def command(self): def output(self): return { 'result_file': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix() + pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix() ) } @@ -728,13 +835,13 @@ def output_artifacts(self): return [ { 'name': 'result-file', 'from': 'results.ill', - 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group_name}/total_sky/{name}.ill'.format(group_name=self.group_name, name=self.name)).resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'dynamic/initial/{group}/total_sky/{grid}.ill'.format(group=self.group, grid=self.grid)).resolve().as_posix(), 'optional': False, 'type': 'file' }] -class _RadianceContribEntryPoint_97d86f51Orchestrator(luigi.WrapperTask): +class _RadianceContribEntryPoint_e67309aaOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() @@ -746,4 +853,4 @@ def input_values(self): return params def requires(self): - yield [DirectSunGroup(_input_params=self.input_values), GroundReflectedSkyDiffGroup(_input_params=self.input_values), GroundReflectedSkySpecGroup(_input_params=self.input_values), OutputMatrixMathGroup(_input_params=self.input_values), TotalSkyDiffGroup(_input_params=self.input_values)] + yield [CreateIrradianceContribMap(_input_params=self.input_values)] diff --git a/lbt_recipes/pmv_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py b/lbt_recipes/pmv_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py index 9821b493..cc5a45d7 100644 --- a/lbt_recipes/pmv_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py +++ b/lbt_recipes/pmv_comfort_map/flow/dependencies/dynamic_contribution_entry_point.py @@ -17,8 +17,7 @@ import pathlib from queenbee_local import QueenbeeTask from queenbee_local import load_input_param as qb_load_input_param -from .dependencies.dynamic_behavior_entry_point import _DynamicBehaviorEntryPoint_97d86f51Orchestrator as DynamicBehaviorEntryPoint_97d86f51Workerbee -from .dependencies.radiance_contrib_entry_point import _RadianceContribEntryPoint_97d86f51Orchestrator as RadianceContribEntryPoint_97d86f51Workerbee +from .dependencies.radiance_contrib_entry_point import _RadianceContribEntryPoint_e67309aaOrchestrator as RadianceContribEntryPoint_e67309aaWorkerbee _default_inputs = { 'group_name': None, @@ -84,165 +83,6 @@ def output_parameters(self): return [{'name': 'data', 'from': 'input_path', 'to': pathlib.Path(self.params_folder, 'input_path').resolve().as_posix()}] -class RunDynamicBehaviorContribLoop(luigi.Task): - """No description is provided.""" - - # DAG Input parameters - _input_params = luigi.DictParameter() - - # Task inputs - @property - def aperture_id(self): - return self._input_params['group_name'] - - @property - def grid_name(self): - return self.item['full_id'] - - @property - def result_sql(self): - value = pathlib.Path(self._input_params['result_sql']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def direct_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/direct_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/indirect_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_specular(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/reflected_spec'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def indirect_diffuse(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/total_diff'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def ref_diffuse(self): - value = pathlib.Path('shortwave/dynamic/initial/{aperture_id}/reflected_diff'.format(aperture_id=self.aperture_id), '{item_full_id}.ill'.format(item_full_id=self.item['full_id'])) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def sun_up_hours(self): - value = pathlib.Path(self._input_params['sun_up_hours']) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - # get item for loop - try: - item = luigi.DictParameter() - except Exception: - item = luigi.Parameter() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder'], 'shortwave').resolve().as_posix() - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - @property - def map_dag_inputs(self): - """Map task inputs to DAG inputs.""" - inputs = { - 'simulation_folder': self.execution_folder, - 'result_sql': self.result_sql, - 'direct_specular': self.direct_specular, - 'indirect_specular': self.indirect_specular, - 'ref_specular': self.ref_specular, - 'indirect_diffuse': self.indirect_diffuse, - 'ref_diffuse': self.ref_diffuse, - 'sun_up_hours': self.sun_up_hours, - 'aperture_id': self.aperture_id, - 'grid_name': self.grid_name - } - try: - inputs['__debug__'] = self._input_params['__debug__'] - except KeyError: - # not debug mode - pass - - return inputs - - def run(self): - yield [DynamicBehaviorEntryPoint_97d86f51Workerbee(_input_params=self.map_dag_inputs)] - done_file = pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done') - done_file.parent.mkdir(parents=True, exist_ok=True) - done_file.write_text('done!') - - def requires(self): - return {'ReadGrids': ReadGrids(_input_params=self._input_params), 'RunRadianceWindowContrib': RunRadianceWindowContrib(_input_params=self._input_params)} - - def output(self): - return { - 'is_done': luigi.LocalTarget(pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done').resolve().as_posix()) - } - - -class RunDynamicBehaviorContrib(luigi.Task): - """No description is provided.""" - # global parameters - _input_params = luigi.DictParameter() - @property - def data(self): - value = pathlib.Path(self.input()['ReadGrids']['data'].path) - return value.as_posix() if value.is_absolute() \ - else pathlib.Path(self.initiation_folder, value).resolve().as_posix() - - @property - def items(self): - try: - # assume the input is a file - return qb_load_input_param(self.data) - except: - # it is a parameter - return self.input()['ReadGrids']['data'].path - - def run(self): - yield [RunDynamicBehaviorContribLoop(item=item, _input_params=self._input_params) for item in self.items] - done_file = pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done') - done_file.parent.mkdir(parents=True, exist_ok=True) - done_file.write_text('done!') - - @property - def initiation_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def execution_folder(self): - return pathlib.Path(self._input_params['simulation_folder']).as_posix() - - @property - def params_folder(self): - return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() - - def requires(self): - return {'ReadGrids': ReadGrids(_input_params=self._input_params), 'RunRadianceWindowContrib': RunRadianceWindowContrib(_input_params=self._input_params)} - - def output(self): - return { - 'is_done': luigi.LocalTarget(pathlib.Path(self.execution_folder, 'run_dynamic_behavior_contrib.done').resolve().as_posix()) - } - - class RunRadianceWindowContribLoop(luigi.Task): """No description is provided.""" @@ -290,6 +130,12 @@ def sensor_grid(self): return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property + def ref_sensor_grid(self): + value = pathlib.Path(self._input_params['sensor_grid_folder'], '{item_full_id}_ref.pts'.format(item_full_id=self.item['full_id'])) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property def sky_dome(self): value = pathlib.Path(self._input_params['sky_dome']) @@ -314,6 +160,18 @@ def sun_modifiers(self): return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + @property + def result_sql(self): + value = pathlib.Path(self._input_params['result_sql']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + + @property + def sun_up_hours(self): + value = pathlib.Path(self._input_params['sun_up_hours']) + return value.as_posix() if value.is_absolute() \ + else pathlib.Path(self.initiation_folder, value).resolve().as_posix() + # get item for loop try: item = luigi.DictParameter() @@ -344,11 +202,14 @@ def map_dag_inputs(self): 'group_name': self.group_name, 'grid_name': self.grid_name, 'sensor_grid': self.sensor_grid, + 'ref_sensor_grid': self.ref_sensor_grid, 'sensor_count': self.sensor_count, 'sky_dome': self.sky_dome, 'sky_matrix': self.sky_matrix, 'sky_matrix_direct': self.sky_matrix_direct, - 'sun_modifiers': self.sun_modifiers + 'sun_modifiers': self.sun_modifiers, + 'result_sql': self.result_sql, + 'sun_up_hours': self.sun_up_hours } try: inputs['__debug__'] = self._input_params['__debug__'] @@ -359,7 +220,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [RadianceContribEntryPoint_97d86f51Workerbee(_input_params=self.map_dag_inputs)] + yield [RadianceContribEntryPoint_e67309aaWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_window_contrib.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -419,7 +280,7 @@ def output(self): } -class _DynamicContributionEntryPoint_97d86f51Orchestrator(luigi.WrapperTask): +class _DynamicContributionEntryPoint_e67309aaOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() @@ -431,4 +292,4 @@ def input_values(self): return params def requires(self): - yield [RunDynamicBehaviorContrib(_input_params=self.input_values)] + yield [RunRadianceWindowContrib(_input_params=self.input_values)] diff --git a/lbt_recipes/pmv_comfort_map/flow/dependencies/radiance_mapping_entry_point.py b/lbt_recipes/pmv_comfort_map/flow/dependencies/radiance_mapping_entry_point.py index b72e7f34..b9ff75c3 100644 --- a/lbt_recipes/pmv_comfort_map/flow/dependencies/radiance_mapping_entry_point.py +++ b/lbt_recipes/pmv_comfort_map/flow/dependencies/radiance_mapping_entry_point.py @@ -730,7 +730,7 @@ def output_artifacts(self): }] -class _RadianceMappingEntryPoint_97d86f51Orchestrator(luigi.WrapperTask): +class _RadianceMappingEntryPoint_e67309aaOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/pmv_comfort_map/flow/main.py b/lbt_recipes/pmv_comfort_map/flow/main.py index 80b50c99..b2587a58 100644 --- a/lbt_recipes/pmv_comfort_map/flow/main.py +++ b/lbt_recipes/pmv_comfort_map/flow/main.py @@ -17,9 +17,9 @@ import pathlib from queenbee_local import QueenbeeTask from queenbee_local import load_input_param as qb_load_input_param -from .dependencies.comfort_mapping_entry_point import _ComfortMappingEntryPoint_97d86f51Orchestrator as ComfortMappingEntryPoint_97d86f51Workerbee -from .dependencies.dynamic_contribution_entry_point import _DynamicContributionEntryPoint_97d86f51Orchestrator as DynamicContributionEntryPoint_97d86f51Workerbee -from .dependencies.radiance_mapping_entry_point import _RadianceMappingEntryPoint_97d86f51Orchestrator as RadianceMappingEntryPoint_97d86f51Workerbee +from .dependencies.comfort_mapping_entry_point import _ComfortMappingEntryPoint_e67309aaOrchestrator as ComfortMappingEntryPoint_e67309aaWorkerbee +from .dependencies.dynamic_contribution_entry_point import _DynamicContributionEntryPoint_e67309aaOrchestrator as DynamicContributionEntryPoint_e67309aaWorkerbee +from .dependencies.radiance_mapping_entry_point import _RadianceMappingEntryPoint_e67309aaOrchestrator as RadianceMappingEntryPoint_e67309aaWorkerbee _default_inputs = { 'additional_idf': None, @@ -96,7 +96,7 @@ def output(self): ), 'dst_6': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'initial_results/conditions/_redist_info.json').resolve().as_posix() + pathlib.Path(self.execution_folder, 'initial_results/conditions/grids_info.json').resolve().as_posix() ) } @@ -145,7 +145,7 @@ def output_artifacts(self): { 'name': 'dst-6', 'from': 'input_path', - 'to': pathlib.Path(self.execution_folder, 'initial_results/conditions/_redist_info.json').resolve().as_posix(), + 'to': pathlib.Path(self.execution_folder, 'initial_results/conditions/grids_info.json').resolve().as_posix(), 'optional': False, 'type': 'folder' }] @@ -1781,7 +1781,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [ComfortMappingEntryPoint_97d86f51Workerbee(_input_params=self.map_dag_inputs)] + yield [ComfortMappingEntryPoint_e67309aaWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_comfort_map.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -1984,7 +1984,7 @@ def octree_file_with_suns(self): @property def sensor_grid_folder(self): - value = pathlib.Path(self.input()['SplitGridFolder']['output_folder'].path) + value = pathlib.Path('radiance/shortwave/grids') return value.as_posix() if value.is_absolute() \ else pathlib.Path(self.initiation_folder, value).resolve().as_posix() @@ -2070,7 +2070,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [DynamicContributionEntryPoint_97d86f51Workerbee(_input_params=self.map_dag_inputs)] + yield [DynamicContributionEntryPoint_e67309aaWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_dynamic_contribution.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -2255,7 +2255,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [RadianceMappingEntryPoint_97d86f51Workerbee(_input_params=self.map_dag_inputs)] + yield [RadianceMappingEntryPoint_e67309aaWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'run_radiance_simulation.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -2330,6 +2330,8 @@ def use_visible(self): def exterior_offset(self): return '0.02' + dynamic_behavior = luigi.Parameter(default='dynamic') + @property def model(self): value = pathlib.Path(self._input_params['model']) @@ -2349,7 +2351,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-energy edit modifiers-from-constructions model.hbjson --{use_visible} --exterior-offset {exterior_offset} --output-file new_model.hbjson'.format(use_visible=self.use_visible, exterior_offset=self.exterior_offset) + return 'honeybee-energy edit modifiers-from-constructions model.hbjson --{use_visible} --{dynamic_behavior}-groups --exterior-offset {exterior_offset} --output-file new_model.hbjson'.format(use_visible=self.use_visible, dynamic_behavior=self.dynamic_behavior, exterior_offset=self.exterior_offset) def output(self): return { @@ -2477,7 +2479,7 @@ def output_parameters(self): return [{'name': 'sensor-grids', 'from': 'output_folder/_info.json', 'to': pathlib.Path(self.params_folder, 'output_folder/_info.json').resolve().as_posix()}] -class _Main_97d86f51Orchestrator(luigi.WrapperTask): +class _Main_e67309aaOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/pmv_comfort_map/package.json b/lbt_recipes/pmv_comfort_map/package.json index da29dfeb..e3ad515c 100644 --- a/lbt_recipes/pmv_comfort_map/package.json +++ b/lbt_recipes/pmv_comfort_map/package.json @@ -6,7 +6,7 @@ "type": "MetaData", "annotations": {}, "name": "pmv-comfort-map", - "tag": "0.6.1", + "tag": "0.6.4", "app_version": null, "keywords": [ "honeybee", diff --git a/lbt_recipes/pmv_comfort_map/run.py b/lbt_recipes/pmv_comfort_map/run.py index 79b5414b..19a39f55 100644 --- a/lbt_recipes/pmv_comfort_map/run.py +++ b/lbt_recipes/pmv_comfort_map/run.py @@ -46,7 +46,7 @@ class LetPmvComfortMapFly(luigi.WrapperTask): _input_params = luigi.DictParameter() def requires(self): - yield [pmv_comfort_map_workerbee._Main_97d86f51Orchestrator(_input_params=self._input_params)] + yield [pmv_comfort_map_workerbee._Main_e67309aaOrchestrator(_input_params=self._input_params)] def start(project_folder, user_values, workers):