-
Notifications
You must be signed in to change notification settings - Fork 3
Addition of re-projection to a common observer #90
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import sunpy.map | ||
| from sunpy.coordinates.frames import HeliographicStonyhurst | ||
|
|
||
| from astropy import units as u | ||
| from astropy.coordinates import SkyCoord | ||
|
|
||
|
|
||
| def reproject_instrument( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Names are hard but a think should rename this changes scale and distance of observer of a map using reproject it not the full retroject? Should prob also support the reproject keywords. |
||
| sunpy_map: sunpy.map.Map, | ||
| radius: u.Quantity = 1 * u.au, | ||
| scale: u.Quantity = u.Quantity([0.5, 0.5], u.arcsec / u.pixel), | ||
| ): | ||
| """ | ||
| Reproject a `sunpy.map.Map` to a new observer location with a specified radius and plate scale. | ||
|
|
||
| Parameters: | ||
| ----------- | ||
| sunpy_map : `sunpy.map.Map` | ||
| The input map to be reprojected. | ||
|
|
||
| radius : `astropy.units.quantity.Quantity`, optional | ||
| The radius at which the new observer is located. Default is 1 astronomical unit (1*u.au). | ||
|
|
||
| scale : `astropy.units.quantity.Quantity`, optional | ||
| The plate scale of the output map. Default is [0.5, 0.5] arcsec per pixel. | ||
|
|
||
| Returns: | ||
| -------- | ||
| out_map : `sunpy.map.Map` | ||
| The reprojected map with the specified observer location, radius, and plate scale. | ||
|
|
||
| """ | ||
|
|
||
| original_observer = sunpy_map.reference_coordinate.frame.observer | ||
|
|
||
| new_observer = SkyCoord( | ||
| 0 * u.arcsec, | ||
| 0 * u.arcsec, | ||
| frame="helioprojective", | ||
| rsun=sunpy_map.reference_coordinate.rsun, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you checked if the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this is a good plan. I am not sure if this is the way to do it, but a start |
||
| obstime=original_observer.obstime, | ||
| observer=HeliographicStonyhurst( | ||
| original_observer.lon, | ||
| original_observer.lat, | ||
| radius, | ||
| obstime=original_observer.obstime, | ||
| rsun=original_observer.rsun, | ||
| ), | ||
| ) | ||
|
|
||
| out_header = sunpy.map.make_fitswcs_header( | ||
| sunpy_map.data.shape, | ||
| new_observer, | ||
| scale=scale, | ||
| ) | ||
|
|
||
| out_map = sunpy_map.reproject_to(out_header) | ||
|
|
||
| return out_map | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
__all__