honeybee-radiance-postprocess 0.4.555__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. honeybee_radiance_postprocess/__init__.py +1 -0
  2. honeybee_radiance_postprocess/__main__.py +4 -0
  3. honeybee_radiance_postprocess/annual.py +73 -0
  4. honeybee_radiance_postprocess/annualdaylight.py +289 -0
  5. honeybee_radiance_postprocess/annualirradiance.py +35 -0
  6. honeybee_radiance_postprocess/breeam/__init__.py +1 -0
  7. honeybee_radiance_postprocess/breeam/breeam.py +552 -0
  8. honeybee_radiance_postprocess/cli/__init__.py +33 -0
  9. honeybee_radiance_postprocess/cli/abnt.py +392 -0
  10. honeybee_radiance_postprocess/cli/breeam.py +96 -0
  11. honeybee_radiance_postprocess/cli/datacollection.py +133 -0
  12. honeybee_radiance_postprocess/cli/grid.py +295 -0
  13. honeybee_radiance_postprocess/cli/leed.py +143 -0
  14. honeybee_radiance_postprocess/cli/merge.py +161 -0
  15. honeybee_radiance_postprocess/cli/mtxop.py +161 -0
  16. honeybee_radiance_postprocess/cli/postprocess.py +1092 -0
  17. honeybee_radiance_postprocess/cli/schedule.py +103 -0
  18. honeybee_radiance_postprocess/cli/translate.py +216 -0
  19. honeybee_radiance_postprocess/cli/two_phase.py +252 -0
  20. honeybee_radiance_postprocess/cli/util.py +121 -0
  21. honeybee_radiance_postprocess/cli/viewfactor.py +157 -0
  22. honeybee_radiance_postprocess/cli/well.py +110 -0
  23. honeybee_radiance_postprocess/data_type.py +102 -0
  24. honeybee_radiance_postprocess/dynamic.py +273 -0
  25. honeybee_radiance_postprocess/electriclight.py +24 -0
  26. honeybee_radiance_postprocess/en17037.py +304 -0
  27. honeybee_radiance_postprocess/helper.py +266 -0
  28. honeybee_radiance_postprocess/ies/__init__.py +1 -0
  29. honeybee_radiance_postprocess/ies/lm.py +224 -0
  30. honeybee_radiance_postprocess/ies/lm_schedule.py +248 -0
  31. honeybee_radiance_postprocess/leed/__init__.py +1 -0
  32. honeybee_radiance_postprocess/leed/leed.py +801 -0
  33. honeybee_radiance_postprocess/leed/leed_schedule.py +256 -0
  34. honeybee_radiance_postprocess/metrics.py +439 -0
  35. honeybee_radiance_postprocess/reader.py +80 -0
  36. honeybee_radiance_postprocess/results/__init__.py +4 -0
  37. honeybee_radiance_postprocess/results/annual_daylight.py +752 -0
  38. honeybee_radiance_postprocess/results/annual_irradiance.py +196 -0
  39. honeybee_radiance_postprocess/results/results.py +1416 -0
  40. honeybee_radiance_postprocess/type_hints.py +38 -0
  41. honeybee_radiance_postprocess/util.py +211 -0
  42. honeybee_radiance_postprocess/vis_metadata.py +49 -0
  43. honeybee_radiance_postprocess/well/__init__.py +1 -0
  44. honeybee_radiance_postprocess/well/well.py +509 -0
  45. honeybee_radiance_postprocess-0.4.555.dist-info/METADATA +79 -0
  46. honeybee_radiance_postprocess-0.4.555.dist-info/RECORD +50 -0
  47. honeybee_radiance_postprocess-0.4.555.dist-info/WHEEL +5 -0
  48. honeybee_radiance_postprocess-0.4.555.dist-info/entry_points.txt +2 -0
  49. honeybee_radiance_postprocess-0.4.555.dist-info/licenses/LICENSE +661 -0
  50. honeybee_radiance_postprocess-0.4.555.dist-info/top_level.txt +1 -0
