-
Notifications
You must be signed in to change notification settings - Fork 293
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 scanline timestamps to seviri_l1b_hrit #752
Add scanline timestamps to seviri_l1b_hrit #752
Conversation
Make them available as non-dimensional coordinate
Codecov Report
@@ Coverage Diff @@
## master #752 +/- ##
==========================================
+ Coverage 80.68% 80.75% +0.06%
==========================================
Files 149 149
Lines 21650 21871 +221
==========================================
+ Hits 17469 17662 +193
- Misses 4181 4209 +28
Continue to review full report at Codecov.
|
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.
Great PR as usual, thanks! It looks good, I just have a couple of questions, among which: can this be useful for other seviri formats ?
return datetime(1958, 1, 1) + timedelta(days=float(days), | ||
milliseconds=float(msecs)) | ||
if isinstance(days, (int, float)): | ||
days = np.array([days], dtype='int64') |
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.
What if days is a float ? Shouldn't something go over to msecs ?
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.
Right, that doesn't make sense. Both days and msecs are expected to be integer, so the check for float should be removed. It was meant to check whether the input is scalar. But maybe np.isscalar
is a better option
days.astype('timedelta64[D]') + msecs.astype('timedelta64[ms]') | ||
|
||
if len(time) == 1: | ||
return time[0] |
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.
Is this needed ? Don't we always have the time as an array with multiple values .?
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.
Yes. the scanline timestamps are always multiple values. The use case I had in mind are attributes which contain a single timestamp (day, msec)
(not sure whether they exist). If scalars are provided to the function, it would return a scalar, not an array. But I agree that it might be confusing to have different return types.
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.
I think this is a good balance from what I can tell. Adds it as a coordinate, shows how to use it in a MultiIndex. I have the same questions as @mraspaud, but otherwise looks pretty good.
Oh, I completely forgot about the big picture 😅 In the native format each record has its own timestamp, but it should be relatively easy to provide it. Never used the netCDF format before. I will order one at EUM and see whether it includes scanline timestamps. |
- Use np.isscalar to check for scalar input - Replace 1958-01-01 00:00 with NaT in this method already
@sjoro Summarizing the discussion on slack:
|
The conclusion was we leave the scanline timestamps for the other SEVIRI readers to another PR |
Named it
acq_time
because it is a non-dimension coordinate, in contrast totime
which is expected to be a dimension coordinate in the CF Writer (see also http://xarray.pydata.org/en/stable/data-structures.html?highlight=coordinates#coordinates).Resampling drops the acquisition time which I think is correct
I changed the return value of
satpy.readers.seviri_base.get_cds_time
to datetime64, but it hasn't been used anywhere yetAdded a basic reader introduction and a recipe to enable
.sel(time=...)
viaMultiIndex
to the docsTests added
Tests passed
Passes
git diff origin/master -- "*py" | flake8 --diff
Fully documented