Skip to content

Commit

Permalink
Merge pull request #7598 from meeseeksmachine/auto-backport-of-pr-759…
Browse files Browse the repository at this point in the history
…4-on-5.1

Backport PR #7594 on branch 5.1 (Enable use of  SunPyBaseCoordinateFrame outside sunpy)
  • Loading branch information
nabobalis committed Apr 25, 2024
2 parents e045714 + 548d2c2 commit 959d358
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/7594.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug that interfered with :func:`astropy.wcs.utils.celestial_frame_to_wcs` when working with a custom subclass of :class:`~sunpy.coordinates.frames.SunPyBaseCoordinateFrame`.
9 changes: 9 additions & 0 deletions sunpy/coordinates/tests/test_wcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
HeliographicCarrington,
HeliographicStonyhurst,
Helioprojective,
SunPyBaseCoordinateFrame,
)
from sunpy.coordinates.wcs_utils import (
_set_wcs_aux_obs_coord,
Expand Down Expand Up @@ -438,3 +439,11 @@ def test_observer_hgln_crln_priority():
# Note: don't test whether crlt or hglt is used---according to
# _set_wcs_aux_obs_coord, those are expected to always be the same and so
# the same one is always used


def test_sunpybaseframe_external():
class MyFrame(SunPyBaseCoordinateFrame):
pass

out = solar_frame_to_wcs_mapping(MyFrame())
assert out is None
3 changes: 3 additions & 0 deletions sunpy/coordinates/wcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def solar_frame_to_wcs_mapping(frame, projection='TAN'):
xcoord = 'HGLN' + '-' + projection
ycoord = 'HGLT' + '-' + projection
wcs.wcs.cunit = ['deg', 'deg']
else:
# A subclass not supported by the core library
return None

else:
return None
Expand Down

0 comments on commit 959d358

Please sign in to comment.