-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix #48942 add 1 timestep to AnimationRange #49283
Conversation
@@ -132,7 +132,8 @@ QgsDateTimeRange QgsMeshDataProviderTemporalCapabilities::timeExtent( const QDat | |||
if ( !times.isEmpty() ) | |||
{ | |||
durationSinceFirst += times.first(); | |||
durationSinceLast += times.last(); | |||
// adding one timestep (length as: times.last() - times.beforeLast)), to be sure we have enough steps | |||
durationSinceLast += times.last() + ( times.last() - times[times.length() - 2] ); |
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.
Note that having data with just 1 timestep, the 'times' here will be empty, so you will only enter this if when length is at least 2 so times[times.length() - 2] is safe.
@PeterPetrik @vcloarec can you maybe guide me a little to fix the test, if you have time? Obviously after this commit, the resulting temporal extents are changed (as I add one timestep), but I'm unclear which parts of the test test_temporal() I can change (I'm not so familiar with this "datasetIndexClosestFromRelativeTime etc" kind of options: The crux of this commit: because the temporal controller is working with 'range'-filter, with an INcluding start and an EXcluding end (of the filter range), the last timestep in a Mesh is never shown in the Temporal controller, because the extent calculated earlier was UNTILL the last timestep (after the reference time). Sorry if I'm not clear enough... |
Hi Richard, |
@vcloarec yes, maybe you are right. Another (in this case working option) is to add
That will always add an 'extra' timestep (in case of other temporal datasets also I think) @nyalldawson do you have an opinion in this? Both options 'work'. Crux here: in a netcdf (mesh in general?) you define a 'period since' timestep, so say:
@vcloarec though there is an argument that the stepcount in the meshprovider is off by one...
There I count 31(!) datasets/timesteps, while if you load this in QGIS, the controller just shows 30(!). |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Hmm, this is strange, I would assume it would pick the last step. If you open a similar example in the vector layer, does it show the last step? |
@PeterPetrik there has been a time (pre 2021) when the temporal filter took both limits into account (INcluding both start en end limit). At that time the mdal filter worked correctly. Working with measurements with time ranges, I've put a lot of effort to change this, so (the default option) is to include the start limit (of the filter range) and to exclude the end limit (for more discussion see the lengthy conversation of this issue: #38468 and PR #40989 (and the followups of that one). Argh!! Vector is behaving the same (see the project + data below): It has all to do with the fact that data with just one timestamp column (instantaneous data), in which the event has zero-length (in time), the last step is in that case never shown... Which would be an argument to add always one extra timestep in totalFrameCount: |
Fixing the widget is what @vcloarec suggested too, it should behave the same for vector & mesh, so in case there are more frames we could take the last one too.... Could you make such PR to discuss that implementation instead of this one? |
@PeterPetrik yes, will do, closing this one. Sorry for the fuzz... |
Description
This small change will Fix #48942
The TemporalController does not take the last step into account, when loading Mesh layers.
This zip:
123steps.zip
contains 3 netcdf's (ugrid) with 1, 2 and 3 (day) timesteps to test.
WIthout this commit, you will not be able to see the last timestep, without changing the Animation range.
Note that we do the same (add one timestep to the range) for Vector temporal properties:
https://github.com/qgis/QGIS/blob/master/src/core/vector/qgsvectorlayertemporalproperties.cpp#L74