@@ -0,0 +1,161 @@
1
+ """Commands to work with Radiance matrices using NumPy."""
2
+ import sys
3
+ import logging
4
+ from pathlib import Path
5
+ import click
6
+ try:
7
+ import cupy as np
8
+ is_gpu = True
9
+ except ImportError:
10
+ is_gpu = False
11
+ import numpy as np
12
+
13
+ from ..reader import binary_to_array, ascii_to_array
14
+
15
+ _logger = logging.getLogger(__name__)
16
+
17
+
18
+ @click.group(help='Commands to work with Radiance matrices using NumPy.')
19
+ def mtxop():
20
+ pass
21
+
22
+
23
+ @mtxop.command('operate-two')
24
+ @click.argument(
25
+ 'first-mtx', type=click.Path(exists=True, dir_okay=False, resolve_path=True)
26
+ )
27
+ @click.argument(
28
+ 'second-mtx', type=click.Path(exists=True, dir_okay=False, resolve_path=True)
29
+ )
30
+ @click.option(
31
+ '--operator', type=click.Choice(['+', '-', '/', '*']), default='+',
32
+ help='Operation between the two matrices.'
33
+ )
34
+ @click.option(
35
+ '--conversion', help='Conversion as a string. This option is useful to post-process '
36
+ 'the results from 3 RGB components into one as part of this command.'
37
+ )
38
+ @click.option(
39
+ '--binary/--ascii', is_flag=True, default=True, help='Switch between binary '
40
+ 'and ascii input matrices. Default is binary.'
41
+ )
42
+ @click.option(
43
+ '--name', '-n', help='Output file name.', default='output', show_default=True
44
+ )
45
+ @click.option(
46
+ '--output-folder', '-of', help='Output folder.', default='.',
47
+ type=click.Path(exists=False, file_okay=False, dir_okay=True, resolve_path=True)
48
+ )
49
+ def two_matrix_operations(
50
+ first_mtx, second_mtx, operator, conversion, binary, name, output_folder
51
+ ):
52
+ """Operations between two Radiance matrices.
53
+
54
+ The input matrices must be Radiance binary matrices. The operations will be performed
55
+ elementwise for the matrices.
56
+
57
+ \b
58
+ Args:
59
+ first-mtx: Path to fist matrix.
60
+ second-mtx: Path to second matrix.
61
+ """
62
+ try:
63
+ if binary:
64
+ first = binary_to_array(first_mtx)
65
+ second = binary_to_array(second_mtx)
66
+ else:
67
+ first = ascii_to_array(first_mtx)
68
+ second = ascii_to_array(second_mtx)
69
+
70
+ data = eval('first %s second' % operator)
71
+
72
+ if conversion:
73
+ conversion = list(map(float, conversion.split(' ')))
74
+ conversion = np.array(conversion, dtype=np.float32)
75
+ data = np.dot(data, conversion)
76
+
77
+ output = Path(output_folder, name)
78
+ output.parent.mkdir(parents=True, exist_ok=True)
79
+ np.save(output, data)
80
+
81
+ except Exception:
82
+ _logger.exception('Operation on two Radiance matrix failed.')
83
+ sys.exit(1)
84
+ else:
85
+ sys.exit(0)
86
+
87
+
88
+ @mtxop.command('operate-three')
89
+ @click.argument(
90
+ 'first-mtx', type=click.Path(exists=True, dir_okay=False, resolve_path=True)
91
+ )
92
+ @click.argument(
93
+ 'second-mtx', type=click.Path(exists=True, dir_okay=False, resolve_path=True)
94
+ )
95
+ @click.argument(
96
+ 'third-mtx', type=click.Path(exists=True, dir_okay=False, resolve_path=True)
97
+ )
98
+ @click.option(
99
+ '--operator-one', type=click.Choice(['+', '-', '/', '*']), default='+',
100
+ help='Operation between the two matrices.'
101
+ )
102
+ @click.option(
103
+ '--operator-two', type=click.Choice(['+', '-', '/', '*']), default='+',
104
+ help='Operation between the two matrices.'
105
+ )
106
+ @click.option(
107
+ '--conversion', help='Conversion as a string. This option is useful to post-process '
108
+ 'the results from 3 RGB components into one as part of this command.'
109
+ )
110
+ @click.option(
111
+ '--binary/--ascii', is_flag=True, default=True, help='Switch between binary '
112
+ 'and ascii input matrices. Default is binary.'
113
+ )
114
+ @click.option(
115
+ '--name', '-n', help='Output file name.', default='output', show_default=True
116
+ )
117
+ @click.option(
118
+ '--output-folder', '-of', help='Output folder.', default='.',
119
+ type=click.Path(exists=False, file_okay=False, dir_okay=True, resolve_path=True)
120
+ )
121
+ def three_matrix_operations(
122
+ first_mtx, second_mtx, third_mtx, operator_one, operator_two, conversion,
123
+ binary, name, output_folder
124
+ ):
125
+ """Operations between three Radiance matrices.
126
+
127
+ The input matrices must be Radiance binary matrices. The operations will be performed
128
+ elementwise for the matrices.
129
+
130
+ \b
131
+ Args:
132
+ first-mtx: Path to fist matrix.
133
+ second-mtx: Path to second matrix.
134
+ third-mtx: Path to third matrix.
135
+ """
136
+ try:
137
+ if binary:
138
+ first = binary_to_array(first_mtx)
139
+ second = binary_to_array(second_mtx)
140
+ third = binary_to_array(third_mtx)
141
+ else:
142
+ first = ascii_to_array(first_mtx)
143
+ second = ascii_to_array(second_mtx)
144
+ third = ascii_to_array(third_mtx)
145
+
146
+ data = eval('first %s second %s third' % (operator_one, operator_two))
147
+
148
+ if conversion:
149
+ conversion = list(map(float, conversion.split(' ')))
150
+ conversion = np.array(conversion, dtype=np.float32)
151
+ data = np.dot(data, conversion)
152
+
153
+ output = Path(output_folder, name)
154
+ output.parent.mkdir(parents=True, exist_ok=True)
155
+ np.save(output, data)
156
+
157
+ except Exception:
158
+ _logger.exception('Operation on three Radiance matrix failed.')
159
+ sys.exit(1)
160
+ else:
161
+ sys.exit(0)