Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a context manager for imposing a solar-radius value #7328

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ayshih
Copy link
Member

@ayshih ayshih commented Dec 4, 2023

This PR adds a context manager as an option for dealing with the situation of inconsistent values for the solar radius. This context manager makes it so that the rsun frame attribute for any relevant coordinate frame reports as the specified value, with 695.7 Mm as the default:

>>> import astropy.units as u

>>> import sunpy.map
>>> from sunpy.coordinates import impose_solar_radius
>>> from sunpy.data.sample import AIA_171_IMAGE

>>> aiamap = sunpy.map.Map(AIA_171_IMAGE)
>>> print(aiamap.observer_coordinate)
<SkyCoord (HeliographicStonyhurst: obstime=2011-06-07T06:33:02.770, rsun=696000.0 km): (lon, lat, radius) in (deg, deg, m)
    (-0.00406308, 0.04787238, 1.51846026e+11)>

>>> with impose_solar_radius():  # defaults to the IAU value of 695.7 Mm
...    print(aiamap.observer_coordinate)
<SkyCoord (HeliographicStonyhurst: obstime=2011-06-07T06:33:02.770, rsun=695700.0 km): (lon, lat, radius) in (deg, deg, m)
    (-0.00406308, 0.04787238, 1.51846026e+11)>

If you perform a reprojection under this context manager, there will no longer be missing data due to a rsun mismatch.

@ayshih ayshih added coordinates Affects the coordinates submodule No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers) labels Dec 4, 2023
Copy link

github-actions bot commented May 3, 2024

Hello 👋, Thanks for your contribution to sunpy!
I have marked this pull request as stale because there hasn't had any activity in five months. If you are still working on this, or if it's waiting on a maintainer to look at it then please let us know and we will keep it open. Please add a comment with: @sunpy/sunpy-developers to get someone's attention.
If nobody comments on this pull request for another month, it will be closed.

@github-actions github-actions bot added the Stale The bot will close this PR after 6 months label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coordinates Affects the coordinates submodule No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers) Stale The bot will close this PR after 6 months
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant