Skip to content

Commit 95afaa1

Browse files
committed
Fix other crop test
1 parent 3fe2107 commit 95afaa1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ndcube/ndcube.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ def _get_crop_by_values_item(self, *points, units=None, wcs=None, keepdims=False
687687
points[i][j] = u.Quantity(value, unit=unit)
688688
if value is not None:
689689
try:
690-
points[i][j] = points[i][j].to(wcs.world_axis_units[j])
690+
target_unit = wcs.world_axis_units[j]
691+
points[i][j] = points[i][j].to_value(target_unit) if target_unit else points[i][j].value
691692
except UnitsError as err:
692693
raise UnitsError(f"Unit '{points[i][j].unit}' of coordinate object {j} in point {i} is "
693694
f"incompatible with WCS unit '{wcs.world_axis_units[j]}'") from err

0 commit comments

Comments
 (0)