`reproject_to` does not preserve metadata
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at the implementation of the reproject_to method and inspect how it reconstructs the data and header. Done means the reprojected map preserves the relevant original metadata, including units, and returns the appropriate map instance rather than always a GenericMap.
Written by the indexing model from the issue text.
Description
This is not a bug as I'm quite sure this is the intended behavior, but when using the new reproject_to method, the resulting map does not have much of the associated metadata of the original map as the resulting map is reconstructed from a data-header pair where the header is reconstructed only from the WCS.
For example, after reprojecting a map, the resulting map has no units,
>>> import sunpy.map
>>> import sunpy.data.sample
>>> m = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
>>> m.unit
Unit("ct")
>>> m.reproject_to(m.wcs).unit is None
True
One possible solution would be to instead create a header using the header helper and then creating the resulting map from a (data,header) pair instead.
Furthermore, I just noticed that this returns a GenericMap instance explicitly. Given the approach described above, could we instead return map with _new_instance?
- Dominant language
- Python
- Stars
- 1k
- Forks
- 682
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sunpy/sunpy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Feature Request net
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
net
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Documentation Effort Low Package Novice Priority Medium
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Effort Medium map Package Intermediate Priority Medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100