Skip to content

Commit 69becc7

Browse files
committed
fix meshgrid
1 parent e529284 commit 69becc7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pint_array/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,14 @@ def manip_fun(x, *args, **kwargs):
300300

301301
else:
302302
x = [asarray(x_i) for x_i in x]
303-
units = x[0].units
304-
magnitude = [xp.asarray(x[0].magnitude, copy=True)]
305-
for x_i in x[1:]:
306-
magnitude.append(x_i.m_as(units))
303+
if len(x) == 0:
304+
magnitude = xp.empty(0)
305+
units = None
306+
else:
307+
units = x[0].units
308+
magnitude = [xp.asarray(x[0].magnitude, copy=True)]
309+
for x_i in x[1:]:
310+
magnitude.append(x_i.m_as(units))
307311

308312
if func_str == "repeat" and hasattr(
309313
repeats := (args := list(args))[0], "units"

0 commit comments

Comments
 (0)