Grid on an image - difference with the old sunpy version and the 5.0.0


Plotting an heliographic grid on ground-based images, I have a different behaviour with the new version of SunPy and the old one I was using (2.0.3). It seems related to the value of CDELT in the meta-data.

The resulting grid fits well the sun disk with sunpy 2.0.3:
with it’s too big with sunpy 5.0.0:

It gets the right size when I force CDELT1=CDELT2=1

The fits file is here:

And the code is:

hdul =
header = hdul[0].header
uset_map =[0].data, header))
fig = plt.figure()
ax = plt.subplot(projection=uset_map)

Any idea what could cause this difference ?

Many thanks,

Not everyone defines the radius of the Sun the same way, so we look in the FITS header for the value that should be used. When a header does not explicitly define the physical radius of the Sun (via the keyword RSUN_REF), we infer it from the angular radius of the Sun (via the keyword RSUN_OBS or SOLAR_R or RADIUS, in decreasing order of priority).

The issue here is that your FITS file has the following:

SOLAR_R =    984.6052312720685 / [pixel] estimated radius of the sun

However, sunpy is hardcoded to assume that SOLAR_R is provided in arcseconds, not pixels.

I recommend you open a GitHub issue so we can discuss whether SOLAR_R being provided in pixels is something that should be supported. In the meantime, you can work around this issue by converting SOLAR_R in your header to arcseconds, e.g.:

uset_map.meta['solar_r'] *= uset_map.meta['cdelt1']

Thank you for your answer ! Following your suggestion, I have posted this on GitHub.