Use time from simulation start in Show Plot Data - #14545
Open
magnesj wants to merge 1 commit into
Open
Conversation
When the summary plot time axis is configured to show time from simulation start, the text produced by Show Plot Data and the ASCII export now reports the same values instead of date and time. The time column header becomes "Time [<unit>]", and each row reports the elapsed time relative to the first time step of the first curve, scaled to the display unit selected on the time axis. Plots using the date based time axis are unchanged. Time in months and years is computed using calendar arithmetic instead of a fixed number of seconds per unit, so a time step exactly N calendar months or years after the simulation start reports exactly N. This makes resampled data report whole numbers also when a leap year is part of the interval. The calendar arithmetic is available as RiaQDateTimeTools::calendarYearsBetween() and calendarMonthsBetween(), and is used both when plotting the curves and when reporting the time column.
magnesj
force-pushed
the
14543-time-from-simulation-start-in-show-plot-data
branch
from
August 19, 2026 09:06
c6326aa to
cdeeca5
Compare
magnesj
marked this pull request as ready for review
August 19, 2026 09:15
kriben
requested changes
Aug 19, 2026
Comment on lines
+66
to
+67
| static double calendarYearsBetween( time_t startTime, time_t endTime ); | ||
| static double calendarMonthsBetween( time_t startTime, time_t endTime ); |
Collaborator
There was a problem hiding this comment.
time_t still? Either use QDateTime or std::chrono::time_point?
| // arithmetic, so a time step exactly N calendar months/years after the start reports exactly N. | ||
| static double timeFromSimulationStart( time_t simulationStartTime, time_t timeStep, TimeUnitType displayUnit ); | ||
| double timeFromSimulationStart( time_t simulationStartTime, time_t timeStep ) const; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14543
When the summary plot time axis is set to "Time From Simulation Start", Show Plot Data still reported dates. The tabbed text now uses the same time representation as the axis.
The time column header becomes
Time [<unit>]using the unit selected on the time axis, and each row reports the elapsed time relative toRimSummaryPlot::firstTimeStepOfFirstCurve()scaled byfromTimeTToDisplayUnitScale(), which is the same origin and scaling the axis itself uses. Both the resampled and the non-resampled export paths are covered, including the observed-curves and pasted-ASCII-data sections. Plots on the date based time axis are unchanged.The conversion is applied in
RimSummaryPlot::asciiDataForSummaryPlotExport(), so the ASCII export feature and the export button in the Show Plot Data dialog stay consistent with what is displayed.