Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dimensions metadata when resampling a map #1870

Closed
wtbarnes opened this issue Aug 4, 2016 · 12 comments
Closed

Update dimensions metadata when resampling a map #1870

wtbarnes opened this issue Aug 4, 2016 · 12 comments
Labels
Effort Medium Requires a moderate time investment map Affects the map submodule Package Novice Requires little knowledge of the internal structure of SunPy Priority Low Slow action required

Comments

@wtbarnes
Copy link
Member

wtbarnes commented Aug 4, 2016

Currently, after resampling a map, the naxis1 and naxis2 entries in the metadata, which hold the dimension of each axis, are not updated. See the resample method in sunpy/map/mapbase.py.

This should be just a matter of adding two lines in the update metadata section of the resample method.

See example below

Map from sample data. Note that the metadata gives the x and y dimensions as 1024 and that it gives the same output as the dimensions property.

>>> import sunpy.map                                                         
>>> import sunpy.data.sample                                                 
>>> aia_test_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
>>> aia_test_map.dimensions
... Pair(x=<Quantity 1024.0 pix>, y=<Quantity 1024.0 pix>)            
>>> aia_test_map.meta['naxis1']
... 1024
>>> aia_test_map.meta['naxis2']
... 1024

Now resample the map to 100-by-100 pixels

>>> import astropy.units as u
>>> aia_test_map_resampled = aia_test_map.resample([100,100]*u.pixel)
>>> aia_test_map_resampled.dimensions
... Pair(x=<Quantity 100.0 pix>, y=<Quantity 100.0 pix>)
>>> aia_test_map_resampled.meta['naxis1']
... 1024
>>> aia_test_map_resampled.meta['naxis2']
... 1024

So after resampling, the metadata remains unchanged though the dimensions are updated with the resampling.

Though maybe the original resolution of the map should be preserved in the metadata.

@Cadair

This comment has been minimized.

@wtbarnes

This comment has been minimized.

@dpshelio

This comment has been minimized.

@Cadair

This comment has been minimized.

@prateekiiest

This comment has been minimized.

@prateekiiest

This comment has been minimized.

@wtbarnes

This comment has been minimized.

@wtbarnes

This comment has been minimized.

@Cadair

This comment has been minimized.

@wtbarnes

This comment has been minimized.

@prateekiiest

This comment has been minimized.

@nabobalis nabobalis added Package Novice Requires little knowledge of the internal structure of SunPy Priority Low Slow action required Effort Medium Requires a moderate time investment map Affects the map submodule labels Jan 22, 2019
@wtbarnes
Copy link
Member Author

Given that the general consensus (for now at least) is that we don't want to much with header keywords, I'm going to close this very old issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort Medium Requires a moderate time investment map Affects the map submodule Package Novice Requires little knowledge of the internal structure of SunPy Priority Low Slow action required
Projects
None yet
Development

No branches or pull requests

5 participants