honeybee-grasshopper-radiance 1.35.1__py3-none-any.whl → 1.35.3__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.
@@ -0,0 +1,187 @@
1
+ # Honeybee: A Plugin for Environmental Analysis (GPL)
2
+ # This file is part of Honeybee.
3
+ #
4
+ # Copyright (c) 2025, Ladybug Tools.
5
+ # You should have received a copy of the GNU Affero General Public License
6
+ # along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
7
+ #
8
+ # @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
9
+
10
+ """
11
+ Calculate typical statistics (Average, median, minimum, maximum, sum) for an
12
+ annual daylight or irradiance simulation.
13
+
14
+ Statistics can either be computed per sensor or per timestep.
15
+
16
+ -
17
+ Args:
18
+ _results: An list of annual Radiance result files from the "HB Annual Daylight"
19
+ component (containing the .ill files and the sun-up-hours.txt).
20
+ This can also be just the path to the folder containing these
21
+ result files.
22
+ dyn_sch_: Optional dynamic Aperture Group Schedules from the "HB Aperture Group
23
+ Schedule" component, which will be used to customize the behavior
24
+ of any dyanmic aperture geometry in the output metrics. If unsupplied,
25
+ all dynamic aperture groups will be in their default state in for
26
+ the output metrics.
27
+ _hoys_: An optional numbers or list of numbers to select the hours of the year (HOYs)
28
+ for which results will be computed. These HOYs can be obtained from the
29
+ "LB Calculate HOY" or the "LB Analysis Period" components. If None, all
30
+ hours of the results will be used.
31
+ grid_filter_: The name of a grid or a pattern to filter the grids. For instance,
32
+ first_floor_* will simulate only the sensor grids that have an
33
+ identifier that starts with first_floor_. By default all the grids
34
+ will be processed.
35
+ per_timestep_: Set to True to calculate statistics per-timestep instead of per-sensor.
36
+ (Default: False)
37
+
38
+ Returns:
39
+ report: Reports, errors, warnings, etc.
40
+ average: Average illuminance or irradiance values for each sensor or timestep
41
+ in lux or W/m2. This is either a list of values or a list of data collections
42
+ if per_timestep_ is True.
43
+ median: Median illuminance or irradiance values for each sensor or timestep
44
+ in lux or W/m2. This is either a list of values or a list of data collections
45
+ if per_timestep_ is True.
46
+ minimum: Minimum illuminance or irradiance values for each sensor or timestep
47
+ in lux or W/m2. This is either a list of values or a list of data collections
48
+ if per_timestep_ is True.
49
+ maximum: Maximum illuminance or irradiance values for each sensor or timestep
50
+ in lux or W/m2. This is either a list of values or a list of data collections
51
+ if per_timestep_ is True.
52
+ cumulative: Cumulative illuminance or irradiance values for each sensor or timestep
53
+ in lux or W/m2. This is either a list of values or a list of data collections
54
+ if per_timestep_ is True.
55
+ """
56
+
57
+ ghenv.Component.Name = "HB Annual Statistics"
58
+ ghenv.Component.NickName = 'AnnualStatistics'
59
+ ghenv.Component.Message = '1.9.0'
60
+ ghenv.Component.Category = 'HB-Radiance'
61
+ ghenv.Component.SubCategory = '4 :: Results'
62
+ ghenv.Component.AdditionalHelpFromDocStrings = '2'
63
+
64
+ import os
65
+ import json
66
+ import subprocess
67
+
68
+ try:
69
+ from ladybug.datacollection import HourlyContinuousCollection
70
+ from ladybug.futil import write_to_file
71
+ except ImportError as e:
72
+ raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
73
+
74
+ try:
75
+ from honeybee.config import folders
76
+ except ImportError as e:
77
+ raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
78
+
79
+ try:
80
+ from honeybee_radiance_postprocess.dynamic import DynamicSchedule
81
+ except ImportError as e:
82
+ raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
83
+
84
+ try:
85
+ from pollination_handlers.outputs.helper import read_sensor_grid_result
86
+ except ImportError as e:
87
+ raise ImportError('\nFailed to import pollination_handlers:\n\t{}'.format(e))
88
+
89
+ try:
90
+ from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree, \
91
+ give_warning
92
+ except ImportError as e:
93
+ raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
94
+
95
+
96
+ if all_required_inputs(ghenv.Component):
97
+ # compute the annual summary
98
+ grid_filter_ = '*' if grid_filter_ is None else grid_filter_
99
+ res_folder = _results
100
+ per_timestep = False if per_timestep_ is None else per_timestep_
101
+
102
+ # check to see if results use the newer numpy arrays
103
+ if os.path.isdir(os.path.join(res_folder, '__static_apertures__')) or \
104
+ os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
105
+ cmds = [folders.python_exe_path, '-m', 'honeybee_radiance_postprocess',
106
+ 'post-process', 'annual-statistics', res_folder, '-sf',
107
+ 'statistics']
108
+ if len(_hoys_) != 0:
109
+ hoys_str = '\n'.join(str(h) for h in _hoys_)
110
+ hoys_file = os.path.join(res_folder, 'hoys.txt')
111
+ write_to_file(hoys_file, hoys_str)
112
+ cmds.extend(['--hoys-file', hoys_file])
113
+ if grid_filter_ != '*':
114
+ cmds.extend(['--grids-filter', grid_filter_])
115
+ if len(dyn_sch_) != 0:
116
+ if os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
117
+ dyn_sch = dyn_sch_[0] if isinstance(dyn_sch_[0], DynamicSchedule) else \
118
+ DynamicSchedule.from_group_schedules(dyn_sch_)
119
+ dyn_sch_file = dyn_sch.to_json(folder=res_folder)
120
+ cmds.extend(['--states', dyn_sch_file])
121
+ else:
122
+ msg = 'No dynamic aperture groups were found in the Model.\n' \
123
+ 'The input dynamic schedules will be ignored.'
124
+ print(msg)
125
+ give_warning(ghenv.Component, msg)
126
+
127
+ if per_timestep:
128
+ cmds.extend(['--timestep'])
129
+
130
+ use_shell = True if os.name == 'nt' else False
131
+ custom_env = os.environ.copy()
132
+ custom_env['PYTHONHOME'] = ''
133
+ process = subprocess.Popen(
134
+ cmds, cwd=res_folder, shell=use_shell, env=custom_env,
135
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
136
+ stdout = process.communicate() # wait for the process to finish
137
+ if stdout[-1] != '':
138
+ print(stdout[-1])
139
+ raise ValueError('Failed to compute {} values.'.format(res_type))
140
+
141
+ res_dir = os.path.join(res_folder, 'statistics')
142
+ average_values_dir = os.path.join(res_dir, 'average_values')
143
+ median_values_dir = os.path.join(res_dir, 'median_values')
144
+ minimum_values_dir = os.path.join(res_dir, 'minimum_values')
145
+ maximum_values_dir = os.path.join(res_dir, 'maximum_values')
146
+ cumulative_values_dir = os.path.join(res_dir, 'cumulative_values')
147
+
148
+ if per_timestep is False:
149
+ average = list_to_data_tree(read_sensor_grid_result(average_values_dir, 'average', 'full_id', False))
150
+ median = list_to_data_tree(read_sensor_grid_result(median_values_dir, 'median', 'full_id', False))
151
+ minimum = list_to_data_tree(read_sensor_grid_result(minimum_values_dir, 'minimum', 'full_id', False))
152
+ maximum = list_to_data_tree(read_sensor_grid_result(maximum_values_dir, 'maximum', 'full_id', False))
153
+ cumulative = list_to_data_tree(read_sensor_grid_result(cumulative_values_dir, 'cumulative', 'full_id', False))
154
+ else:
155
+ with open(os.path.join(average_values_dir, 'grids_info.json')) as json_file:
156
+ grids_info = json.load(json_file)
157
+ average = []
158
+ median = []
159
+ minimum = []
160
+ maximum = []
161
+ cumulative = []
162
+ for grid_info in grids_info:
163
+ with open(os.path.join(average_values_dir, '{}_average.json'.format(grid_info['full_id']))) as json_file:
164
+ data_dict = json.load(json_file)
165
+ average.append(HourlyContinuousCollection.from_dict(data_dict))
166
+ with open(os.path.join(median_values_dir, '{}_median.json'.format(grid_info['full_id']))) as json_file:
167
+ data_dict = json.load(json_file)
168
+ median.append(HourlyContinuousCollection.from_dict(data_dict))
169
+ with open(os.path.join(minimum_values_dir, '{}_minimum.json'.format(grid_info['full_id']))) as json_file:
170
+ data_dict = json.load(json_file)
171
+ minimum.append(HourlyContinuousCollection.from_dict(data_dict))
172
+ with open(os.path.join(maximum_values_dir, '{}_maximum.json'.format(grid_info['full_id']))) as json_file:
173
+ data_dict = json.load(json_file)
174
+ maximum.append(HourlyContinuousCollection.from_dict(data_dict))
175
+ with open(os.path.join(cumulative_values_dir, '{}_cumulative.json'.format(grid_info['full_id']))) as json_file:
176
+ data_dict = json.load(json_file)
177
+ cumulative.append(HourlyContinuousCollection.from_dict(data_dict))
178
+ average = list_to_data_tree(average)
179
+ median = list_to_data_tree(median)
180
+ minimum = list_to_data_tree(minimum)
181
+ maximum = list_to_data_tree(maximum)
182
+ cumulative = list_to_data_tree(cumulative)
183
+ else:
184
+ msg = 'Summary is only only supported for Annual Daylight and Annual Irradiance ' \
185
+ 'simulations with NumPy arrays.'
186
+ print(msg)
187
+ give_warning(ghenv.Component, msg)
@@ -47,7 +47,7 @@ compliant.
47
47
 
48
48
  ghenv.Component.Name = 'HB Spatial Daylight Autonomy'
49
49
  ghenv.Component.NickName = 'sDA'
50
- ghenv.Component.Message = '1.9.0'
50
+ ghenv.Component.Message = '1.9.1'
51
51
  ghenv.Component.Category = 'HB-Radiance'
52
52
  ghenv.Component.SubCategory = '4 :: Results'
53
53
  ghenv.Component.AdditionalHelpFromDocStrings = '1'
@@ -75,12 +75,12 @@ if all_required_inputs(ghenv.Component):
75
75
 
76
76
  # compute spatial daylight autonomy from the pass/fail results
77
77
  if len(lb_meshes) == 0: # all sensors represent the same area
78
- sDA = [sum(pf_list) / len(pf_list) for pf_list in pass_fail]
78
+ sDA = [round(sum(pf_list) / len(pf_list) * 100, 2) for pf_list in pass_fail]
79
79
  else: # weight the sensors based on the area of mesh faces
80
80
  sDA = []
81
81
  for i, mesh in enumerate(lb_meshes):
82
82
  m_area = mesh.area
83
83
  weights = [fa / m_area for fa in mesh.face_areas]
84
- sDA.append(sum(v * w for v, w in zip(pass_fail[i], weights)))
84
+ sDA.append(round(sum(v * w for v, w in zip(pass_fail[i], weights)) * 100, 2))
85
85
 
86
86
  pass_fail = list_to_data_tree(pass_fail) # convert matrix to data tree
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: honeybee-grasshopper-radiance
3
- Version: 1.35.1
3
+ Version: 1.35.3
4
4
  Summary: Honeybee Radiance plugin for Grasshopper.
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-grasshopper-radiance
6
6
  Author: Ladybug Tools
@@ -9,6 +9,7 @@ honeybee_grasshopper_radiance/src/HB Annual Glare Metrics.py,sha256=Uu-aqGjt3jlI
9
9
  honeybee_grasshopper_radiance/src/HB Annual Irradiance.py,sha256=siIRkhWb2i_wgZamlJGKktkgZ7CPi7qsML13Slti3Y4,6032
10
10
  honeybee_grasshopper_radiance/src/HB Annual Peak Values.py,sha256=x-q1Y6tUTsOovB5C6Y2E47L9XpSPE-Jv0WAY5Rdtim0,10002
11
11
  honeybee_grasshopper_radiance/src/HB Annual Results to Data.py,sha256=4HeXXyOFVQEBz60g4vC4f404BKjqmowUX6YZWNKzhvA,11021
12
+ honeybee_grasshopper_radiance/src/HB Annual Statistics.py,sha256=HGDZuvqHjjv77yA0HDjYdYESoXEQ5XRqkDE6498b1YQ,9526
12
13
  honeybee_grasshopper_radiance/src/HB Annual Sunlight Exposure.py,sha256=NlJefTSQofAIZrlG_PClFhYdXhfE_rChH81mRW9Gr0w,6393
13
14
  honeybee_grasshopper_radiance/src/HB Aperture Group Schedule.py,sha256=nL0lSzHEDI9iBGRSJODFAC1xDPu-GxTNIxGKa4qu7a8,3052
14
15
  honeybee_grasshopper_radiance/src/HB Apply Face Modifier.py,sha256=Hl73JhJpvQR052x0TRjJvp0CQ84VwaBBeQijVw9QhWY,4475
@@ -68,7 +69,7 @@ honeybee_grasshopper_radiance/src/HB Sensor Grid from Rooms.py,sha256=he2oyS-30Z
68
69
  honeybee_grasshopper_radiance/src/HB Sensor Grid.py,sha256=VSMyAyHtSdCfHMKxedxsDOOramROzGm5D54Pnd-iGLs,3595
69
70
  honeybee_grasshopper_radiance/src/HB Shade Modifier Subset.py,sha256=Nd0GhA_a9kzwD_zdKlE-OfFdqOOu8czWnpVmgto5Atw,2253
70
71
  honeybee_grasshopper_radiance/src/HB Sky View.py,sha256=XkABHrKuD1u94rirfaTGBNv7t2Tuggk56mYtpYZztnk,3832
71
- honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py,sha256=MHp-sLemqau3Wod-1DMUW5HSQ5ISK8gkztmS1ThTVWU,3985
72
+ honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py,sha256=PMAu1r9abhXMvl1RdFcy_-sy-vnQLbb0xQTdSKoH-G0,4017
72
73
  honeybee_grasshopper_radiance/src/HB Subface Modifier Subset.py,sha256=XZ7aNh5KnmMeohQqRe9Sjxg2tJ-0PDuGWKJNXqEwSdM,3837
73
74
  honeybee_grasshopper_radiance/src/HB Translucent Modifier 3.py,sha256=XR-dTuNmv6mfmjqTDPR-4xgb4-paX9oqZ_mlY7nYyZI,3460
74
75
  honeybee_grasshopper_radiance/src/HB Translucent Modifier.py,sha256=Sq3PTHjaYXKTlJvrrq9b-HI5cirrVW-jnuWDITVNSyU,3389
@@ -90,6 +91,7 @@ honeybee_grasshopper_radiance/user_objects/HB Annual Glare Metrics.ghuser,sha256
90
91
  honeybee_grasshopper_radiance/user_objects/HB Annual Irradiance.ghuser,sha256=w1r_ZZqRwsjTv6hw06xjc86uD_-mCIO-y9rbQS09eL4,7347
91
92
  honeybee_grasshopper_radiance/user_objects/HB Annual Peak Values.ghuser,sha256=9OM0F7Po7CuKPbxLNIvh-G_IxDKddhdelIYaq6K7j8Y,7127
92
93
  honeybee_grasshopper_radiance/user_objects/HB Annual Results to Data.ghuser,sha256=bQ9T5VAVir1Cb7CynWMNmJSAz-bk6S57z0IwKILq6hs,7147
94
+ honeybee_grasshopper_radiance/user_objects/HB Annual Statistics.ghuser,sha256=4IY2aovV99kob3iPTTlVgLJ9ZjFaY_sN2Y5ZX1OLomQ,6733
93
95
  honeybee_grasshopper_radiance/user_objects/HB Annual Sunlight Exposure.ghuser,sha256=SoeX9wjEJH1BJbDwGpdyuqeJO8EK2LLjskYRprIL_xI,5578
94
96
  honeybee_grasshopper_radiance/user_objects/HB Aperture Group Schedule.ghuser,sha256=7-tSPfPcf4DkuQGBv3MruJOnlffX8g0pf5_GRW1brHw,5178
95
97
  honeybee_grasshopper_radiance/user_objects/HB Apply Face Modifier.ghuser,sha256=tDRYfk6OGwxzvkilbeLX7QwY95W-l9sveozSc2Xb2Ys,4978
@@ -151,7 +153,7 @@ honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Rooms.ghuser,sha2
151
153
  honeybee_grasshopper_radiance/user_objects/HB Sensor Grid.ghuser,sha256=JkUlxudZScZ-nwaAlwaOGuRqlDpopQgFWy2xXrNfRKE,5630
152
154
  honeybee_grasshopper_radiance/user_objects/HB Shade Modifier Subset.ghuser,sha256=kq72225e76XlNb7oqrpAenBlOnxFFiMm-1jUPc8wDVc,4478
153
155
  honeybee_grasshopper_radiance/user_objects/HB Sky View.ghuser,sha256=eJX4GUVIRFTMEmyLikooCbmoy32N9NZcjDkenHKvkQQ,6009
154
- honeybee_grasshopper_radiance/user_objects/HB Spatial Daylight Autonomy.ghuser,sha256=b3CJgY1p0exjaXCLIjVm0TVEZRAeUdKtmD3kJrE7RUM,5979
156
+ honeybee_grasshopper_radiance/user_objects/HB Spatial Daylight Autonomy.ghuser,sha256=_Bw5jUjKKcdEEozVXUVL45yZB6F4BqIwzmRU_jSwbBA,6011
155
157
  honeybee_grasshopper_radiance/user_objects/HB Subface Modifier Subset.ghuser,sha256=e0BN1wVqK-1v1vd1BMDIMC9hwb6QQ4Uy2Gm_6gq3g98,4894
156
158
  honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier 3.ghuser,sha256=wO6GWYRsHQVoQUW7bF1ws01kiUDsaimUCWrinaj-TOw,5552
157
159
  honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier.ghuser,sha256=TMgFn8NMjq6LkLDKzoUA5W4CCk2LAWsr4iHgod09FLs,5161
@@ -163,8 +165,8 @@ honeybee_grasshopper_radiance/user_objects/HB Wea From EPW.ghuser,sha256=PcjwWzO
163
165
  honeybee_grasshopper_radiance/user_objects/HB Wea From Tau Clear Sky.ghuser,sha256=du9nzM95d3uL2-1sf1fFll_QfRloVaL4Q_JGd7Nb5NI,5367
164
166
  honeybee_grasshopper_radiance/user_objects/HB Wea from Zhang-Huang.ghuser,sha256=9KMXIDn5sfhk0h4QfZoKfFuHvI6x0bXVDJ3Ozd2CWNg,4678
165
167
  honeybee_grasshopper_radiance/user_objects/__init__.py,sha256=7BOscRVupILqwFUBWP6nAsMNgNN8lXQPsQ_zYUvGEr8,50
166
- honeybee_grasshopper_radiance-1.35.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
167
- honeybee_grasshopper_radiance-1.35.1.dist-info/METADATA,sha256=t4qd9koJ_-bDuPD_u98BFyeB6UWuLWUeSwqMDLaIcyU,2879
168
- honeybee_grasshopper_radiance-1.35.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
169
- honeybee_grasshopper_radiance-1.35.1.dist-info/top_level.txt,sha256=BBzJ4nJKMDfzWMqymIH91kdsQlHSptnGHSk8i6_KZ_4,30
170
- honeybee_grasshopper_radiance-1.35.1.dist-info/RECORD,,
168
+ honeybee_grasshopper_radiance-1.35.3.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
169
+ honeybee_grasshopper_radiance-1.35.3.dist-info/METADATA,sha256=a6l_szw6CKFQ9-6QPyz4r6KPhFLNZ5FSO3rMDr1JV6A,2879
170
+ honeybee_grasshopper_radiance-1.35.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
171
+ honeybee_grasshopper_radiance-1.35.3.dist-info/top_level.txt,sha256=BBzJ4nJKMDfzWMqymIH91kdsQlHSptnGHSk8i6_KZ_4,30
172
+ honeybee_grasshopper_radiance-1.35.3.dist-info/RECORD,,