# AIA-related SunpyMetadataWarning: Missing metadata for observer

**URL:** <https://community.openastronomy.org/t/aia-related-sunpymetadatawarning-missing-metadata-for-observer/802>\
**Category:** SunPy\
**Tags:** sunpy\
**Created:** [November 16, 2023, 6:56pm UTC](https://community.openastronomy.org/t/aia-related-sunpymetadatawarning-missing-metadata-for-observer/802 "2023-11-16T18:56:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wall.E](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/wall.e/32/146_2.png) [@Wall.E](https://community.openastronomy.org/u/Wall.E)\
**Post date:** [November 16, 2023, 6:56pm UTC](https://community.openastronomy.org/t/aia-related-sunpymetadatawarning-missing-metadata-for-observer/802/1 "2023-11-16T18:56:51Z")

</div>

This issue is happenning in both Sunpy 5.0.1 and 5.1 RC:

I’m following the guide for [Reprojecting to a Map Projection with a Custom Origin](https://docs.sunpy.org/en/stable/generated/gallery/map_transformations/projection_custom_origin.html#)

When plotting the reprojected Postel map with Sunpy AIA sample `AIA_171_IMAGE`, I get

> WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.  
> For frame ‘heliographic\_stonyhurst’ the following metadata is missing: hgln\_obs,dsun\_obs,hglt\_obs  
> For frame ‘heliographic\_carrington’ the following metadata is missing: dsun\_obs,crln\_obs,crlt\_obs  
> [sunpy.map.mapbase]

Yet these keywords exist in the sample’s FITS headers:

```python
from astropy.io import fits
hdul = fits.open(AIA_171_IMAGE)
kv = [hdul[1].header[key] for key in ['hgln_obs', 'dsun_obs', 'hglt_obs', 'crln_obs' , 'crlt_obs']]
kv

```

`[0.0, 151846026489.0, 0.048591, 340.698273, 0.048591]`

It looks like the same issue that used to be reported (and solved) for XRT: [SunpyMetadataWarnings when using Hinode XRT data](https://community.openastronomy.org/t/sunpymetadatawarnings-when-using-hinode-xrt-data/393)

Is this a known issue or should I raise it in Github?

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [November 16, 2023, 7:29pm UTC](https://community.openastronomy.org/t/aia-related-sunpymetadatawarning-missing-metadata-for-observer/802/2 "2023-11-16T19:29:19Z")

</div>

That warning shouldn’t be emitted, but I don’t know if it’ll be easy to fix. Go ahead and report it.

The keywords exist in the original FITS header, but the keywords are not carried over to the header for the reprojected map. That’s because observer heliographic location and distance are irrelevant for a map in Stonyhurst heliographic coordinates. So, the warning is correct that the keywords are not there, but ideally no code should looking for those keywords, which is why I say that the warning shouldn’t be emitted.

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [November 16, 2023, 7:43pm UTC](https://community.openastronomy.org/t/aia-related-sunpymetadatawarning-missing-metadata-for-observer/802/3 "2023-11-16T19:43:31Z")

</div>

Okay, so the problem is not the `out_map.plot()` call, but rather the subsequent calls to `out_map.draw_grid()` and `out_map.draw_limb()`. You could manually add the keywords to the header of `out_map`, but the most expedient thing you can do to avoid the warning is to simply call `aia_map.draw_grid()` and `aia_map.draw_limb()` instead. Unlike `out_map`, `aia_map` has the full observer information.
