-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
Overhaul how we handle dates/times for maps #7673
Comments
I am ok with this, but I am not convinced by:
I know there are potentially other ways of populating DATE-AVG but this seems like a sensible default? Are you suggesting removing it because of falling back to I am not really clear on why you would have |
Small post before a big post...
I agree that if we had to have a default, then the midpoint of DATE-BEG and DATE-END would be sensible. My inclination is that providing sensible defaults is the realm of source-specific subclasses as opposed to the standards-based One could make an analogous argument that |
My proposal above is a little knotted because I was desperately trying to avoid adding a new date property. The consequence is that If we can stomach adding a new date property, the proposal becomes cleaner and – importantly – straightforward to document. Proposed alternate overhaul plan:
Considerations:
|
I agree with all of this apart from populating I am going to start implementing this with |
In the process of working on this I am now wondering why we are prioritising
Edit: On Albert's prompting I went and had another look over the specs. I assume @ayshih is recommending we put DATE-OBS first as it should normally be the start time, but there could be a situation where you have specific reason for it not to be: The FITS 4 spec section 4.4.2.2 states:
I would note however that the time paper says:
Given the ambiguity in both the historical definition of |
It doesn't matter how niche the use case is. The FITS standard lays out DATE-OBS as the place to record the canonical observation time. The other DATExxxx keywords aren't even discussed in Section 4.4.2.2. Both the FITS standard and the time paper also quite reasonably say that DATE-BEG is the place to unambiguously record the start of the observation time, but that doesn't have to be the same as the canonical observation time. When DATE-OBS is equal DATE-BEG, priority is moot. When DATE-OBS is not equal to DATE-BEG, we should trust the data source to have a good reason to specify DATE-OBS that way and prioritize it over DATE-BEG. As a toy example for why a date file would have this, imagine an imager that produces an integrated image product every UTC minute from summing individual frame captures that are a few seconds long. Because the frame-capture times may not be exactly synchronized to UTC, you can conceivably end up keywords with values like these:
Thus, the canonical observation time (exactly on the UTC minute) is not the same as the literal start of the observation. Also, DATE-AVG here is the halfway point of the canonical minute, and is not exactly equal the arithmetic mean of DATE-BEG and DATE-END. As far as I'm concerned, such keyword values conform to the FITS standard, and |
Makes sense to me, gosh this is complicated. |
This is spun out from #7606. I propose an overhaul of how we handle dates/times for maps. To briefly summarize the FITS standard:
To briefly summarize our current code, GenericMap has the following properties:
.date_start
, which is just DATE-BEG.date_end
, which is just DATE-END.date_average
, which is DATE-AVG (if present), or falls back to the arithmetic mean of DATE-BEG and DATE-END (if present).date
, which is in order of decreasing priority: DATE-OBS >.date_average
>.date_start
>.date_end
> the current timeIssues:
.wcs
property is instantiated with only one of the possible times, with.wcs.wcs.dateobs
set to.date
, and the other times are not preserved. Also, since the coordinate frame constructed from this WCS uses.date
, it may not be accurate if DATE-OBS is present but is not the same time as the observer metadata (e.g., DATE-AVG)..observer_coordinate
property is instantiated with its time as.date
, and as above, that may not be accurate if DATE-OBS is present but is not the same time as the observer metadata (e.g., DATE-AVG).Proposed overhaul plan:
.date_average
to be the reference time for observer metadata. The new logic would be in order of decreasing priority: DATE-AVG >.date
. We should remove the assumption that the arithmetic mean of DATE-BEG and DATE-END is the correct way to construct the average time..date
to be the "canonical" time to refer to an observation, which is commonly the start of the observation, and would be the time that, e.g., is used in plot titles. The new priority would be DATE-OBS >.date_start
> DATE-AVG >.date_end
> the time thatsunpy.map
was first imported in the current session (see Rotating a map results in a differentdate
#5543 (comment))..observer_coordinate
so that it uses.date_average
instead of.date
.wcs
so that it populates the following using properties, which can be overridden by source subclasses:.wcs.wcs.dateobs
with.date
(note that this will never beNone
).wcs.wcs.dateavg
with.date_average
(note that this will never beNone
).wcs.wcs.datebeg
with.date_start
if notNone
.wcs.wcs.dateend
with.date_end
if notNone
.wcs.dateavg
over.wcs.dateobs
. This is actually already the case, but I list it for completeness:sunpy/sunpy/coordinates/wcs_utils.py
Line 37 in 558e55e
Considerations:
.date_average
, and potentially of.date
, to make it more clear what they mean and to enable some deprecation..observer_coordinate.date
would be equal to.date_average
, and potentially different from.date.
.The text was updated successfully, but these errors were encountered: