diff --git a/pollination/honeybee_radiance/post_process.py b/pollination/honeybee_radiance/post_process.py index c51a410..ea66006 100644 --- a/pollination/honeybee_radiance/post_process.py +++ b/pollination/honeybee_radiance/post_process.py @@ -523,6 +523,28 @@ def create_daylight_factor_config(self): cfg_file = Outputs.file(description='Output config file.', path='config.json') +@dataclass +class PointInTimeVisMetadata(Function): + """Create a visualization metadata file for point-in-time.""" + + metric = Inputs.str( + description='Text for the type of metric to be output from the calculation. ' + 'Choose from: illuminance, irradiance, luminance, radiance.', + default='illuminance', + spec={'type': 'string', + 'enum': ['illuminance', 'irradiance', 'luminance', 'radiance']} + ) + + @command + def create_point_in_time_vis_data(self): + return 'honeybee-radiance post-process point-in-time-vis-metadata ' \ + '--metric {{self.metric}} --output-file vis_metadata.json' + + # outputs + cfg_file = Outputs.file( + description='Output visualization metadata file.', path='vis_metadata.json') + + @dataclass class PointInTimeConfig(Function): """Create a config file for point-in-time results.""" diff --git a/tests/post_process_test.py b/tests/post_process_test.py index 8021b75..6825ed6 100644 --- a/tests/post_process_test.py +++ b/tests/post_process_test.py @@ -4,7 +4,7 @@ from pollination.honeybee_radiance.post_process import ConvertToBinary, SumRow, \ AnnualIrradianceMetrics, AnnualDaylightMetrics, LeedIlluminanceCredits, \ SolarTrackingSynthesis, DaylightFactorConfig, DaylightFactorVisMetadata, \ - ImagelessAnnualGlareVisMetadata + ImagelessAnnualGlareVisMetadata, PointInTimeVisMetadata from queenbee.plugin.function import Function @@ -83,3 +83,19 @@ def test_imageless_annual_glare_vis_metadata(): assert output_file.is_file() nukedir(folder) + +def test_point_in_time_vis_metadata(): + function = PointInTimeVisMetadata() + qb_function = function.queenbee + assert qb_function.name == 'point-in-time-vis-metadata' + assert isinstance(qb_function, Function) + + inputs = {'metric': 'illuminance'} + folder = Path('./tests/assets/temp') + if not folder.exists(): + folder.mkdir(parents=True) + output_file = folder.joinpath('vis_metadata.json') + function._try(inputs, folder=folder) + assert output_file.is_file() + + nukedir(folder)