Skip to content

Commit

Permalink
fix(mtx): Add output format to functions (#66)
Browse files Browse the repository at this point in the history
* fix(mtx): Add output format to PMV matrix

* fix(map): Add output format to irradiance contrib map

* fix(mtx): Add output format to adaptive matrix
  • Loading branch information
mikkelkp authored Aug 20, 2024
1 parent c44a8cc commit 49f8528
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
13 changes: 12 additions & 1 deletion pollination/ladybug_comfort/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,22 @@ class IrradianceContribMap(Function):
'with the irradiance.'
)

output_format = Inputs.str(
description='Flag to note whether the output should be formatted as a '
'plain text CSV or whether it should be formatted as a binary numpy '
'array. Using binary will decrease the file size, however, to read the '
'contents of the file you have to pass it through numpy, whereas the '
'plain text file can be opened in a text editor.',
default='plain-text',
spec={'type': 'string', 'enum': ['plain-text', 'binary']}
)

@command
def run_irradiance_contrib(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 "{{self.aperture_id}}" --folder output'
'sun-up-hours.txt --aperture-id "{{self.aperture_id}}" ' \
'--{{self.output_format}} --folder output'

result_folder = Outputs.folder(
description='Folder containing all of the output .ill files.', path='output'
Expand Down
25 changes: 23 additions & 2 deletions pollination/ladybug_comfort/mtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ class PmvMtx(Function):
spec={'type': 'string', 'enum': ['write-op-map', 'write-set-map']}
)

output_format = Inputs.str(
description='Flag to note whether the output should be formatted as a '
'plain text CSV or whether it should be formatted as a binary numpy '
'array. Using binary will decrease the file size, however, to read the '
'contents of the file you have to pass it through numpy, whereas the '
'plain text file can be opened in a text editor.',
default='plain-text',
spec={'type': 'string', 'enum': ['plain-text', 'binary']}
)

@command
def run_pmv_mtx(self):
return 'ladybug-comfort mtx pmv air_temperature.csv rel_humidity.csv ' \
'--rad-temperature-mtx rad_temperature.csv --rad-delta-mtx rad_delta.csv ' \
'--air-speed-json air_speed.json --met-rate met.txt ' \
'--clo-value clo.txt --comfort-par "{{self.comfort_par}}" ' \
'--{{self.write_set_map}} --folder output'
'--{{self.write_set_map}} --{{self.output_format}} ' \
'--folder output'

result_folder = Outputs.folder(
description='Folder containing all of the output CSV files.', path='output'
Expand Down Expand Up @@ -132,12 +143,22 @@ class AdaptiveMtx(Function):
'the Adaptive comfort model.', default='--standard ASHRAE-55'
)

output_format = Inputs.str(
description='Flag to note whether the output should be formatted as a '
'plain text CSV or whether it should be formatted as a binary numpy '
'array. Using binary will decrease the file size, however, to read the '
'contents of the file you have to pass it through numpy, whereas the '
'plain text file can be opened in a text editor.',
default='plain-text',
spec={'type': 'string', 'enum': ['plain-text', 'binary']}
)

@command
def run_adaptive_mtx(self):
return 'ladybug-comfort mtx adaptive air_temperature.csv prevailing.csv ' \
'--rad-temperature-mtx rad_temperature.csv --rad-delta-mtx rad_delta.csv ' \
'--air-speed-json air_speed.json --comfort-par "{{self.comfort_par}}" ' \
'--folder output'
'--{{self.output_format}} --folder output'

result_folder = Outputs.folder(
description='Folder containing all of the output CSV files.', path='output'
Expand Down

0 comments on commit 49f8528

Please sign in to comment.