Skip to content

Commit

Permalink
rewrite WCS case to not rely on bounding_box
Browse files Browse the repository at this point in the history
as bounding_box will be cleared in spacetelescope#1908
  • Loading branch information
kecnry committed Dec 8, 2022
1 parent a91b538 commit e454042
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions jdaviz/core/freezable_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ def reset_limits(self, *event):
for layer in self.layers:
if not layer.visible:
continue
data = next((x for x in self.data_collection if x.label == layer.layer.data.label))
bounds = getattr(data.coords, 'pixel_bounds', None)
if bounds is None:
# if no layers have bounds defined, then wcs_success will remain
# false and limits will fallback based on pixel limit
continue

data = next((x for x in self.data_collection if x.label == layer.layer.data.label))
pixel_ids = layer.layer.pixel_component_ids
world_bottom_left = data.coords.pixel_to_world(0, 0)
world_top_right = data.coords.pixel_to_world(bounds[0][1], bounds[1][1])
world_top_right = data.coords.pixel_to_world(layer.layer.data[pixel_ids[1]].max(),
layer.layer.data[pixel_ids[0]].max())

pixel_bottom_left = self.reference_data.coords.world_to_pixel(world_bottom_left)
pixel_top_right = self.reference_data.coords.world_to_pixel(world_top_right)
Expand Down

0 comments on commit e454042

Please sign in to comment.