Skip to content

Commit

Permalink
Give a more informative error if there's no input WCS to modify.
Browse files Browse the repository at this point in the history
  • Loading branch information
jehturner committed Nov 25, 2024
1 parent 2c2ca41 commit 88afe3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions astrodata/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ def remove_unused_world_axis(ext):
ext: single-slice AstroData object
"""
ndim = len(ext.shape)
if ext.wcs is None:
raise ValueError("The input has no WCS")
affine = calculate_affine_matrices(ext.wcs.forward_transform, ext.shape)
# Check whether there's a single output that isn't affected by the input
removable_axes = np.all(affine.matrix == 0, axis=1)[::-1] # xyz order
Expand Down

0 comments on commit 88afe3a

Please sign in to comment.