Skip to content

Commit 3f0784a

Browse files
authored
Fixed a bug in point_in_polygon() where an error was raised if the unit was dimensionless. (#149)
1 parent 3398ffb commit 3f0784a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

named_arrays/geometry/_point_in_polygon.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def _point_in_polygon_quantity(
117117

118118
if isinstance(x, u.Quantity):
119119
unit = x.unit
120-
y = y.to_value(unit)
121-
vertices_x = vertices_x.to_value(unit)
122-
vertices_y = vertices_y.to_value(unit)
120+
if unit != 1:
121+
x = x.value
122+
y = y.to_value(unit)
123+
vertices_x = vertices_x.to_value(unit)
124+
vertices_y = vertices_y.to_value(unit)
123125

124126
shape_points = np.broadcast(x, y).shape
125127
shape_vertices = np.broadcast(vertices_x, vertices_y).shape

0 commit comments

Comments
 (0)