Skip to content

Commit 71a236b

Browse files
committed
Fix warning message when describing array elements
1 parent e61c71f commit 71a236b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

ndcube/utils/cube.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,15 @@ def get_crop_item_from_points(points, wcs, crop_by_values, keepdims, original_sh
234234
if min_array_idx == max_array_idx:
235235
ambiguous = True
236236
max_array_idx += 1
237-
message += (f"All input points corresponding to array axis {array_axis} lie on "
238-
f"the boundary between array elements {min_array_idx} and "
239-
f"{max_array_idx}. The cropped NDCube will only include array "
240-
f"element {max_array_idx}.\n")
237+
if min_array_idx == 0:
238+
message += (f"All input points corresponding to array axis {array_axis} lie on "
239+
"the lower boundary of array element 0 (the first element). "
240+
"The cropped NDCube will only include array element 0.\n")
241+
else:
242+
message += (f"All input points corresponding to array axis {array_axis} lie on "
243+
f"the boundary between array elements {min_array_idx - 1} and "
244+
f"{min_array_idx}. The cropped NDCube will only include array "
245+
f"element {min_array_idx}.\n")
241246
if max_array_idx - min_array_idx == 1 and not keepdims:
242247
item.append(min_array_idx)
243248
else:

0 commit comments

Comments
 (0)