SkyOffsetFrame issue when transforming to HPC

Open
#6,947 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by reproducing the example with SkyOffsetFrame, transform_to, reproject_to, and draw_quadrangle using the Earth and Solar Orbiter map frames. Trace why the transformed coordinates retain the same Tx and Ty values; done means the rotated field of view reprojects correctly and aligns on both maps.

Written by the indexing model from the issue text.

Description

coordinates Effort High Package Expert Priority Medium Upstream Fix Required
Describe the bug

I brought up this issue a while ago in the element channel, and @ayshih mentioned it was an astropy issue, but I thought I'd add it here again to keep track.

Basically, what I'm trying to do is plot a field of view of an instrument on a full-disk map of the Sun, and then also see what that field of view is from another observer; here a field of view is from Solar Orbiter and I want to see what this looks like from AIA/Earth. The issue is that the field of view has a rotation to it. To plot the field of view on the point of view of Solar Orbiter is straight forward by using draw_quadrangle and using bottom_left_coord and top_right_coord with SkyOffsetFrame with the given rotation angle. However, when transforming these coordinates with the SkyOffsetFrame to the earth map wcs it doesnt work.

For example:

hri_map = sunpy.map.Map("solo_L2_eui-hrieuv174-image_20220402T091915587_V01.fits")

hri_angle = hri_map.meta["crota"]
rotated_frame = SkyOffsetFrame(origin=hri_map.reference_coordinate, 
                               rotation=-hri_angle*u.deg, 
                               observer=hri_map.observer_coordinate)
bl = hri_map.bottom_left_coord.transform_to(rotated_frame)
tr = hri_map.top_right_coord.transform_to(rotated_frame)

then this can be plotted nicely on the Solar Orbiter field of view, and matches with the actual map plot which makes sense. However it doesnt work when trying to plot it on a map with a different frame, say Earth based.

Below is a plot just plotting a rectangle given the top right and bottom left corners (green) and then the FOV when the rotation is added in red. earth_map and solo_map are just blank maps with Earth and SolO frames, respectively.

fig = plt.figure(figsize=(11, 5))
ax1 = fig.add_subplot(1, 2, 1, projection=earth_map)
ax2 = fig.add_subplot(1, 2, 2, projection=solo_map)

earth_map.plot(axes=ax1, title="Earth view")
earth_map.draw_limb(color='k', axes=ax1)
hri_reproject_earth.plot( axes=ax1)

earth_map.draw_quadrangle(bottom_left=hri_map.bottom_left_coord, 
                          top_right=hri_map.top_right_coord, edgecolor='g', axes=ax1, label="HRI FOV (no rotation)")

earth_map.draw_quadrangle(bottom_left=bl_rot, 
                          top_right=tr_rot, edgecolor='r', axes=ax1, label="HRI FOV")


solo_map.plot(axes=ax2, title="Solo view")
solo_map.draw_limb(color='k', axes=ax2)
hri_reproject_solo.plot( axes=ax2)
solo_map.draw_quadrangle(bottom_left=hri_map.bottom_left_coord, 
                          top_right=hri_map.top_right_coord, edgecolor='g', axes=ax2, label="HRI FOV (no rotation)")

solo_map.draw_quadrangle(bottom_left=bl_rot, 
                        top_right=tr_rot, edgecolor='r', axes=ax2, label="HRI FOV")

earth_solo_fov

So the issue is that the bl_rot and tr_rot coordinates are not reprojecting correctly given the SkyOffsetFrame.

For example:

>>> bl_rot.reproject_to(solo_map.coordinate_frame)
<SkyCoord (Helioprojective: obstime=2022-04-02T09:19:16.287, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate (obstime=2022-04-02T09:19:16.287, rsun=695700.0 km): (lon, lat, radius) in (deg, deg, m)
    (108.33340062, 2.64104579, 5.30858232e+10)>): (Tx, Ty) in arcsec
    (-2569.40076256, 268.94164778)>

>>> bl_rot.transform_to(earth_map.coordinate_frame)
<SkyCoord (Helioprojective: obstime=2022-04-02T09:19:16.287, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate (obstime=2022-04-02T09:19:16.287, rsun=695700.0 km): (lon, lat, radius) in (deg, deg, m)
    (-5.47456864e-07, -6.48257837, 1.49523853e+11)>): (Tx, Ty) in arcsec
    (-2569.40076256, 268.94164778)>

which is giving back the same Tx, Ty values, and hence not reprojecting

Dominant language
Python
Stars
1k
Forks
682
Avg merge
1d 17h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/sunpy

All issues in sunpy/sunpy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.