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

No more modify meta #5501

Merged
merged 14 commits into from
Oct 19, 2021
Merged

No more modify meta #5501

merged 14 commits into from
Oct 19, 2021

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Aug 12, 2021

Replaces #5199 - see that PR for motivation and discussion.

Fixes #4324, fixes #4410

@dstansby dstansby requested a review from a team as a code owner August 12, 2021 19:25
@pep8speaks
Copy link

pep8speaks commented Aug 12, 2021

Hello @dstansby! Thanks for updating this PR.

Line 10:17: E741 ambiguous variable name 'l'

Comment last updated at 2021-10-19 17:52:17 UTC

@dstansby dstansby marked this pull request as draft August 12, 2021 20:10
@dstansby dstansby force-pushed the no-more-modify-meta branch 3 times, most recently from 410cadb to 1446531 Compare August 17, 2021 12:36
@dstansby dstansby added the No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers) label Aug 17, 2021
@dstansby dstansby force-pushed the no-more-modify-meta branch 2 times, most recently from 79b4d5b to 86029ba Compare August 18, 2021 09:21
@wtbarnes
Copy link
Member

There are also still some modification to header values in io, e.g. the fixing of the WAVEUNIT keyword:

header['WAVEUNIT'] = waveunit

I don't know if you want to address that here as well?

@dstansby
Copy link
Member Author

Thanks - I hadn't spotted that, but I will try to remove that in this PR too.

@wtbarnes
Copy link
Member

It came about when I was constructing the EUI headers (which are for some reason missing the WAVEUNIT key). When you pass a file into the map factory, it passes through io and gets the wave unit fix. But if you just pass the data header pair, this fix is not applied and things blow up when you try to access the wavelength property.

@dstansby
Copy link
Member Author

I had a quick ctrl-F and WAVEUNIT doesn't seem to be in the FITS spec anywhere, so I guess it's just a commonly used but not official keyword?

@dstansby dstansby force-pushed the no-more-modify-meta branch 3 times, most recently from 3b11bd1 to 1c03a27 Compare August 19, 2021 20:36
@wtbarnes
Copy link
Member

Oh there are going to be some conflicts between this and #5261 😅

@dstansby dstansby force-pushed the no-more-modify-meta branch 2 times, most recently from 455076b to 8f176fd Compare August 21, 2021 21:24
@dstansby dstansby mentioned this pull request Sep 6, 2021
5 tasks
@dstansby dstansby force-pushed the no-more-modify-meta branch 2 times, most recently from f3f498a to 0a32316 Compare October 1, 2021 08:37
@dstansby dstansby added this to the 3.1 milestone Oct 1, 2021
@dstansby dstansby marked this pull request as ready for review October 1, 2021 15:43
@dstansby dstansby requested a review from a team as a code owner October 1, 2021 15:43
docs/whatsnew/3.1.rst Outdated Show resolved Hide resolved
from sunpy.map import GenericMap
import astropy.units as u

from sunpy.map.mapbase import GenericMap, SpatialPair

__all__ = ['SJIMap']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we deprecate this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Either way I think that's something for a new PR.

return u.Unit(unit)

@property
def _default_observer_coordinate(self):
Copy link
Contributor

@nabobalis nabobalis Oct 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be useful in future or is it called elsewhere? I tried to do a search on github but it came up with nothing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in GenericMap.observer_coordinate.


@property
def scale(self):
if self.meta['cunit2'] == 'Sine Latitude':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return none if this isn't the case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, a user could have already corrected the metadata in which case we want to let it pass through.

@Cadair Cadair requested a review from nabobalis October 19, 2021 08:58
Copy link
Member

@wtbarnes wtbarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nitpicks, but overall looks good to me. Thanks for this massive effort!

sunpy/map/mapbase.py Outdated Show resolved Hide resolved
sunpy/map/mapbase.py Outdated Show resolved Hide resolved
sunpy/map/mapbase.py Show resolved Hide resolved
sunpy/map/sources/sdo.py Outdated Show resolved Hide resolved
@nabobalis nabobalis removed request for a team and nabobalis October 19, 2021 15:51
dstansby and others added 2 commits October 19, 2021 17:21
Co-authored-by: Will Barnes <will.t.barnes@gmail.com>
@nabobalis
Copy link
Contributor

FAILED ../../.tox/py39/lib/python3.9/site-packages/sunpy/map/sources/tests/test_eui_source.py::test_unit
FAILED ../../.tox/py39/lib/python3.9/site-packages/sunpy/map/sources/tests/test_wispr_source.py::test_unit
FAILED ../../.tox/py39/lib/python3.9/site-packages/sunpy/io/special/asdf/tags/tests/test_genericmap.py::test_genericmap_basic
FAILED ../../.tox/py39/lib/python3.9/site-packages/sunpy/io/special/asdf/tags/tests/test_genericmap.py::test_genericmap_mask

CI failures to fix before we merge.

@nabobalis nabobalis merged commit b0dbce4 into sunpy:main Oct 19, 2021
@dstansby dstansby deleted the no-more-modify-meta branch October 19, 2021 19:48
@dstansby dstansby removed the Needs Review Needs reviews before merge label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to handle broken or missing metadata Fix CRDER nan values in HMI maps
5 participants