honeybee-grasshopper-radiance 1.35.1__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.
- honeybee_grasshopper_radiance/__init__.py +7 -0
- honeybee_grasshopper_radiance/src/HB Adjust HDR.py +107 -0
- honeybee_grasshopper_radiance/src/HB Ambient Resolution.py +63 -0
- honeybee_grasshopper_radiance/src/HB Annual Average Values.py +205 -0
- honeybee_grasshopper_radiance/src/HB Annual Cumulative Values.py +191 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight Metrics.py +209 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight.py +153 -0
- honeybee_grasshopper_radiance/src/HB Annual Glare Metrics.py +137 -0
- honeybee_grasshopper_radiance/src/HB Annual Irradiance.py +112 -0
- honeybee_grasshopper_radiance/src/HB Annual Peak Values.py +224 -0
- honeybee_grasshopper_radiance/src/HB Annual Results to Data.py +246 -0
- honeybee_grasshopper_radiance/src/HB Annual Sunlight Exposure.py +147 -0
- honeybee_grasshopper_radiance/src/HB Aperture Group Schedule.py +69 -0
- honeybee_grasshopper_radiance/src/HB Apply Face Modifier.py +107 -0
- honeybee_grasshopper_radiance/src/HB Apply ModifierSet.py +71 -0
- honeybee_grasshopper_radiance/src/HB Apply Shade Modifier.py +110 -0
- honeybee_grasshopper_radiance/src/HB Apply Window Modifier.py +120 -0
- honeybee_grasshopper_radiance/src/HB Assign Grids and Views.py +58 -0
- honeybee_grasshopper_radiance/src/HB Automatic Aperture Group.py +100 -0
- honeybee_grasshopper_radiance/src/HB BSDF Modifier.py +78 -0
- honeybee_grasshopper_radiance/src/HB CIE Standard Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Certain Illuminance.py +41 -0
- honeybee_grasshopper_radiance/src/HB Check Scene.py +208 -0
- honeybee_grasshopper_radiance/src/HB Climatebased Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Cumulative Radiation.py +98 -0
- honeybee_grasshopper_radiance/src/HB Custom Sky.py +74 -0
- honeybee_grasshopper_radiance/src/HB Daylight Control Schedule.py +211 -0
- honeybee_grasshopper_radiance/src/HB Daylight Factor.py +82 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Modifier.py +47 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet Interior.py +67 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet.py +80 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Wea.py +44 -0
- honeybee_grasshopper_radiance/src/HB Direct Sun Hours.py +88 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Aperture Group.py +90 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Shade Group.py +95 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State Geometry.py +68 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State.py +44 -0
- honeybee_grasshopper_radiance/src/HB Exterior Modifier Subset.py +68 -0
- honeybee_grasshopper_radiance/src/HB Extract HDR.py +225 -0
- honeybee_grasshopper_radiance/src/HB False Color.py +246 -0
- honeybee_grasshopper_radiance/src/HB Get Dynamic Groups.py +57 -0
- honeybee_grasshopper_radiance/src/HB Get Grids and Views.py +82 -0
- honeybee_grasshopper_radiance/src/HB Glare Postprocess.py +225 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier 3.py +62 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier.py +58 -0
- honeybee_grasshopper_radiance/src/HB HDR to GIF.py +72 -0
- honeybee_grasshopper_radiance/src/HB Imageless Annual Glare.py +108 -0
- honeybee_grasshopper_radiance/src/HB Interior Modifier Subset.py +83 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier 3.py +70 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier.py +68 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier 3.py +56 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier.py +55 -0
- honeybee_grasshopper_radiance/src/HB Model to Rad Folder.py +75 -0
- honeybee_grasshopper_radiance/src/HB ModifierSet.py +127 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier 3.py +68 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier.py +67 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time Grid-Based.py +93 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time View-Based.py +127 -0
- honeybee_grasshopper_radiance/src/HB Radial Grid from Rooms.py +160 -0
- honeybee_grasshopper_radiance/src/HB Radial Sensor Grid.py +99 -0
- honeybee_grasshopper_radiance/src/HB Radiance Parameter.py +163 -0
- honeybee_grasshopper_radiance/src/HB Search Modifier Sets.py +58 -0
- honeybee_grasshopper_radiance/src/HB Search Modifiers.py +58 -0
- honeybee_grasshopper_radiance/src/HB Section Plane View.py +69 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Apertures.py +153 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Faces.py +147 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Rooms.py +210 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid.py +82 -0
- honeybee_grasshopper_radiance/src/HB Shade Modifier Subset.py +62 -0
- honeybee_grasshopper_radiance/src/HB Sky View.py +86 -0
- honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py +86 -0
- honeybee_grasshopper_radiance/src/HB Subface Modifier Subset.py +90 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier 3.py +77 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier.py +77 -0
- honeybee_grasshopper_radiance/src/HB View from Viewport.py +85 -0
- honeybee_grasshopper_radiance/src/HB View.py +96 -0
- honeybee_grasshopper_radiance/src/HB Visualize Sky.py +141 -0
- honeybee_grasshopper_radiance/src/HB Wea From Clear Sky.py +61 -0
- honeybee_grasshopper_radiance/src/HB Wea From EPW.py +50 -0
- honeybee_grasshopper_radiance/src/HB Wea From Tau Clear Sky.py +56 -0
- honeybee_grasshopper_radiance/src/HB Wea from Zhang-Huang.py +63 -0
- honeybee_grasshopper_radiance/src/__init__.py +1 -0
- honeybee_grasshopper_radiance/user_objects/HB Adjust HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Ambient Resolution.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Average Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Cumulative Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Glare Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Irradiance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Peak Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Results to Data.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Sunlight Exposure.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Aperture Group Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Face Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Shade Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Window Modifier.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Automatic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB BSDF Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB CIE Standard Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Certain Illuminance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Check Scene.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Climatebased Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Cumulative Radiation.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Custom Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Control Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Factor.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet Interior.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Wea.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Direct Sun Hours.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Shade Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State Geometry.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Exterior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Extract HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Face Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB False Color.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Get Dynamic Groups.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glare Postprocess.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB HDR to GIF.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Imageless Annual Glare.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Interior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Model to Rad Folder.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time Grid-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time View-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radiance Parameter.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Room Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifier Sets.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifiers.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Section Plane View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Apertures.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Faces.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Shade Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sky View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Spatial Daylight Autonomy.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Subface Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View from Viewport.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Visualize Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From EPW.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Tau Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea from Zhang-Huang.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/__init__.py +1 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/METADATA +64 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/RECORD +170 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/WHEEL +5 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/licenses/LICENSE +661 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Honeybee Grasshopper Radiance Plugin.
|
|
2
|
+
|
|
3
|
+
Note that this package is not intended to run with cPython and it only possesses
|
|
4
|
+
the Grasshopper components. In order to run the plugin, the core libraries must
|
|
5
|
+
be installed in a manner that they can be discovered by Rhino.
|
|
6
|
+
The package includes both the userobjects (.ghuser) and the Python source (.py).
|
|
7
|
+
"""
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# This file is part of Honeybee.
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Adjust and format a High Dynamic Range (HDR) image file.
|
|
11
|
+
_
|
|
12
|
+
Possible adjustments include chaging the exposure of the image to mimic what would
|
|
13
|
+
be seen by a human eye and adding an optional text label to the image.
|
|
14
|
+
-
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
_hdr: Path to a High Dynamic Range (HDR) image file.
|
|
18
|
+
adj_expos_: Boolean to note whether the exposure of the image should be adjusted to
|
|
19
|
+
mimic the human visual response in the output. The goal of this process
|
|
20
|
+
is to output an image that correlates more strongly with a person’s
|
|
21
|
+
subjective impression of a scene rather than the absolute birghtness
|
|
22
|
+
of the scene. (Default: False).
|
|
23
|
+
label_: Optional text label to be appended to the bottom of the image. This
|
|
24
|
+
is useful when one has several images and would like to easily
|
|
25
|
+
identify them while scrolling through them.
|
|
26
|
+
label_hgt_: An integer for the height of the label text in pixels. (Default: 32).
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
hdr: Path to the resulting adjusted HDR image file.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
ghenv.Component.Name = 'HB Adjust HDR'
|
|
33
|
+
ghenv.Component.NickName = 'AdjustHDR'
|
|
34
|
+
ghenv.Component.Message = '1.9.0'
|
|
35
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
36
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
37
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
38
|
+
|
|
39
|
+
import os
|
|
40
|
+
|
|
41
|
+
try: # import honeybee_radiance_command dependencies
|
|
42
|
+
from honeybee_radiance_command.pcond import Pcond
|
|
43
|
+
from honeybee_radiance_command.psign import Psign
|
|
44
|
+
from honeybee_radiance_command.pcompos import Pcompos
|
|
45
|
+
except ImportError as e:
|
|
46
|
+
raise ImportError('\nFailed to import honeybee_radiance_command:\n\t{}'.format(e))
|
|
47
|
+
|
|
48
|
+
try: # import honeybee_radiance dependencies
|
|
49
|
+
from honeybee_radiance.config import folders as rad_folders
|
|
50
|
+
except ImportError as e:
|
|
51
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
52
|
+
|
|
53
|
+
try: # import ladybug_rhino dependencies
|
|
54
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
55
|
+
except ImportError as e:
|
|
56
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
57
|
+
|
|
58
|
+
# check the Radiance date of the installed radiance
|
|
59
|
+
try: # import lbt_recipes dependencies
|
|
60
|
+
from lbt_recipes.version import check_radiance_date
|
|
61
|
+
except ImportError as e:
|
|
62
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
63
|
+
check_radiance_date()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if all_required_inputs(ghenv.Component):
|
|
67
|
+
# set up the paths for the various files used in translation
|
|
68
|
+
img_dir = os.path.dirname(_hdr)
|
|
69
|
+
input_image = os.path.basename(_hdr)
|
|
70
|
+
hdr = _hdr
|
|
71
|
+
commands = []
|
|
72
|
+
|
|
73
|
+
# add the command to adjust the exposure to reflect human vision (if requested)
|
|
74
|
+
if adj_expos_:
|
|
75
|
+
adj_image = input_image.lower().replace('.hdr', '_h.HDR')
|
|
76
|
+
pcond = Pcond(input=input_image, output=adj_image)
|
|
77
|
+
pcond.options.h = True
|
|
78
|
+
commands.append(pcond)
|
|
79
|
+
hdr = os.path.join(img_dir, adj_image)
|
|
80
|
+
input_image = adj_image
|
|
81
|
+
|
|
82
|
+
# add the command to for a text label (if requested)
|
|
83
|
+
if label_:
|
|
84
|
+
label_images = []
|
|
85
|
+
for i, l_tex in enumerate(reversed(label_.split('\n'))):
|
|
86
|
+
label_image = 'label{}.HDR'.format(i)
|
|
87
|
+
psign = Psign(text=l_tex, output=label_image)
|
|
88
|
+
psign.options.cb = (0, 0, 0)
|
|
89
|
+
psign.options.cf = (1, 1, 1)
|
|
90
|
+
psign.options.h = label_hgt_ if label_hgt_ is not None else 32
|
|
91
|
+
commands.append(psign)
|
|
92
|
+
label_images.append(label_image)
|
|
93
|
+
|
|
94
|
+
lbl_image = input_image.lower().replace('.hdr', '_label.HDR')
|
|
95
|
+
pcompos = Pcompos(input=label_images + [input_image], output=lbl_image)
|
|
96
|
+
pcompos.options.a = 1
|
|
97
|
+
commands.append(pcompos)
|
|
98
|
+
hdr = os.path.join(img_dir, lbl_image)
|
|
99
|
+
input_image = lbl_image
|
|
100
|
+
|
|
101
|
+
# run the commands in series and load the global horizontal irradiance
|
|
102
|
+
env = None
|
|
103
|
+
if rad_folders.env != {}:
|
|
104
|
+
env = rad_folders.env
|
|
105
|
+
env = dict(os.environ, **env) if env else None
|
|
106
|
+
for r_cmd in commands:
|
|
107
|
+
r_cmd.run(env, cwd=img_dir)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis
|
|
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
|
+
Get the recommended ambient resoluation (-ar) needed to resolve details with a
|
|
12
|
+
given dimension in model units.
|
|
13
|
+
_
|
|
14
|
+
This recommendation is derived from the overall dimensions of the Radince scene
|
|
15
|
+
being simulated as well as the ambient accuracy (-aa) being used in the simulation.
|
|
16
|
+
_
|
|
17
|
+
The result from this component can be plugged directly into the additional_par_
|
|
18
|
+
of the "HB Radiance Parameter" component or into the radiance_par of any
|
|
19
|
+
recipe components.
|
|
20
|
+
|
|
21
|
+
-
|
|
22
|
+
Args:
|
|
23
|
+
_model: The Honeybee Model being used for Radiance simulation.
|
|
24
|
+
_detail_dim: A number in model units that represents the dimension of the
|
|
25
|
+
smallest detail that must be resolved in the Radiance simulation.
|
|
26
|
+
_aa_: An number for ambient accuracy (-aa) being used in the Radiance smiulation.
|
|
27
|
+
This value should be matched between this component and the component
|
|
28
|
+
into which the ouput ar is being input. (Default: 0.25 for
|
|
29
|
+
low-resolution Radiance studies).
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
ar: The abmient resolution needed to resolve the _detail_dim as a text string.
|
|
33
|
+
These can be plugged into the additional_par_ of the "HB Radiance
|
|
34
|
+
Parameter" component or the radiance_par_ input of the recipes.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
ghenv.Component.Name = 'HB Ambient Resolution'
|
|
38
|
+
ghenv.Component.NickName = 'AR'
|
|
39
|
+
ghenv.Component.Message = '1.9.0'
|
|
40
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
41
|
+
ghenv.Component.SubCategory = '3 :: Recipes'
|
|
42
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '0'
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
from ladybug_rhino.grasshopper import all_required_inputs, recipe_result
|
|
46
|
+
except ImportError as e:
|
|
47
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if all_required_inputs(ghenv.Component):
|
|
51
|
+
# set the default -aa
|
|
52
|
+
aa = 0.25 if _aa_ is None else _aa_
|
|
53
|
+
|
|
54
|
+
# get the longest dimension
|
|
55
|
+
min_pt, max_pt = _model.min, _model.max
|
|
56
|
+
x_dim = max_pt.x - min_pt.x
|
|
57
|
+
y_dim = max_pt.y - min_pt.y
|
|
58
|
+
z_dim = max_pt.z - min_pt.z
|
|
59
|
+
longest_dim = max((x_dim, y_dim, z_dim))
|
|
60
|
+
|
|
61
|
+
# calculate the ambient resolution.
|
|
62
|
+
a_res = int((longest_dim * aa) / _detail_dim)
|
|
63
|
+
ar = '-ar {}'.format(a_res)
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# This file is part of Honeybee.
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Get average illuminance or irradiance values over an annual daylight or irradiance
|
|
11
|
+
simulation.
|
|
12
|
+
_
|
|
13
|
+
The _hoys_ input can also be used to filter the data for a particular time period or
|
|
14
|
+
hour/timestep of the simulation.
|
|
15
|
+
|
|
16
|
+
-
|
|
17
|
+
Args:
|
|
18
|
+
_results: An list of annual Radiance result files from either the "HB Annual Daylight"
|
|
19
|
+
or the "HB Annual Irradiance" component (containing the .ill files and
|
|
20
|
+
the sun-up-hours.txt). This can also be just the path to the folder
|
|
21
|
+
containing these 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
|
+
median_: Set to True to get the median values instead of the average. The median
|
|
32
|
+
values can only be calculated for a results folder from the
|
|
33
|
+
"HB Annual Daylight" component. (Default: False).
|
|
34
|
+
grid_filter_: The name of a grid or a pattern to filter the grids. For instance,
|
|
35
|
+
first_floor_* will simulate only the sensor grids that have an
|
|
36
|
+
identifier that starts with first_floor_. By default all the grids
|
|
37
|
+
will be processed.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
report: Reports, errors, warnings, etc.
|
|
41
|
+
values: Average illuminance or irradiance valules for each sensor in lux or W/m2.
|
|
42
|
+
Each value is for a different sensor of the grid. These can be plugged
|
|
43
|
+
into the "LB Spatial Heatmap" component along with meshes of the sensor
|
|
44
|
+
grids to visualize results.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
ghenv.Component.Name = 'HB Annual Average Values'
|
|
48
|
+
ghenv.Component.NickName = 'AvgValues'
|
|
49
|
+
ghenv.Component.Message = '1.9.0'
|
|
50
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
51
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
52
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '2'
|
|
53
|
+
|
|
54
|
+
import os
|
|
55
|
+
import subprocess
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
from ladybug.futil import write_to_file
|
|
59
|
+
except ImportError as e:
|
|
60
|
+
raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
from honeybee.config import folders
|
|
64
|
+
except ImportError as e:
|
|
65
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
from honeybee_radiance.postprocess.annualdaylight import _process_input_folder
|
|
69
|
+
except ImportError as e:
|
|
70
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
from honeybee_radiance_postprocess.dynamic import DynamicSchedule
|
|
74
|
+
except ImportError as e:
|
|
75
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
from pollination_handlers.outputs.helper import read_sensor_grid_result
|
|
79
|
+
except ImportError as e:
|
|
80
|
+
raise ImportError('\nFailed to import pollination_handlers:\n\t{}'.format(e))
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree, \
|
|
84
|
+
give_warning
|
|
85
|
+
except ImportError as e:
|
|
86
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def parse_sun_up_hours(sun_up_hours, hoys, timestep):
|
|
90
|
+
"""Parse the sun-up hours from the result file .txt file.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
sun_up_hours: A list of integers for the sun-up hours.
|
|
94
|
+
hoys: A list of 8760 * timestep values for the hoys to select. If an empty
|
|
95
|
+
list is passed, None will be returned.
|
|
96
|
+
timestep: Integer for the timestep of the analysis.
|
|
97
|
+
"""
|
|
98
|
+
if len(hoys) != 0:
|
|
99
|
+
schedule = [False] * (8760 * timestep)
|
|
100
|
+
for hr in hoys:
|
|
101
|
+
schedule[int(hr * timestep)] = True
|
|
102
|
+
su_pattern = [schedule[int(h * timestep)] for h in sun_up_hours]
|
|
103
|
+
return su_pattern
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def average_values(ill_file, su_pattern, full_len):
|
|
107
|
+
"""Compute average values for a given result file."""
|
|
108
|
+
avg_vals = []
|
|
109
|
+
with open(ill_file) as results:
|
|
110
|
+
if su_pattern is None: # no HOY filter on results
|
|
111
|
+
for pt_res in results:
|
|
112
|
+
values = [float(r) for r in pt_res.split()]
|
|
113
|
+
total_val = sum(values)
|
|
114
|
+
avg_vals.append(total_val / full_len)
|
|
115
|
+
else:
|
|
116
|
+
for pt_res in results:
|
|
117
|
+
values = [float(r) for r, is_hoy in zip(pt_res.split(), su_pattern) if is_hoy]
|
|
118
|
+
total_val = sum(values)
|
|
119
|
+
try:
|
|
120
|
+
avg_vals.append(total_val / full_len)
|
|
121
|
+
except ZeroDivisionError:
|
|
122
|
+
avg_vals.append(0)
|
|
123
|
+
return avg_vals
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if all_required_inputs(ghenv.Component):
|
|
127
|
+
# set up the default values
|
|
128
|
+
median_ = False if median_ is None else median_
|
|
129
|
+
grid_filter_ = '*' if grid_filter_ is None else grid_filter_
|
|
130
|
+
res_folder = os.path.dirname(_results[0]) if os.path.isfile(_results[0]) \
|
|
131
|
+
else _results[0]
|
|
132
|
+
|
|
133
|
+
# check to see if results use the newer numpy arrays
|
|
134
|
+
if os.path.isdir(os.path.join(res_folder, '__static_apertures__')) or \
|
|
135
|
+
os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
136
|
+
res_type = 'average' if median_ is False else 'median'
|
|
137
|
+
cmds = [folders.python_exe_path, '-m', 'honeybee_radiance_postprocess',
|
|
138
|
+
'post-process', '{}-values'.format(res_type), res_folder, '-sf',
|
|
139
|
+
'metrics']
|
|
140
|
+
if len(_hoys_) != 0:
|
|
141
|
+
hoys_str = '\n'.join(str(h) for h in _hoys_)
|
|
142
|
+
hoys_file = os.path.join(res_folder, 'hoys.txt')
|
|
143
|
+
write_to_file(hoys_file, hoys_str)
|
|
144
|
+
cmds.extend(['--hoys-file', hoys_file])
|
|
145
|
+
if grid_filter_ != '*':
|
|
146
|
+
cmds.extend(['--grids-filter', grid_filter_])
|
|
147
|
+
if len(dyn_sch_) != 0:
|
|
148
|
+
if os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
149
|
+
dyn_sch = dyn_sch_[0] if isinstance(dyn_sch_[0], DynamicSchedule) else \
|
|
150
|
+
DynamicSchedule.from_group_schedules(dyn_sch_)
|
|
151
|
+
dyn_sch_file = dyn_sch.to_json(folder=res_folder)
|
|
152
|
+
cmds.extend(['--states', dyn_sch_file])
|
|
153
|
+
else:
|
|
154
|
+
msg = 'No dynamic aperture groups were found in the Model.\n' \
|
|
155
|
+
'The input dynamic schedules will be ignored.'
|
|
156
|
+
print(msg)
|
|
157
|
+
give_warning(ghenv.Component, msg)
|
|
158
|
+
use_shell = True if os.name == 'nt' else False
|
|
159
|
+
custom_env = os.environ.copy()
|
|
160
|
+
custom_env['PYTHONHOME'] = ''
|
|
161
|
+
process = subprocess.Popen(
|
|
162
|
+
cmds, cwd=res_folder, shell=use_shell, env=custom_env,
|
|
163
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
164
|
+
stdout = process.communicate() # wait for the process to finish
|
|
165
|
+
if stdout[-1] != '':
|
|
166
|
+
print(stdout[-1])
|
|
167
|
+
raise ValueError('Failed to compute {} values.'.format(res_type))
|
|
168
|
+
res_dir = os.path.join(res_folder, 'metrics', '{}_values'.format(res_type))
|
|
169
|
+
if os.path.isdir(res_dir):
|
|
170
|
+
values = read_sensor_grid_result(res_dir, res_type,'full_id', False)
|
|
171
|
+
values = list_to_data_tree(values)
|
|
172
|
+
|
|
173
|
+
else:
|
|
174
|
+
if len(dyn_sch_) != 0:
|
|
175
|
+
msg = 'Dynamic Schedules are currently only supported for Annual Daylight ' \
|
|
176
|
+
'simulations.\nThe input schedules will be ignored.'
|
|
177
|
+
print(msg)
|
|
178
|
+
give_warning(ghenv.Component, msg)
|
|
179
|
+
if median_:
|
|
180
|
+
raise ValueError('The median values can only be calculated for a '
|
|
181
|
+
'results folder from the "HB Annual Daylight" '
|
|
182
|
+
'component.')
|
|
183
|
+
# extract the timestep if it exists
|
|
184
|
+
timestep = 1
|
|
185
|
+
tstep_file = os.path.join(res_folder, 'timestep.txt')
|
|
186
|
+
if os.path.isfile(tstep_file):
|
|
187
|
+
with open(tstep_file) as tf:
|
|
188
|
+
timestep = int(tf.readline())
|
|
189
|
+
full_len = 8760 * timestep if len(_hoys_) == 0 else len(_hoys_)
|
|
190
|
+
|
|
191
|
+
# parse the sun-up-hours
|
|
192
|
+
grids, sun_up_hours = _process_input_folder(res_folder, grid_filter_)
|
|
193
|
+
su_pattern = parse_sun_up_hours(sun_up_hours, _hoys_, timestep)
|
|
194
|
+
|
|
195
|
+
# compute the average values
|
|
196
|
+
values = []
|
|
197
|
+
for grid_info in grids:
|
|
198
|
+
ill_file = os.path.join(res_folder, '%s.ill' % grid_info['full_id'])
|
|
199
|
+
dgp_file = os.path.join(res_folder, '%s.dgp' % grid_info['full_id'])
|
|
200
|
+
if os.path.isfile(dgp_file):
|
|
201
|
+
avg = average_values(dgp_file, su_pattern, full_len)
|
|
202
|
+
else:
|
|
203
|
+
avg = average_values(ill_file, su_pattern, full_len)
|
|
204
|
+
values.append(avg)
|
|
205
|
+
values = list_to_data_tree(values)
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# This file is part of Honeybee.
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Get cumulative radiation (or sum of illuminance) values over an annual irradiance
|
|
11
|
+
or daylight simulation.
|
|
12
|
+
_
|
|
13
|
+
The _hoys_ input can also be used to filter the data for a particular time period or
|
|
14
|
+
hour/timestep of the simulation.
|
|
15
|
+
|
|
16
|
+
-
|
|
17
|
+
Args:
|
|
18
|
+
_results: An list of annual Radiance result files from either the "HB Annual Daylight"
|
|
19
|
+
or the "HB Annual Irradiance" component (containing the .ill files and
|
|
20
|
+
the sun-up-hours.txt). This can also be just the path to the folder
|
|
21
|
+
containing these 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
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
report: Reports, errors, warnings, etc.
|
|
38
|
+
values: In the case of an annual irradaince simulation, this is the cumulative
|
|
39
|
+
radiation valules for each sensor in Wh/m2. For annual daylight, it is
|
|
40
|
+
cumulative illuminance (lux-hours). These can be plugged into the "LB
|
|
41
|
+
Spatial Heatmap" component along with meshes of the sensor
|
|
42
|
+
grids to visualize results.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
ghenv.Component.Name = 'HB Annual Cumulative Values'
|
|
46
|
+
ghenv.Component.NickName = 'CumulValues'
|
|
47
|
+
ghenv.Component.Message = '1.9.0'
|
|
48
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
49
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
50
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '2'
|
|
51
|
+
|
|
52
|
+
import os
|
|
53
|
+
import subprocess
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
from ladybug.futil import write_to_file
|
|
57
|
+
except ImportError as e:
|
|
58
|
+
raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
from honeybee.config import folders
|
|
62
|
+
except ImportError as e:
|
|
63
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
from honeybee_radiance.postprocess.annualdaylight import _process_input_folder
|
|
67
|
+
except ImportError as e:
|
|
68
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
from honeybee_radiance_postprocess.dynamic import DynamicSchedule
|
|
72
|
+
except ImportError as e:
|
|
73
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
from pollination_handlers.outputs.helper import read_sensor_grid_result
|
|
77
|
+
except ImportError as e:
|
|
78
|
+
raise ImportError('\nFailed to import pollination_handlers:\n\t{}'.format(e))
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree, \
|
|
82
|
+
give_warning
|
|
83
|
+
except ImportError as e:
|
|
84
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def parse_sun_up_hours(sun_up_hours, hoys, timestep):
|
|
88
|
+
"""Parse the sun-up hours from the result file .txt file.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
sun_up_hours: A list of integers for the sun-up hours.
|
|
92
|
+
hoys: A list of 8760 * timestep values for the hoys to select. If an empty
|
|
93
|
+
list is passed, None will be returned.
|
|
94
|
+
timestep: Integer for the timestep of the analysis.
|
|
95
|
+
"""
|
|
96
|
+
if len(hoys) != 0:
|
|
97
|
+
schedule = [False] * (8760 * timestep)
|
|
98
|
+
for hr in hoys:
|
|
99
|
+
schedule[int(hr * timestep)] = True
|
|
100
|
+
su_pattern = [schedule[int(h * timestep)] for h in sun_up_hours]
|
|
101
|
+
return su_pattern
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def cumulative_values(ill_file, su_pattern, timestep):
|
|
105
|
+
"""Compute average values for a given result file."""
|
|
106
|
+
cumul_vals = []
|
|
107
|
+
with open(ill_file) as results:
|
|
108
|
+
if su_pattern is None: # no HOY filter on results
|
|
109
|
+
for pt_res in results:
|
|
110
|
+
values = [float(r) for r in pt_res.split()]
|
|
111
|
+
cumul_vals.append(sum(values) / timestep)
|
|
112
|
+
else:
|
|
113
|
+
for pt_res in results:
|
|
114
|
+
values = [float(r) for r, is_hoy in zip(pt_res.split(), su_pattern) if is_hoy]
|
|
115
|
+
cumul_vals.append(sum(values) / timestep)
|
|
116
|
+
return cumul_vals
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if all_required_inputs(ghenv.Component):
|
|
120
|
+
# set up the default values
|
|
121
|
+
grid_filter_ = '*' if grid_filter_ is None else grid_filter_
|
|
122
|
+
res_folder = os.path.dirname(_results[0]) if os.path.isfile(_results[0]) \
|
|
123
|
+
else _results[0]
|
|
124
|
+
|
|
125
|
+
# check to see if results use the newer numpy arrays
|
|
126
|
+
if os.path.isdir(os.path.join(res_folder, '__static_apertures__')) or \
|
|
127
|
+
os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
128
|
+
cmds = [folders.python_exe_path, '-m', 'honeybee_radiance_postprocess',
|
|
129
|
+
'post-process', 'cumulative-values', res_folder, '-sf', 'metrics']
|
|
130
|
+
if len(_hoys_) != 0:
|
|
131
|
+
hoys_str = '\n'.join(str(h) for h in _hoys_)
|
|
132
|
+
hoys_file = os.path.join(res_folder, 'hoys.txt')
|
|
133
|
+
write_to_file(hoys_file, hoys_str)
|
|
134
|
+
cmds.extend(['--hoys-file', hoys_file])
|
|
135
|
+
if grid_filter_ != '*':
|
|
136
|
+
cmds.extend(['--grids-filter', grid_filter_])
|
|
137
|
+
if len(dyn_sch_) != 0:
|
|
138
|
+
if os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
139
|
+
dyn_sch = dyn_sch_[0] if isinstance(dyn_sch_[0], DynamicSchedule) else \
|
|
140
|
+
DynamicSchedule.from_group_schedules(dyn_sch_)
|
|
141
|
+
dyn_sch_file = dyn_sch.to_json(folder=res_folder)
|
|
142
|
+
cmds.extend(['--states', dyn_sch_file])
|
|
143
|
+
else:
|
|
144
|
+
msg = 'No dynamic aperture groups were found in the Model.\n' \
|
|
145
|
+
'The input dynamic schedules will be ignored.'
|
|
146
|
+
print(msg)
|
|
147
|
+
give_warning(ghenv.Component, msg)
|
|
148
|
+
use_shell = True if os.name == 'nt' else False
|
|
149
|
+
custom_env = os.environ.copy()
|
|
150
|
+
custom_env['PYTHONHOME'] = ''
|
|
151
|
+
process = subprocess.Popen(
|
|
152
|
+
cmds, cwd=res_folder, shell=use_shell, env=custom_env,
|
|
153
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
154
|
+
stdout = process.communicate() # wait for the process to finish
|
|
155
|
+
if stdout[-1] != '':
|
|
156
|
+
print(stdout[-1])
|
|
157
|
+
raise ValueError('Failed to compute cumulative values.')
|
|
158
|
+
avg_dir = os.path.join(res_folder, 'metrics', 'cumulative_values')
|
|
159
|
+
if os.path.isdir(avg_dir):
|
|
160
|
+
values = read_sensor_grid_result(avg_dir, 'cumulative','full_id', False)
|
|
161
|
+
values = list_to_data_tree(values)
|
|
162
|
+
|
|
163
|
+
else:
|
|
164
|
+
if len(dyn_sch_) != 0:
|
|
165
|
+
msg = 'Dynamic Schedules are currently only supported for Annual Daylight ' \
|
|
166
|
+
'simulations.\nThe input schedules will be ignored.'
|
|
167
|
+
print(msg)
|
|
168
|
+
give_warning(ghenv.Component, msg)
|
|
169
|
+
|
|
170
|
+
# extract the timestep if it exists
|
|
171
|
+
timestep = 1
|
|
172
|
+
tstep_file = os.path.join(res_folder, 'timestep.txt')
|
|
173
|
+
if os.path.isfile(tstep_file):
|
|
174
|
+
with open(tstep_file) as tf:
|
|
175
|
+
timestep = int(tf.readline())
|
|
176
|
+
|
|
177
|
+
# parse the sun-up-hours
|
|
178
|
+
grids, sun_up_hours = _process_input_folder(res_folder, grid_filter_)
|
|
179
|
+
su_pattern = parse_sun_up_hours(sun_up_hours, _hoys_, timestep)
|
|
180
|
+
|
|
181
|
+
# compute the average values
|
|
182
|
+
values = []
|
|
183
|
+
for grid_info in grids:
|
|
184
|
+
ill_file = os.path.join(res_folder, '%s.ill' % grid_info['full_id'])
|
|
185
|
+
dgp_file = os.path.join(res_folder, '%s.dgp' % grid_info['full_id'])
|
|
186
|
+
if os.path.isfile(dgp_file):
|
|
187
|
+
cumul = cumulative_values(dgp_file, su_pattern, timestep)
|
|
188
|
+
else:
|
|
189
|
+
cumul = cumulative_values(ill_file, su_pattern, timestep)
|
|
190
|
+
values.append(cumul)
|
|
191
|
+
values = list_to_data_tree(values)
|