Skip to content

Commit

Permalink
BUG: fix an issue where array functions would raise UnitConsistencyEr…
Browse files Browse the repository at this point in the history
…ror on unyt arrays using non-default unit registries
  • Loading branch information
neutrinoceros committed Nov 1, 2023
1 parent 8754a5c commit 9dbd8ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions unyt/_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def _validate_units_consistency(objs):
# because it's already a necessary condition for numpy to use our
# custom implementations
units = get_units(objs)
sunits = set(units)
if len(sunits) == 1:
unique_units = set(units)
if len(unique_units) == 1 or all(u.is_dimensionless for u in unique_units):
return units[0]
else:
raise UnitInconsistencyError(*units)
Expand Down

0 comments on commit 9dbd8ec

Please sign in to comment.