From e036349bb83fcf39a6105d6ff663d28d036e8e24 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 15 Dec 2020 11:22:27 +0000 Subject: [PATCH] Respond to review --- changelog/{4727.bugfix.rst => 4727.breaking.rst} | 11 +++++++++++ sunpy/map/mapbase.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) rename changelog/{4727.bugfix.rst => 4727.breaking.rst} (51%) diff --git a/changelog/4727.bugfix.rst b/changelog/4727.breaking.rst similarity index 51% rename from changelog/4727.bugfix.rst rename to changelog/4727.breaking.rst index 6391cbf2611..c866c352e45 100644 --- a/changelog/4727.bugfix.rst +++ b/changelog/4727.breaking.rst @@ -3,3 +3,14 @@ left coordinates of the input rectangle in world coordinates were considered when calculating the pixel bounding box. All four corners are once again taken into account now, meaning that `~sunpy.map.GenericMap.submap` correctly returns the smallest pixel box which contains all four corners of the input rectangle. + + +To revert to the previous 2.0 behaviour, first convert the top right and bottom +left coordinates to pixel space before calling submap with:: + + top_right = smap.wcs.world_to_pixel(top_right) * u.pix + bottom_left = smap.wcs.world_to_pixel(bottom_left) * u.pix + smap.submap(bottom_left=bottom_left, top_right=top_right) + + +This will define the rectangle in pixel space. diff --git a/sunpy/map/mapbase.py b/sunpy/map/mapbase.py index 9a0424bf6ed..578f41345e4 100644 --- a/sunpy/map/mapbase.py +++ b/sunpy/map/mapbase.py @@ -1448,7 +1448,7 @@ def submap(self, bottom_left, *, top_right=None, width: (u.deg, u.pix) = None, h Any pixels which have at least part of their area inside the rectangle are returned. If the rectangle is defined in world coordinates, the smallest array which contains all four corners of the rectangle as - defined in world coordinates are defined. + defined in world coordinates is returned. Parameters ----------