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

Add new date properties to Map #5449

Merged
merged 1 commit into from
Jul 28, 2021
Merged

Add new date properties to Map #5449

merged 1 commit into from
Jul 28, 2021

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Jul 8, 2021

See #5394 (comment), which summarises a recent chat on the dev call.

Still needs:

  • Tests
  • Changelog entry

@dstansby dstansby added map Affects the map submodule No Backport A PR that isn't to be backported to any release branch. (To be used as a flag to other maintainers) labels Jul 8, 2021
@dstansby dstansby added this to the 3.1 milestone Jul 8, 2021
@dstansby dstansby requested a review from a team as a code owner July 8, 2021 14:02
@dstansby dstansby requested review from wtbarnes and Cadair July 13, 2021 11:22
@dstansby dstansby force-pushed the date-props branch 2 times, most recently from 9559180 to 03d651a Compare July 13, 2021 11:56
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.

Just a few minor suggestions, but this all looks good to me.

A lingering worry that came up in the dev call last week: this is potentially a breaking change. If a map has both DATE-OBS and DATE-AVG (or equivalently a DATE-BEG and a DATE-END), a release following this PR will return the latter for .datewithout any sort of warning as to the change in behavior whereas 3.0 returns the former. I'm not completely sure how we would handle a deprecation here. Maybe switching the order of date_avg and date-obs in .date and then adding a deprecation warning that we will prefer date-avg in 4.1?

changelog/5449.rst Outdated Show resolved Hide resolved
docs/whatsnew/3.1.rst Show resolved Hide resolved
sunpy/map/mapbase.py Show resolved Hide resolved
sunpy/map/tests/test_mapbase.py Show resolved Hide resolved
@dstansby
Copy link
Member Author

Just a few minor suggestions, but this all looks good to me.

A lingering worry that came up in the dev call last week: this is potentially a breaking change. If a map has both DATE-OBS and DATE-AVG (or equivalently a DATE-BEG and a DATE-END), a release following this PR will return the latter for .datewithout any sort of warning as to the change in behavior whereas 3.0 returns the former. I'm not completely sure how we would handle a deprecation here. Maybe switching the order of date_avg and date-obs in .date and then adding a deprecation warning that we will prefer date-avg in 4.1?

I would argue it's a bugfix? But maybe not, perhaps we can discuss this point again on this weeks' call.

return parse_time(time, scale=timesys.lower())

@property
def date_beg(self):
Copy link
Member

Choose a reason for hiding this comment

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

I see no reason to tie ourselves to the weird short FITS names?

Suggested change
def date_beg(self):
def date_start(self):

return self._get_date('date-end')

@property
def date_avg(self):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def date_avg(self):
def date_average(self):

or maybe

Suggested change
def date_avg(self):
def date_center(self):

Copy link
Member Author

Choose a reason for hiding this comment

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

I think worth sticking with average, given this is the wording in FITS and this doesn't always have to be the center of the observation interval?

# Get the time scale
if time is not None and 'TAI' in time:
if 'TAI' in time:
Copy link
Member

Choose a reason for hiding this comment

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

I think this bit of logic should remain solely in .date.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thinking about this, it should probably live in map sources? But given it's just raising a warning, I think worth keeping it for all the date fields?

@dstansby
Copy link
Member Author

Some more decisions:

  • We want to prioritise DATE-OBS in .date
  • Update the docstring of .date to recommend using the other (new) properties
  • Move the TAI logic just to .date
  • (in another PR) use date_average instead of .date when constructing the observer coordinate.

@nabobalis nabobalis merged commit 9757e15 into sunpy:main Jul 28, 2021
@dstansby dstansby deleted the date-props branch July 28, 2021 18:57
@nabobalis nabobalis removed this from the 3.1 milestone Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
map Affects the map submodule 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.

4 participants