ladybug-core 0.44.31__py3-none-any.whl → 0.44.33__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.
- ladybug/legend.py +75 -5
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/METADATA +2 -2
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/RECORD +7 -7
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/WHEEL +0 -0
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/entry_points.txt +0 -0
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/licenses/LICENSE +0 -0
- {ladybug_core-0.44.31.dist-info → ladybug_core-0.44.33.dist-info}/top_level.txt +0 -0
ladybug/legend.py
CHANGED
|
@@ -9,11 +9,8 @@ import sys
|
|
|
9
9
|
if (sys.version_info > (3, 0)): # python 3
|
|
10
10
|
xrange = range
|
|
11
11
|
|
|
12
|
-
from ladybug_geometry.
|
|
13
|
-
from ladybug_geometry.geometry3d
|
|
14
|
-
from ladybug_geometry.geometry3d.mesh import Mesh3D
|
|
15
|
-
from ladybug_geometry.geometry2d.pointvector import Point2D
|
|
16
|
-
from ladybug_geometry.geometry2d.mesh import Mesh2D
|
|
12
|
+
from ladybug_geometry.geometry2d import Point2D, Mesh2D
|
|
13
|
+
from ladybug_geometry.geometry3d import Point3D, Vector3D, Polyline3D, Plane, Mesh3D
|
|
17
14
|
|
|
18
15
|
from .color import Color, Colorset, ColorRange
|
|
19
16
|
|
|
@@ -441,6 +438,79 @@ class Legend(object):
|
|
|
441
438
|
color_mtx.append([black] * total_w)
|
|
442
439
|
return color_mtx
|
|
443
440
|
|
|
441
|
+
def mesh_contours(self, mesh, tolerance):
|
|
442
|
+
"""Get Polyline3Ds for contours of a Mesh3D associated with this legend's values.
|
|
443
|
+
|
|
444
|
+
Args:
|
|
445
|
+
mesh: A ladybug-geometry Mesh3D for which contours will be derived.
|
|
446
|
+
The number of faces or the number of vertices must match the
|
|
447
|
+
number of values associated with this Legend.
|
|
448
|
+
tolerance: The minimum difference between mesh vertices at which point
|
|
449
|
+
they are considered equivalent.
|
|
450
|
+
|
|
451
|
+
Returns:
|
|
452
|
+
A tuple with two elements.
|
|
453
|
+
|
|
454
|
+
- contours -- A list of lists where each sub-list represents
|
|
455
|
+
contours associated with a specific threshold. Contours are
|
|
456
|
+
composed of Polyline3D and LineSegment3D.
|
|
457
|
+
|
|
458
|
+
- thresholds -- list of numbers for the threshold value associated
|
|
459
|
+
with each contour. The length of this list matches the contours.
|
|
460
|
+
"""
|
|
461
|
+
# check the input values and provide defaults
|
|
462
|
+
val_count = len(self.values)
|
|
463
|
+
face_match = val_count == len(mesh.faces)
|
|
464
|
+
assert face_match or val_count == len(mesh.vertices), \
|
|
465
|
+
'Number of values ({}) must match the number of mesh faces ({}) or ' \
|
|
466
|
+
'the number of mesh vertices ({}).'.format(
|
|
467
|
+
val_count, len(mesh.faces), len(mesh.vertices))
|
|
468
|
+
|
|
469
|
+
# figure out the thresholds to be used for the contour lines
|
|
470
|
+
min_val, max_val = self.legend_parameters.min, self.legend_parameters.max
|
|
471
|
+
if min_val == max_val:
|
|
472
|
+
return [], [] # no contours to be generated
|
|
473
|
+
thresholds = list(self.segment_numbers)
|
|
474
|
+
if self.is_max_default:
|
|
475
|
+
thresholds.pop(-1) # no need to make a contour
|
|
476
|
+
if self.is_min_default:
|
|
477
|
+
thresholds.pop(0) # no need to make a contour
|
|
478
|
+
if len(thresholds) == 0: # ensure there is at least one threshold
|
|
479
|
+
thresholds = [(max_val + min_val) / 2]
|
|
480
|
+
|
|
481
|
+
# loop through the thresholds and generate contour lines
|
|
482
|
+
contours = []
|
|
483
|
+
init_naked_edges = mesh.naked_edges
|
|
484
|
+
for abs_thresh in thresholds:
|
|
485
|
+
# remove faces below the threshold
|
|
486
|
+
pattern = [val > abs_thresh for val in self.values]
|
|
487
|
+
if all(v for v in pattern):
|
|
488
|
+
contours.append([])
|
|
489
|
+
continue # full mesh in contour; not a useful line
|
|
490
|
+
elif all(not v for v in pattern):
|
|
491
|
+
contours.append([])
|
|
492
|
+
continue # none of the mesh lies in the contour; not a useful line
|
|
493
|
+
sub_mesh, _ = mesh.remove_faces(pattern) if face_match else \
|
|
494
|
+
mesh.remove_vertices(pattern)
|
|
495
|
+
|
|
496
|
+
# create the contour lines
|
|
497
|
+
contour_segs = []
|
|
498
|
+
for seg in sub_mesh.naked_edges:
|
|
499
|
+
for i_seg in init_naked_edges:
|
|
500
|
+
if seg.p1.is_equivalent(i_seg.p1, tolerance) and \
|
|
501
|
+
seg.p2.is_equivalent(i_seg.p2, tolerance):
|
|
502
|
+
break
|
|
503
|
+
else: # we have found a new segment for contouring
|
|
504
|
+
contour_segs.append(seg)
|
|
505
|
+
polylines = Polyline3D.join_segments(contour_segs, tolerance)
|
|
506
|
+
final_contours = []
|
|
507
|
+
for cont in polylines:
|
|
508
|
+
if isinstance(cont, Polyline3D):
|
|
509
|
+
cont = Polyline3D(cont.vertices, True)
|
|
510
|
+
final_contours.append(cont)
|
|
511
|
+
contours.append(final_contours)
|
|
512
|
+
return contours, thresholds
|
|
513
|
+
|
|
444
514
|
def duplicate(self):
|
|
445
515
|
"""Return a copy of the current legend."""
|
|
446
516
|
return self.__copy__()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ladybug-core
|
|
3
|
-
Version: 0.44.
|
|
3
|
+
Version: 0.44.33
|
|
4
4
|
Summary: Python library to load, analyze and modify EnergyPlus Weather files (epw).
|
|
5
5
|
Home-page: https://github.com/ladybug-tools/ladybug
|
|
6
6
|
Author: Ladybug Tools
|
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: Implementation :: IronPython
|
|
|
18
18
|
Classifier: Operating System :: OS Independent
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist: ladybug-geometry==1.34.
|
|
21
|
+
Requires-Dist: ladybug-geometry==1.34.16
|
|
22
22
|
Requires-Dist: click==7.1.2; python_version < "3.8"
|
|
23
23
|
Requires-Dist: click==8.1.7; python_version >= "3.8"
|
|
24
24
|
Dynamic: author
|
|
@@ -20,7 +20,7 @@ ladybug/futil.py,sha256=S3ZuWu709AV7Q4k-giC-3xnlGkmrOEUcrz66f_hwAUI,11767
|
|
|
20
20
|
ladybug/graphic.py,sha256=XaYKDk6BkffcCT_M3GC0Y7KJVLQ_CQk2EW7NOwg3Duw,11197
|
|
21
21
|
ladybug/header.py,sha256=BuS7Ckw9pyUu3ybJrL8B3XY8UlZcclod3CewtqxEEjA,6730
|
|
22
22
|
ladybug/hourlyplot.py,sha256=t9ZY3kR8JqbG80hNBRamg6VX_gc7oGEhKbG8rC0Nl4I,25737
|
|
23
|
-
ladybug/legend.py,sha256=
|
|
23
|
+
ladybug/legend.py,sha256=bOd3mtZbYJ72yHZ_yXwPjgtHLg5181Kh2pBR4TbfZHM,87470
|
|
24
24
|
ladybug/location.py,sha256=GroocAGIShURzvcnht4q9OMQ17fHFd5jNLV4BfUwwAQ,9122
|
|
25
25
|
ladybug/logutil.py,sha256=xZe1x3QiJEfNtqFxx8bzQHXtONVyHHKhfQh-Hf9hifQ,2362
|
|
26
26
|
ladybug/monthlychart.py,sha256=VO92IOMgjGoOk27WlThxMi3DOzLjifkOgI0cJ09srEw,54087
|
|
@@ -78,9 +78,9 @@ ladybug/datatype/volume.py,sha256=JIRBSgo7gx5GekZWffAchQJrCBjNKIRh5yBRVlCL2FE,29
|
|
|
78
78
|
ladybug/datatype/volumeflowrate.py,sha256=3opIJ4UxTMVCmN9tjNONvTRDSkz7fJuRKOOr1f_6mfc,2982
|
|
79
79
|
ladybug/datatype/volumeflowrateintensity.py,sha256=MuFwp7BHZP8Vh75ej_3-G1QYxBqDWtwIxvOd4Ub9iPI,2380
|
|
80
80
|
ladybug/datatype/volumeheatcapacity.py,sha256=FYMFUkY36hytdz5nPpVCeiBL4q5LWEjyKwd4ZnjfWzM,2170
|
|
81
|
-
ladybug_core-0.44.
|
|
82
|
-
ladybug_core-0.44.
|
|
83
|
-
ladybug_core-0.44.
|
|
84
|
-
ladybug_core-0.44.
|
|
85
|
-
ladybug_core-0.44.
|
|
86
|
-
ladybug_core-0.44.
|
|
81
|
+
ladybug_core-0.44.33.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
82
|
+
ladybug_core-0.44.33.dist-info/METADATA,sha256=1RYll8145yRALU5S2p_XFYSEVhwQYC-2Vg8nhqvoYDE,4354
|
|
83
|
+
ladybug_core-0.44.33.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
84
|
+
ladybug_core-0.44.33.dist-info/entry_points.txt,sha256=FOtz9JWVLwG3LoBz-G7bIQmL1A-WDRoa2Ebbihq-gOg,45
|
|
85
|
+
ladybug_core-0.44.33.dist-info/top_level.txt,sha256=A9J55WsdwQSng_Qf_6zf7N19flFS_DW4UrLzmFDPUuw,8
|
|
86
|
+
ladybug_core-0.44.33.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|