astropy / astropy/astropy

Unclear SpectralCoord warning coming from fitswcs

Open
#11,309 2 comments 2 reactions 0 assignees View on GitHub
wcs.wcsapi
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 19h
Merged PRs (30d)
75

Description

I'm processing some FITS files that have spectral data (via. [`NDCube`](https://docs.sunpy.org/projects/ndcube/en/latest/index.html)), and currently seeing the following warning a lot:
```python
WARNING: target cannot be converted to ICRS, so will not be set on SpectralCoord [astropy.wcs.wcsapi.fitswcs]
```
I'm not finding this warning very helpful, for a couple of reasons:

- I don't understand why it's being raised. In particular, what is "target" and "SpectralCoord", and how are they related to `world_axis_object_components`? (which is the method that this warning is raised in)
- I don't understand what I can do to prevent the warning from being raised. ie., what do I need to fix in my data?

It would be good to improve the warning message to address these two points.

Contributor guide

Open the contributing guide

Research direction

Start at the world_axis_object_components method in astropy.wcs.wcsapi.fitswcs, where the warning is raised. Clarify what target and SpectralCoord refer to, explain their relation to world_axis_object_components, and state what data issue or correction prevents the warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.