honeybee-radiance 1.66.190__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.

Potentially problematic release.


This version of honeybee-radiance might be problematic. Click here for more details.

Files changed (152) hide show
  1. honeybee_radiance/__init__.py +11 -0
  2. honeybee_radiance/__main__.py +4 -0
  3. honeybee_radiance/_extend_honeybee.py +93 -0
  4. honeybee_radiance/cli/__init__.py +88 -0
  5. honeybee_radiance/cli/dc.py +400 -0
  6. honeybee_radiance/cli/edit.py +529 -0
  7. honeybee_radiance/cli/glare.py +118 -0
  8. honeybee_radiance/cli/grid.py +859 -0
  9. honeybee_radiance/cli/lib.py +458 -0
  10. honeybee_radiance/cli/modifier.py +133 -0
  11. honeybee_radiance/cli/mtx.py +226 -0
  12. honeybee_radiance/cli/multiphase.py +1034 -0
  13. honeybee_radiance/cli/octree.py +640 -0
  14. honeybee_radiance/cli/postprocess.py +1186 -0
  15. honeybee_radiance/cli/raytrace.py +219 -0
  16. honeybee_radiance/cli/rpict.py +125 -0
  17. honeybee_radiance/cli/schedule.py +56 -0
  18. honeybee_radiance/cli/setconfig.py +63 -0
  19. honeybee_radiance/cli/sky.py +545 -0
  20. honeybee_radiance/cli/study.py +66 -0
  21. honeybee_radiance/cli/sunpath.py +331 -0
  22. honeybee_radiance/cli/threephase.py +255 -0
  23. honeybee_radiance/cli/translate.py +400 -0
  24. honeybee_radiance/cli/util.py +121 -0
  25. honeybee_radiance/cli/view.py +261 -0
  26. honeybee_radiance/cli/viewfactor.py +347 -0
  27. honeybee_radiance/config.json +6 -0
  28. honeybee_radiance/config.py +427 -0
  29. honeybee_radiance/dictutil.py +50 -0
  30. honeybee_radiance/dynamic/__init__.py +5 -0
  31. honeybee_radiance/dynamic/group.py +479 -0
  32. honeybee_radiance/dynamic/multiphase.py +557 -0
  33. honeybee_radiance/dynamic/state.py +718 -0
  34. honeybee_radiance/dynamic/stategeo.py +352 -0
  35. honeybee_radiance/geometry/__init__.py +13 -0
  36. honeybee_radiance/geometry/bubble.py +42 -0
  37. honeybee_radiance/geometry/cone.py +215 -0
  38. honeybee_radiance/geometry/cup.py +54 -0
  39. honeybee_radiance/geometry/cylinder.py +197 -0
  40. honeybee_radiance/geometry/geometrybase.py +37 -0
  41. honeybee_radiance/geometry/instance.py +40 -0
  42. honeybee_radiance/geometry/mesh.py +38 -0
  43. honeybee_radiance/geometry/polygon.py +174 -0
  44. honeybee_radiance/geometry/ring.py +214 -0
  45. honeybee_radiance/geometry/source.py +182 -0
  46. honeybee_radiance/geometry/sphere.py +178 -0
  47. honeybee_radiance/geometry/tube.py +46 -0
  48. honeybee_radiance/lib/__init__.py +1 -0
  49. honeybee_radiance/lib/_loadmodifiers.py +72 -0
  50. honeybee_radiance/lib/_loadmodifiersets.py +69 -0
  51. honeybee_radiance/lib/modifiers.py +58 -0
  52. honeybee_radiance/lib/modifiersets.py +63 -0
  53. honeybee_radiance/lightpath.py +204 -0
  54. honeybee_radiance/lightsource/__init__.py +1 -0
  55. honeybee_radiance/lightsource/_gendaylit.py +479 -0
  56. honeybee_radiance/lightsource/dictutil.py +49 -0
  57. honeybee_radiance/lightsource/ground.py +160 -0
  58. honeybee_radiance/lightsource/sky/__init__.py +7 -0
  59. honeybee_radiance/lightsource/sky/_skybase.py +177 -0
  60. honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
  61. honeybee_radiance/lightsource/sky/cie.py +378 -0
  62. honeybee_radiance/lightsource/sky/climatebased.py +501 -0
  63. honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
  64. honeybee_radiance/lightsource/sky/skydome.py +113 -0
  65. honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
  66. honeybee_radiance/lightsource/sky/strutil.py +34 -0
  67. honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
  68. honeybee_radiance/lightsource/sunpath.py +247 -0
  69. honeybee_radiance/modifier/__init__.py +3 -0
  70. honeybee_radiance/modifier/material/__init__.py +30 -0
  71. honeybee_radiance/modifier/material/absdf.py +477 -0
  72. honeybee_radiance/modifier/material/antimatter.py +54 -0
  73. honeybee_radiance/modifier/material/ashik2.py +51 -0
  74. honeybee_radiance/modifier/material/brtdfunc.py +81 -0
  75. honeybee_radiance/modifier/material/bsdf.py +292 -0
  76. honeybee_radiance/modifier/material/dielectric.py +53 -0
  77. honeybee_radiance/modifier/material/glass.py +431 -0
  78. honeybee_radiance/modifier/material/glow.py +246 -0
  79. honeybee_radiance/modifier/material/illum.py +51 -0
  80. honeybee_radiance/modifier/material/interface.py +49 -0
  81. honeybee_radiance/modifier/material/light.py +206 -0
  82. honeybee_radiance/modifier/material/materialbase.py +36 -0
  83. honeybee_radiance/modifier/material/metal.py +167 -0
  84. honeybee_radiance/modifier/material/metal2.py +41 -0
  85. honeybee_radiance/modifier/material/metdata.py +41 -0
  86. honeybee_radiance/modifier/material/metfunc.py +41 -0
  87. honeybee_radiance/modifier/material/mirror.py +340 -0
  88. honeybee_radiance/modifier/material/mist.py +86 -0
  89. honeybee_radiance/modifier/material/plasdata.py +58 -0
  90. honeybee_radiance/modifier/material/plasfunc.py +59 -0
  91. honeybee_radiance/modifier/material/plastic.py +354 -0
  92. honeybee_radiance/modifier/material/plastic2.py +58 -0
  93. honeybee_radiance/modifier/material/prism1.py +57 -0
  94. honeybee_radiance/modifier/material/prism2.py +48 -0
  95. honeybee_radiance/modifier/material/spotlight.py +50 -0
  96. honeybee_radiance/modifier/material/trans.py +518 -0
  97. honeybee_radiance/modifier/material/trans2.py +49 -0
  98. honeybee_radiance/modifier/material/transdata.py +50 -0
  99. honeybee_radiance/modifier/material/transfunc.py +53 -0
  100. honeybee_radiance/modifier/mixture/__init__.py +6 -0
  101. honeybee_radiance/modifier/mixture/mixdata.py +49 -0
  102. honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
  103. honeybee_radiance/modifier/mixture/mixpict.py +52 -0
  104. honeybee_radiance/modifier/mixture/mixtext.py +66 -0
  105. honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
  106. honeybee_radiance/modifier/modifierbase.py +40 -0
  107. honeybee_radiance/modifier/pattern/__init__.py +9 -0
  108. honeybee_radiance/modifier/pattern/brightdata.py +49 -0
  109. honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
  110. honeybee_radiance/modifier/pattern/brighttext.py +81 -0
  111. honeybee_radiance/modifier/pattern/colordata.py +56 -0
  112. honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
  113. honeybee_radiance/modifier/pattern/colorpict.py +54 -0
  114. honeybee_radiance/modifier/pattern/colortext.py +73 -0
  115. honeybee_radiance/modifier/pattern/patternbase.py +34 -0
  116. honeybee_radiance/modifier/texture/__init__.py +4 -0
  117. honeybee_radiance/modifier/texture/texdata.py +29 -0
  118. honeybee_radiance/modifier/texture/texfunc.py +26 -0
  119. honeybee_radiance/modifier/texture/texturebase.py +27 -0
  120. honeybee_radiance/modifierset.py +1091 -0
  121. honeybee_radiance/mutil.py +60 -0
  122. honeybee_radiance/postprocess/__init__.py +1 -0
  123. honeybee_radiance/postprocess/annual.py +108 -0
  124. honeybee_radiance/postprocess/annualdaylight.py +425 -0
  125. honeybee_radiance/postprocess/annualglare.py +201 -0
  126. honeybee_radiance/postprocess/annualirradiance.py +187 -0
  127. honeybee_radiance/postprocess/electriclight.py +119 -0
  128. honeybee_radiance/postprocess/en17037.py +261 -0
  129. honeybee_radiance/postprocess/leed.py +304 -0
  130. honeybee_radiance/postprocess/solartracking.py +90 -0
  131. honeybee_radiance/primitive.py +554 -0
  132. honeybee_radiance/properties/__init__.py +1 -0
  133. honeybee_radiance/properties/_base.py +390 -0
  134. honeybee_radiance/properties/aperture.py +197 -0
  135. honeybee_radiance/properties/door.py +198 -0
  136. honeybee_radiance/properties/face.py +123 -0
  137. honeybee_radiance/properties/model.py +1291 -0
  138. honeybee_radiance/properties/room.py +490 -0
  139. honeybee_radiance/properties/shade.py +186 -0
  140. honeybee_radiance/properties/shademesh.py +116 -0
  141. honeybee_radiance/putil.py +44 -0
  142. honeybee_radiance/reader.py +214 -0
  143. honeybee_radiance/sensor.py +166 -0
  144. honeybee_radiance/sensorgrid.py +1008 -0
  145. honeybee_radiance/view.py +1101 -0
  146. honeybee_radiance/writer.py +951 -0
  147. honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
  148. honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
  149. honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
  150. honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
  151. honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
  152. honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
