That’s what I’ve been trying (your first method), and there seems to be a problem with the reprojection… It removes data above the origin point, where there should be data (see image down below). I checked with the reprojection pipeline from JSOC with the same origin and shape parameters coordinates, and I don’t have this problem.
Here’s a reproducible example:
import matplotlib
import matplotlib.pyplot as plt
import sunpy.map
import astropy.units as u
from astropy.coordinates import SkyCoord
from sunpy.coordinates import frames
import sunpy.data.sample
hmi_map = sunpy.map.Map(sunpy.data.sample.HMI_LOS_IMAGE)
hmi_rotated = hmi_map.rotate(order=3)
# Define center of reprojected map
origin = SkyCoord(0*u.deg, 50*u.deg, frame=frames.HeliographicStonyhurst, obstime=hmi_map.date,
observer=hmi_rotated.observer_coordinate)
hmi_map = sunpy.map.Map(sunpy.data.sample.HMI_LOS_IMAGE)
hmi_rotated = hmi_map.rotate(order=3)
# Define center of reprojected map
origin = SkyCoord(0*u.deg, 50*u.deg, frame=frames.HeliographicStonyhurst, obstime=hmi_map.date,
observer=hmi_rotated.observer_coordinate)
# Define header for the reprojection
out_shape = (1024, 1024)
out_header = sunpy.map.make_fitswcs_header(
out_shape,
origin,
scale=[0.0301, 0.0301]*u.deg/u.pix,
projection_code="ARC" # azimuthal equidistant projection, aka Postel
)
# Reproject
out_map = hmi_map.reproject_to(out_header)
fig = plt.figure(figsize=(20, 10))
ax = fig.add_subplot(1, 2, 1, projection=hmi_rotated)
hmi_rotated.plot(axes=ax)
hmi_rotated.draw_grid(axes=ax, color='blue')
hmi_rotated.draw_limb(axes=ax, color='blue')
ax.plot_coord(origin, 'o', color='red', fillstyle='none', markersize=20)
ax = fig.add_subplot(1, 2, 2, projection=out_map)
out_map.plot(axes=ax)
out_map.draw_grid(axes=ax, color='blue')
out_map.draw_limb(axes=ax, color='blue')
ax.plot_coord(origin, 'o', color='red', fillstyle='none', markersize=20)
ax.set_title('Postel projection centered at ROI')
plt.show()
As I’m using a full-disk image (HMI magnetogram), we have data all the way near the pole, whereas on the right, the reprojected map has removed the data much below that, with NaN values, around 45 degrees, as if it was putting the north limb down there. So, there must be something wrong with reproject()
. @svank That’s what I mentionned to you at AGU.