Skip to content

Use time from simulation start in Show Plot Data - #14545

Open
magnesj wants to merge 1 commit into
OPM:devfrom
magnesj:14543-time-from-simulation-start-in-show-plot-data
Open

Use time from simulation start in Show Plot Data#14545
magnesj wants to merge 1 commit into
OPM:devfrom
magnesj:14543-time-from-simulation-start-in-show-plot-data

Conversation

@magnesj

@magnesj magnesj commented Aug 18, 2026

Copy link
Copy Markdown
Member

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 to RimSummaryPlot::firstTimeStepOfFirstCurve() scaled by fromTimeTToDisplayUnitScale(), 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.

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
magnesj force-pushed the 14543-time-from-simulation-start-in-show-plot-data branch from c6326aa to cdeeca5 Compare August 19, 2026 09:06
@magnesj
magnesj marked this pull request as ready for review August 19, 2026 09:15
@magnesj
magnesj requested a review from kriben August 19, 2026 09:17
@magnesj magnesj self-assigned this 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 );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More time_t..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use time from simulation start in Show Plot Data

2 participants