@@ -0,0 +1,247 @@
1
+ """A Radiance-based sunpath.
2
+
3
+ A Radiance-based sunpath is a list of light sources with radius of 0.533
4
+
5
+
6
+ A sunpath can be climate-based or non-climate-based. In non climate-based sunpath
7
+ irradiance values are set to 1e6 for red, green and blue channels.
8
+
9
+ Use the climate-based sunpath for direct solar radiation studies and use the
10
+ non climate-based sunpath for solar access studies.
11
+ """
12
+
13
+ from ..modifier.material import Light
14
+ from ..geometry import Source
15
+ from ._gendaylit import gendaylit
16
+
17
+ from ladybug.sunpath import Sunpath as LBSunpath
18
+ from ladybug.location import Location
19
+ from ladybug.wea import Wea
20
+
21
+ import os
22
+ import warnings
23
+
24
+ try:
25
+ from itertools import izip as zip
26
+ writemode = 'wb'
27
+ except ImportError:
28
+ # python 3
29
+ writemode = 'w'
30
+
31
+
32
+ class Sunpath(object):
33
+ """A Radiance-based sun-path.
34
+
35
+ Args:
36
+ location: A Ladybug location.
37
+ north: Sunpath north angle.
38
+
39
+ Properties:
40
+ * location
41
+ * north
42
+ """
43
+ __slots__ = ('_location', '_north')
44
+
45
+ def __init__(self, location, north=0):
46
+ self.location = location
47
+ self.north = north
48
+
49
+ @property
50
+ def location(self):
51
+ """Sunpath location."""
52
+ return self._location
53
+
54
+ @location.setter
55
+ def location(self, loc):
56
+ assert isinstance(loc, Location), \
57
+ 'Location must be a Ladybug Location not %s' % type(loc)
58
+ self._location = loc
59
+
60
+ @property
61
+ def north(self):
62
+ """Sunpath north angle."""
63
+ return self._north
64
+
65
+ @north.setter
66
+ def north(self, n):
67
+ assert isinstance(n, (int, float)), 'north must be a numerical value.'
68
+ self._north = n
69
+
70
+ def _solar_calc(self, hoys, wea, output_type, leap_year=False,
71
+ reverse_vectors=False):
72
+ """Calculate sun vectors and radiance values from the properties."""
73
+ solar_calc = LBSunpath.from_location(self.location, self.north)
74
+ solar_calc.is_leap_year = leap_year
75
+
76
+ if not hoys:
77
+ # set hours to an annual hourly sunpath
78
+ hoys = range(8760) if not leap_year else range(8760 + 24)
79
+
80
+ sun_up_hours = []
81
+ sun_vectors = []
82
+ radiance_values = []
83
+ altitudes = []
84
+ for hour in hoys:
85
+ sun = solar_calc.calculate_sun_from_hoy(hour)
86
+ if sun.altitude < 0:
87
+ continue
88
+ sun_vectors.append(sun.sun_vector)
89
+ sun_up_hours.append(hour)
90
+ altitudes.append(sun.altitude)
91
+ # calculate irradiance value
92
+ if wea:
93
+ # this is a climate_based sunpath. Get the values from wea
94
+ assert isinstance(wea, Wea), 'Expected Wea not %s' % type(wea)
95
+
96
+ for altitude, hoy in zip(altitudes, sun_up_hours):
97
+ dnr, dhr = wea.get_irradiance_value_for_hoy(hoy)
98
+ if dnr == 0:
99
+ radiance_value = 0
100
+ else:
101
+ radiance_value = gendaylit(
102
+ altitude, hoy, dnr, dhr, output_type, leap_year)
103
+ radiance_values.append(int(radiance_value))
104
+ else:
105
+ radiance_values = [1e6] * len(sun_up_hours)
106
+
107
+ if reverse_vectors:
108
+ sun_vectors = [v.reverse() for v in sun_vectors]
109
+
110
+ return sun_vectors, sun_up_hours, radiance_values
111
+
112
+ def to_file(self, folder='.', file_name='sunpath', hoys=None, wea=None,
113
+ output_type=0, leap_year=False, reverse_vectors=False,
114
+ split_mod_files=True):
115
+ r"""Write sunpath to file.
116
+
117
+ This method will generate a sunpath file and one or several files for sun
118
+ modifiers.
119
+
120
+ In sunpath file each sun is defined as a radiance source in a separate line. The
121
+ naming is based on the minute of the year.
122
+
123
+ void light {sol_moy} 0 0 3 {irr} {irr} {irr} {sol_moy} source {sun_moy} 0 0 4 x y z 0.533
124
+
125
+ This method also generate a mod file which includes all the modifiers in sunpath.
126
+ mod file is usually used with rcontrib command to indicate the list of modifiers.
127
+ Since rcontrib command has a hard limit of 10,000 modifiers in a single run you
128
+ can use split_mod_files to split the modifier files not to exceed 10,000
129
+ modifiers.
130
+
131
+ Args:
132
+ folder: Target folder to write the sunpath files (default: '.')
133
+ file_name: Optional file name for generated files. By default files will be
134
+ named as sunpath.rad and sunpath.mod.
135
+ hoys: An optional list of hoys to be included in sunpath. By default sunpath
136
+ includes all the sun up hours during the year.
137
+ wea: A Ladybug wea. If wea is provided a climate-based sunpath will be
138
+ generated otherwise all suns will be assigned the same value of 1e6.
139
+ output_type: An integer between 0-2. 0=output in W/m^2/sr visible,
140
+ 1=output in W/m^2/sr solar, 2=output in candela/m^2 (default: 0).
141
+ leap_year: Set to True if hoys are for a leap year (default: False).
142
+ reverse_vector: Set to True to reverse the vector direction of suns. By
143
+ default sun vectors are coming from sun towards the ground. This option
144
+ will reverse the direction of the vectors. Reversed sunpath is mainly
145
+ useful for radiation studies (default: False).
146
+ split_mod_files: A boolean to split the modifier file into multiple files to
147
+ ensure none of them includes more than 10,000 modifiers.
148
+
149
+ Returns:
150
+ dict -- A dictionary with with two keys for sunpath and suns. sunpath returns
151
+ the path to the sunpath file and suns returns a list of path to modifier
152
+ files.
153
+ """
154
+ sun_vectors, sun_up_hours, radiance_values = \
155
+ self._solar_calc(hoys, wea, output_type, leap_year, reverse_vectors)
156
+
157
+ if not os.path.isdir(folder):
158
+ os.makedirs(folder)
159
+
160
+ file_name = file_name or 'sunpath'
161
+ # write them to files
162
+ fp = os.path.join(folder, file_name + '.rad')
163
+ if not wea:
164
+ if output_type != 0:
165
+ warnings.warn(
166
+ 'Output type will not affect a non climate-base sunpath.'
167
+ ' To create a climate-based sunpath you must provide the weather'
168
+ ' data.'
169
+ )
170
+
171
+ suns = []
172
+ with open(fp, writemode) as outf:
173
+ for vector, hoy, irr in zip(sun_vectors, sun_up_hours, radiance_values):
174
+ # use minute of the year to name sun positions
175
+ moy = int(round(hoy * 60))
176
+ mat = Light('sol_%06d' % moy, irr, irr, irr)
177
+ sun = Source('sun_%06d' % moy, vector, 0.533, mat)
178
+ outf.write(sun.to_radiance(True).replace('\n', ' ') + '\n')
179
+ suns.append('sol_%06d' % moy)
180
+
181
+ file_count = int(len(suns) / 10000) + 1 if split_mod_files else 1
182
+
183
+ if file_count != 1:
184
+ length = int(round(len(suns) / file_count))
185
+ sun_files = [
186
+ os.path.join(folder, '%s_%d.mod' % (file_name, count))
187
+ for count in range(file_count)
188
+ ]
189
+ else:
190
+ length = len(suns)
191
+ sun_files = [os.path.join(folder, '%s.mod' % file_name)]
192
+
193
+ open_files = [open(sfp, 'w') for sfp in sun_files]
194
+
195
+ try:
196
+ for count, sun in enumerate(suns):
197
+ file_index = min(int(count / length), file_count - 1)
198
+ open_files[file_index].write(sun + '\n')
199
+ except Exception as e:
200
+ raise ValueError(e)
201
+ finally:
202
+ for f in open_files:
203
+ f.close()
204
+
205
+ return {'sunpath': fp, 'suns': sun_files}
206
+
207
+ def to_dict(self):
208
+ """Convert this sunpath to a dictionary.
209
+
210
+ Args:
211
+ input_dict: A python dictionary in the following format
212
+
213
+ .. code-block:: python
214
+
215
+ {
216
+ 'type': 'Sunpath',
217
+ 'location': {} # Location dictionary,
218
+ 'north': 0,
219
+ }
220
+ """
221
+ return {
222
+ 'type': 'Sunpath',
223
+ 'location': self.location.to_dict(),
224
+ 'north': self.north
225
+ }
226
+
227
+ @classmethod
228
+ def from_dict(cls, data):
229
+ """Create a sunpath from a dictionary.
230
+
231
+ Dictionary keys are type, location and north.
232
+ """
233
+ assert 'type' in data, 'type key is missing.'
234
+ assert data['type'] == 'Sunpath', 'Expected type Sunpath not %s' % data['type']
235
+
236
+ assert 'location' in data, 'location key is missing.'
237
+ location = Location.from_dict(data['location'])
238
+ north = dict.get('north')
239
+ return cls(location, north)
240
+
241
+ def ToString(self):
242
+ """Overwrite .NET ToString method."""
243
+ return self.__repr__()
244
+
245
+ def __repr__(self):
246
+ """Sunpath representation."""
247
+ return "Sunpath: %s" % self.location.city
@@ -0,0 +1,3 @@
1
+ """Radiance Modifiers."""
2
+
3
+ from .modifierbase import Modifier
@@ -0,0 +1,30 @@
1
+ """Radiance Materials."""
2
+
3
+ from .absdf import aBSDF
4
+ from .antimatter import Antimatter
5
+ from .ashik2 import Ashik2
6
+ from .brtdfunc import BRTDfunc
7
+ from .bsdf import BSDF
8
+ from .dielectric import Dielectric
9
+ from .glass import Glass
10
+ from .glow import Glow
11
+ from .illum import Illum
12
+ from .interface import Interface
13
+ from .light import Light
14
+ from .metal import Metal
15
+ from .metal2 import Metal2
16
+ from .metdata import Metdata
17
+ from .metfunc import Metfunc
18
+ from .mirror import Mirror
19
+ from .mist import Mist
20
+ from .plasdata import Plasdata
21
+ from .plasfunc import Plasfunc
22
+ from .plastic import Plastic
23
+ from .plastic2 import Plastic2
24
+ from .prism1 import Prism1
25
+ from .prism2 import Prism2
26
+ from .spotlight import Spotlight
27
+ from .trans import Trans
28
+ from .trans2 import Trans2
29
+ from .transdata import Transdata
30
+ from .transfunc import Transfunc