diff --git a/lbt_recipes/annual_irradiance/flow/dependencies/annual_irradiance_ray_tracing.py b/lbt_recipes/annual_irradiance/flow/dependencies/annual_irradiance_ray_tracing.py index c5f66517..a005e9b7 100644 --- a/lbt_recipes/annual_irradiance/flow/dependencies/annual_irradiance_ray_tracing.py +++ b/lbt_recipes/annual_irradiance/flow/dependencies/annual_irradiance_ray_tracing.py @@ -16,7 +16,6 @@ import os import pathlib from queenbee_local import QueenbeeTask -from queenbee_local import load_input_param as qb_load_input_param _default_inputs = { 'bsdfs': None, @@ -47,7 +46,7 @@ def radiance_parameters(self): @property def fixed_radiance_parameters(self): - return '-aa 0.0 -I -ab 1 -c 1' + return '-aa 0.0 -I -ab 1 -c 1 -faf' @property def sensor_count(self): @@ -57,6 +56,8 @@ def sensor_count(self): def conversion(self): return '0.265 0.670 0.065' + header = luigi.Parameter(default='keep') + order_by = luigi.Parameter(default='sensor') output_format = luigi.Parameter(default='f') @@ -109,7 +110,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-radiance dc scoeff scene.oct grid.pts sky.dome sky.mtx --sensor-count {sensor_count} --output results.ill --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --order-by-{order_by}'.format(sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by) + return 'honeybee-radiance dc scoeff scene.oct grid.pts sky.dome sky.mtx --sensor-count {sensor_count} --output results.ill --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --order-by-{order_by} --{header}-header'.format(sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by, header=self.header) def output(self): return { @@ -172,6 +173,8 @@ def output_format(self): calculate_values = luigi.Parameter(default='value') + header = luigi.Parameter(default='keep') + order_by = luigi.Parameter(default='sensor') @property @@ -216,7 +219,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-radiance dc scontrib scene.oct grid.pts suns.mod --{calculate_values} --sensor-count {sensor_count} --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --output results.ill --order-by-{order_by}'.format(calculate_values=self.calculate_values, sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by) + return 'honeybee-radiance dc scontrib scene.oct grid.pts suns.mod --{calculate_values} --sensor-count {sensor_count} --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --output results.ill --order-by-{order_by} --{header}-header'.format(calculate_values=self.calculate_values, sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by, header=self.header) def output(self): return { @@ -335,7 +338,7 @@ def radiance_parameters(self): @property def fixed_radiance_parameters(self): - return '-aa 0.0 -I -c 1' + return '-aa 0.0 -I -c 1 -faf' @property def sensor_count(self): @@ -345,6 +348,8 @@ def sensor_count(self): def conversion(self): return '0.265 0.670 0.065' + header = luigi.Parameter(default='keep') + order_by = luigi.Parameter(default='sensor') output_format = luigi.Parameter(default='f') @@ -397,7 +402,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-radiance dc scoeff scene.oct grid.pts sky.dome sky.mtx --sensor-count {sensor_count} --output results.ill --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --order-by-{order_by}'.format(sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by) + return 'honeybee-radiance dc scoeff scene.oct grid.pts sky.dome sky.mtx --sensor-count {sensor_count} --output results.ill --rad-params "{radiance_parameters}" --rad-params-locked "{fixed_radiance_parameters}" --conversion "{conversion}" --output-format {output_format} --order-by-{order_by} --{header}-header'.format(sensor_count=self.sensor_count, radiance_parameters=self.radiance_parameters, fixed_radiance_parameters=self.fixed_radiance_parameters, conversion=self.conversion, output_format=self.output_format, order_by=self.order_by, header=self.header) def output(self): return { @@ -426,7 +431,7 @@ def output_artifacts(self): }] -class _AnnualIrradianceRayTracing_d75637b2Orchestrator(luigi.WrapperTask): +class _AnnualIrradianceRayTracing_2c2db9eeOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/annual_irradiance/flow/main.py b/lbt_recipes/annual_irradiance/flow/main.py index 394a9ef1..de88b104 100644 --- a/lbt_recipes/annual_irradiance/flow/main.py +++ b/lbt_recipes/annual_irradiance/flow/main.py @@ -16,8 +16,7 @@ import os import pathlib from queenbee_local import QueenbeeTask -from queenbee_local import load_input_param as qb_load_input_param -from .dependencies.annual_irradiance_ray_tracing import _AnnualIrradianceRayTracing_d75637b2Orchestrator as AnnualIrradianceRayTracing_d75637b2Workerbee +from .dependencies.annual_irradiance_ray_tracing import _AnnualIrradianceRayTracing_2c2db9eeOrchestrator as AnnualIrradianceRayTracing_2c2db9eeWorkerbee _default_inputs = { 'cpu_count': 50, @@ -25,6 +24,7 @@ 'min_sensor_count': 1, 'model': None, 'north': 0.0, + 'output_type': 'solar', 'params_folder': '__params', 'radiance_parameters': '-ab 2 -ad 5000 -lw 2e-05', 'simulation_folder': '.', @@ -155,7 +155,7 @@ def map_dag_inputs(self): return inputs def run(self): - yield [AnnualIrradianceRayTracing_d75637b2Workerbee(_input_params=self.map_dag_inputs)] + yield [AnnualIrradianceRayTracing_2c2db9eeWorkerbee(_input_params=self.map_dag_inputs)] done_file = pathlib.Path(self.execution_folder, 'annual_irradiance_raytracing.done') done_file.parent.mkdir(parents=True, exist_ok=True) done_file.write_text('done!') @@ -183,7 +183,7 @@ def sensor_grids(self): def items(self): try: # assume the input is a file - return qb_load_input_param(self.sensor_grids) + return QueenbeeTask.load_input_param(self.sensor_grids) except: # it is a parameter return pathlib.Path(self.input()['SplitGridFolder']['sensor_grids'].path).as_posix() @@ -470,11 +470,7 @@ def sky_type(self): @property def output_type(self): - return 'solar' - - @property - def output_format(self): - return 'ASCII' + return self._input_params['output_type'] @property def sun_up_hours(self): @@ -482,6 +478,8 @@ def sun_up_hours(self): cumulative = luigi.Parameter(default='hourly') + output_format = luigi.Parameter(default='ASCII') + sky_density = luigi.Parameter(default='1') @property @@ -797,11 +795,7 @@ def sky_type(self): @property def output_type(self): - return 'solar' - - @property - def output_format(self): - return 'ASCII' + return self._input_params['output_type'] @property def sun_up_hours(self): @@ -809,6 +803,8 @@ def sun_up_hours(self): cumulative = luigi.Parameter(default='hourly') + output_format = luigi.Parameter(default='ASCII') + sky_density = luigi.Parameter(default='1') @property @@ -856,7 +852,7 @@ def output_artifacts(self): class GenerateSunpath(QueenbeeTask): - """Generate a Radiance sun matrix (AKA sun-path).""" + """Generate a Radiance sun matrix using honeybee-radiance methods.""" # DAG Input parameters _input_params = luigi.DictParameter() @@ -868,7 +864,7 @@ def north(self): @property def output_type(self): - return '1' + return self._input_params['output_type'] @property def wea(self): @@ -889,7 +885,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'gendaymtx -n -D sunpath.mtx -M suns.mod -O{output_type} -r {north} -v sky.wea'.format(output_type=self.output_type, north=self.north) + return 'honeybee-radiance sunpath radiance sky.wea --name sunpath --{output_type} --north {north}'.format(output_type=self.output_type, north=self.north) def output(self): return { @@ -898,7 +894,7 @@ def output(self): ), 'sun_modifiers': luigi.LocalTarget( - pathlib.Path(self.execution_folder, 'resources/suns.mod').resolve().as_posix() + pathlib.Path(self.execution_folder, 'resources/sunpath.mod').resolve().as_posix() ) } @@ -918,8 +914,8 @@ def output_artifacts(self): }, { - 'name': 'sun-modifiers', 'from': 'suns.mod', - 'to': pathlib.Path(self.execution_folder, 'resources/suns.mod').resolve().as_posix(), + 'name': 'sun-modifiers', 'from': 'sunpath.mod', + 'to': pathlib.Path(self.execution_folder, 'resources/sunpath.mod').resolve().as_posix(), 'optional': False, 'type': 'file' }] @@ -1009,7 +1005,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-radiance grid merge-folder ./input_folder ./output_folder {extension}'.format(extension=self.extension) + return 'honeybee-radiance grid merge-folder ./input_folder ./output_folder {extension} --dist-info dist_info.json'.format(extension=self.extension) def requires(self): return {'AnnualIrradianceRaytracing': AnnualIrradianceRaytracing(_input_params=self._input_params)} @@ -1067,7 +1063,7 @@ def params_folder(self): return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix() def command(self): - return 'honeybee-radiance grid merge-folder ./input_folder ./output_folder {extension}'.format(extension=self.extension) + return 'honeybee-radiance grid merge-folder ./input_folder ./output_folder {extension} --dist-info dist_info.json'.format(extension=self.extension) def requires(self): return {'AnnualIrradianceRaytracing': AnnualIrradianceRaytracing(_input_params=self._input_params)} @@ -1187,7 +1183,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_d75637b2Orchestrator(luigi.WrapperTask): +class _Main_2c2db9eeOrchestrator(luigi.WrapperTask): """Runs all the tasks in this module.""" # user input for this module _input_params = luigi.DictParameter() diff --git a/lbt_recipes/annual_irradiance/package.json b/lbt_recipes/annual_irradiance/package.json index b7fba4ee..67dc4b0a 100644 --- a/lbt_recipes/annual_irradiance/package.json +++ b/lbt_recipes/annual_irradiance/package.json @@ -6,7 +6,7 @@ "type": "MetaData", "annotations": {}, "name": "annual-irradiance", - "tag": "0.2.2", + "tag": "0.2.4", "app_version": null, "keywords": [ "honeybee", @@ -227,6 +227,45 @@ "maximum": 360 } }, + { + "type": "DAGStringInput", + "annotations": {}, + "name": "output-type", + "description": "Text for the type of irradiance output, which can be solar or visible. Note that the output values will still be irradiance (W/m2) when visible is selected but these irradiance values will be just for the visible portion of the electromagnetic spectrum. The visible irradiance values can be converted into illuminance by multiplying them by the Radiance luminous efficacy factor of 179.", + "default": "solar", + "alias": [ + { + "type": "DAGGenericInputAlias", + "annotations": {}, + "name": "visible", + "description": "Text for the type of irradiance output, which can be solar (False) or visible (True). Note that the output values will still be irradiance (W/m2) when visible is selected but these irradiance values will be just for the visible portion of the electromagnetic spectrum. The visible irradiance values can be converted into illuminance by multiplying them by the Radiance luminous efficacy factor of 179. (Default: False).", + "platform": [ + "grasshopper" + ], + "handler": [ + { + "type": "IOAliasHandler", + "annotations": {}, + "language": "python", + "module": "pollination_handlers.inputs.bool_options", + "function": "visible_vs_solar_to_str", + "index": 0 + } + ], + "default": "False", + "required": false, + "spec": null + } + ], + "required": false, + "spec": { + "type": "string", + "enum": [ + "visible", + "solar" + ] + } + }, { "type": "DAGStringInput", "annotations": {}, diff --git a/lbt_recipes/annual_irradiance/run.py b/lbt_recipes/annual_irradiance/run.py index 27ae872f..caf38c3c 100644 --- a/lbt_recipes/annual_irradiance/run.py +++ b/lbt_recipes/annual_irradiance/run.py @@ -28,6 +28,7 @@ 'min_sensor_count': 1, 'model': None, 'north': 0.0, + 'output_type': 'solar', 'radiance_parameters': '-ab 2 -ad 5000 -lw 2e-05', 'timestep': 1, 'wea': None} @@ -38,7 +39,7 @@ class LetAnnualIrradianceFly(luigi.WrapperTask): _input_params = luigi.DictParameter() def requires(self): - yield [annual_irradiance_workerbee._Main_d75637b2Orchestrator(_input_params=self._input_params)] + yield [annual_irradiance_workerbee._Main_2c2db9eeOrchestrator(_input_params=self._input_params)] def start(project_folder, user_values, workers):