Track and write measurement time for area - #3168
Conversation
Start unit test to track time for the SEVIRI HRIT reader. This is to prepare an implementation of pytroll#3161. There is no implementation yet.
Added a first implementation for SEVIRI per-pixel times in ancillary variables. So far just takes the scanline time for all pixels in the scanline.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3168 +/- ##
==========================================
+ Coverage 96.32% 96.36% +0.04%
==========================================
Files 466 469 +3
Lines 59096 59452 +356
==========================================
+ Hits 56922 57293 +371
+ Misses 2174 2159 -15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pull Request Test Coverage Report for Build 16744116940Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
To track "valid time" through resampling for geostationary satellite data, I'm trying to think of a good way to approach this. My current thinking is that if the user creates the scene with reader_kwargs={"track_time": True}, the file handler adds per-pixel time information to the variable attributes. By putting it inside ancillary variables, dataset_walker and co ensure it gets sliced and resampled along with the parent dataset, so that at the end, an approximate measurement time can be estimated for the resampled scene. But normally ancillary variables are actual variables available in the data file, they remain text attributes until after segments have been concatenated, and then the file handler is called again for every segment, to replace the text label by actual data in ancillary variables. Therefore, I'm not sure if ancillary variables is the right place to put it, or if time should be stored there at all. |
|
Maybe it fits better in a coordinate variable, but not sure if it's valid to have those be not-unique. |
|
Coordinates can probably be non-unique, but are currently dropped in resampling. In case of nearest neighbour resampling, this is due to |
Add time as a coordinate rather than as an auxiliary variable. Start working on resampling time coordinates, so far with a failing test.
Implement time tracking as a float coordinate for SEVIRI L1B HRIT. Retain this through resampling. Add documentation on how to use this.
Adapt ninjo tag test to account for the novelty of optional dynamic tags.
|
Addressing the CodeScene complaint about I am not able to resolve this as part of this PR. |
Refactor getting the valid time out of the ninjogeotiff writer, so that the functionality is available elsewhere.
Add a test to confirm that the CO2Corrector modifier does not trigger a dask computation in the presence of non-identical time coordinates.
Retain time coordinates without computation when applying the CO2 correction.
Retain time coordinates in the arithmetic compositors and the CO2 correction, such that they are retained in the convection RGB.
|
EDIT: This comment is out of date. There is no longer a performance penalty. Original comment: This PR is strongly increasing the overhead of Calling
NB: This is just for calling resample — no computation. See also #2620. I don't yet understand why the overhead for |
|
For ninjogeotiff, the NinJo team have agreed this should go in a tag called (In case a NinJo developer or someone with access to the internal NinJo JIRA reads this: details in NinJo JIRA-38947). |
with one merge conflict
Rename the NinJo tag from ValidDateID to ValidTimeID as agreed by the NinJo team. Drop support for putting the mean time in the filename; this is not currently possible to do without triggering an early computation.
|
The worsening performance with The even-more-worsening performance with time tracking is because reduce data is called twice as often. |
Fix a performance regression in _reduce_data, where the reductions dictionary was no longer used correctly, leading to reduce_data being called for every dataset instead of every source area.
|
Both problems are solved with f70d80f. The superfluous calls to |
Fix caching when reduction, so reduce data doesn't reduce the same source area twice.
fix major merge conflict, probably introducing errors
Dynamic fields in the filename do not work, they trigger an early computation. I had removed them in an earlier commit, but missed the rollback in the CF and simple image writers.
Refactor _verify_times with three small subfunctions, thus reducing the cyclomatic complexity and hopefully satisfying codescene. And while at it, improve error messages for the IncompatibleTimes or ValueError exceptions.
Refactor the dask/time fixtures in test_atmosphere.py to reduce code duplication.
Track measurement times such that a representative measurement time can be estimated and written for an area.
To include valid time in file headers for supported writers, add
reader_kwargs: {"track_time": True}toScene.__init__andresample_coords=TruetoScene.resample.When storing as
ninjogeotiff, time coordinates will be averaged and stored in theninjo_ValidTimeIDtag.An example is included in the PR under
doc/source/examples/valid_time.rst.Those two PRs must be merged first:
_resampled_scene()and_reduce_data()methods of theSceneclass #3178Next steps, either within this PR or within one or more later PRs:
The latter is difficult to do without triggering a computation, so doing this efficiently should probably be done as postprocessing beyond the scope of this PR.
AUTHORS.mdif not there already