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 SEVIRI native reader with 'time_parameters' metadata #1877
Conversation
a philosophical question: are the Satpy |
Looks good to me, thanks for fixing this! They should indeed be consistent. Regarding philosophy: I'd vote for the actual scanning times as provided by the HRIT reader and also Also pinging @ninahakansson : I think this doesn't break our workflow, because the end time is computed by level1c4pps here |
Not in the scope of this PR, but to react to @sjoro 's question, I would say that different users might have different needs. I suppose a solution would be to have multiple attributes in this case, eg |
@simonrp84 looks like you broke the seviri_native tests :) |
The GEO users (the people looking at the images) expect the timestamps to match the nominal times, which means |
So we are lucky, because the scanning time in HRIT that we have used all the time as |
i'm ok with most likely even needed in SIFT... currently we just take the another issue could be (i'm inventing this use case) that a user clicks at 12:14 on the SIFT time line, the end time for SEVIRI data was 12:12.48. at 12:14 there's no valid data to be displayed. here i', imagining that some start and end times could be used from the Satpy readers to give timeframe when that dataset is "valid" and should be displayed. apologies for mixing SIFT in the mixture here, hehe. :) |
Presumably most of the GEO users are using HRIT data, and they seem OK with the actual rather than nominal times in that reader. I do agree that it'd be useful to provide also the nominal times, so like @sjoro suggested I will add |
I also think that having the scan end time as So I agree that adding extra attrs with the nominal repeat cycle time is useful, and would suggest to make this difference clear in the reader documentation. PS: we would need to do the same on the NetCDF reader (these lines compute the time) and use the |
Codecov Report
@@ Coverage Diff @@
## main #1877 +/- ##
=======================================
Coverage 93.95% 93.96%
=======================================
Files 285 285
Lines 43754 43834 +80
=======================================
+ Hits 41108 41187 +79
- Misses 2646 2647 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ok, I have now added you can access the attributes like so:
These will display minute values of 00, 15, 30 and 45 for I haven't updated the netcdf reader (as @ameraner suggested) simply as I'm not familiar with that reader and don't have much time to make changes in unfamiliar code. Hopefully someone else can do that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks a lot! I have a couple of questions/comments:
- Is there a reason why the HRIT reader doesn't have properties for nominal times?
- Regarding naming consistency: Should
scheduled_time
in the AHI HSD reader be deprecated and renamed tonominal_start_time
? - Please shortly explain the nominal time attributes in the metadata chapter in the docs
Because I couldn't find a way to access them as a user! But you raise a good point. Have updated for this now.
Probably! Should we have that as a separate PR?
Will do, may take some time as I'll need to figure out how to edit the docs. |
👍 Separate PR for AHI sounds good! |
Ok, I've now updated the documentation and have also added a couple of small extra tests test that exceptions are raised if a bad grid origin or earth model is found in the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good to me now! Also thanks for adding those extra tests. Just one final nitpick, then good to merge from my point of view!
@@ -584,7 +601,7 @@ def create_test_header(earth_model, dataset_id, is_full_disk, is_rapid_scan): | |||
reference_grid: { | |||
'ColumnDirGridStep': column_dir_grid_step, | |||
'LineDirGridStep': line_dir_grid_step, | |||
'GridOrigin': 2, # south-east corner | |||
'GridOrigin': gridorigin, # south-east corner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is now outdated. Could you please explain in the docstring that the default value of 2 represents the south-east corner and then remove this comment?
Can't tell why coveralls thinks the coverage dropped... |
…d NAT readers, swap the `start_time` and `end_time` in the NAT reader to match those used in the HRIT reader.
In the semi-recent AHI work I did we defined a new https://satpy.readthedocs.io/en/latest/readers.html#time-metadata |
Oh, this looks very nice! But maybe this can be done in a separate PR? |
I'd be OK with that. I'm a little worried people are going to get used to the new attributes here, but I'm not a user of the SEVIRI native reader so maybe that's OK. |
@sfinkens @simonrp84 What if I did it in this PR? Edit: I noticed that CodeScene doesn't like the quality of this PR so I thought I'd clean that up and add the time_parameter changes. |
Go ahead :) |
Feel free, I won't have time until tomorrow evening but can do it then if you're busy today. |
Step 1 was to fix the code quality issues. That is done now. Now I'll try to rework the time_parameters. |
@sfinkens @simonrp84 I have an...issue. The decision in this PR was that |
At this time I have not changed what |
This seems reasonable to me, but if we also change the HRIT file to use the planned start and end times (rather than the current use of observation start and end times) then the reader is no longer tolerant to the situation where the prologue file is missing for a timeslot: As the plannet start/end times are in the prologue whilst the observation start/end times are in the epilogue. Would like the opinion of the met center people on this - is losing the tolerance to a missing prologue acceptable? If we keep this PR for the native reader and deal with HRIT separately then this is not a problem, however. |
…observation times.
That is an interesting problem...however is that how the reader is actually configured to work? I mean, does the satpy reader allow for no prologue file. On mobile but I didn't think the code had a try/except around getting the nominal times so it would have failed with no prologue anyway. |
I thought we just use the datetime from the filenames for HRIT 🤔 Also, I at least have the segment gatherer configured so that the PRO file is always required, whether we need it or not. |
I think atm the hrit reader won't work if any of épi or pro files are missing. We probably could change that, at the cost of having degraded metadata when these files are missing. Regarding start and end time. We have seen that using real acquisition times can slow down the reading significantly. So I would suggest to use metadata/nominal values for these as default for all readers, and further make the acquisition time per line available as a coordinate for users that require more precise values. |
@mraspaud Good point with the performance. I'm a bit torn regarding the other time attributes. On the one hand I like your idea of the scanline acquisition being the only reference. Especially if a user selects a subset of scanlines, there's no mechanism to update the attributes accordingly. On the other hand I'm not sure whether all file formats provide acquisition timestamps. So I feel like it would make sense to keep the |
So once I fix the test that @simonrp84 didn't update (test driven development!), it sounds like we're all OK with this being merged even if it undermines the original idea/purpose of this PR? |
Oh no. The |
Good spot, I missed that - using the nominal times will be slightly less accurate, but no less so than the existing assumption that using the nominal times instead of actual times is OK for angle generation. |
I've modified the title and description to describe what this PR actually (currently) does. If there are no other comments today I will probably merge this as-is and we can plan on bringing the HRIT reader up to date in a future PR. |
Thanks @djhoese ! |
Edit: The original purpose of this PR has changed. Originally it switched the native reader to use the observation time for the generic start and end time, but since its original creation a new "standard" has been described to use nominal time for the start/end time and put all time metadata in a special
time_parameters
subdictionary of.attrs
.Original Description:
The SEVIRI HRIT and NAT readers are currently inconsistent with their start/end time values:
Gives:
This is because the HRIT reader selects:
['ImageProductionStats']['ActualScanningSummary']['ForwardScanStart']
and['ImageProductionStats']['ActualScanningSummary']['ForwardScanEnd']
from the trailer / epilogue.The NAT reader, though, selects:
['ImageAcquisition']['PlannedAcquisitionTime']['TrueRepeatCycleStart']
and['ImageAcquisition']['PlannedAcquisitionTime']['PlannedRepeatCycleEnd']
from the header.In this PR I update the NAT reader to select the same start/end time values as the HRIT reader uses. With the PR, the output of the above code snippet is: