mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
#14514 Add option to include list of dates into schedule file
GenerateSchedule gains an AdditionalDates parameter (ISO date strings). The dates are merged, deduplicated and sorted with the event dates and each becomes a DATES keyword even when no events fall on it, ensuring a summary report at that date in Eclipse/Flow. They are deliberately not filtered by the last applied timestamp. The ORIONEVENTS 2.0 format gains a top-level REPORT <date-expr> directive (date variables and day arithmetic supported). Parsed dates are collected on OrionDocument.report_dates and surfaced by the applier as sorted ISO strings on ApplyReport.report_dates, ready to pass to generate_schedule_text(additional_dates=...).
This commit is contained in:
@@ -592,6 +592,13 @@ RimcWellEventTimeline_generateSchedule::RimcWellEventTimeline_generateSchedule(
|
||||
"",
|
||||
"",
|
||||
"Emit a column-header comment and right-aligned, fixed-width columns instead of the compact form" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_additionalDates,
|
||||
"AdditionalDates",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Additional dates (YYYY-MM-DD or full ISO timestamp) emitted as DATES keywords, e.g. to "
|
||||
"force summary reports at those dates" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -641,6 +648,24 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellEventTimeline_generateSche
|
||||
return std::unexpected( QString( "No well paths with events found" ) );
|
||||
}
|
||||
|
||||
// Merge in user-specified additional dates: each becomes a DATES keyword even when no events
|
||||
// fall on it (e.g. to force a summary report). They are deliberately not filtered by the last
|
||||
// applied timestamp.
|
||||
if ( !m_additionalDates().empty() )
|
||||
{
|
||||
std::set<QDateTime> mergedDates( dates.begin(), dates.end() );
|
||||
for ( const QString& dateString : m_additionalDates() )
|
||||
{
|
||||
QDateTime additionalDate = QDateTime::fromString( dateString, Qt::ISODate );
|
||||
if ( !additionalDate.isValid() )
|
||||
{
|
||||
return std::unexpected( QString( "Invalid date format: %1. Expected YYYY-MM-DD" ).arg( dateString ) );
|
||||
}
|
||||
mergedDates.insert( additionalDate );
|
||||
}
|
||||
dates.assign( mergedDates.begin(), mergedDates.end() );
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> mswWellPaths = m_exportMswForWells.ptrReferencedObjectsByType();
|
||||
std::set<const RimWellPath*> mswWells( mswWellPaths.begin(), mswWellPaths.end() );
|
||||
|
||||
|
||||
@@ -231,4 +231,5 @@ private:
|
||||
caf::PdmPtrArrayField<RimWellPath*> m_exportMswForWells;
|
||||
caf::PdmField<bool> m_firstDateAsComment;
|
||||
caf::PdmField<bool> m_alignColumns;
|
||||
caf::PdmField<std::vector<QString>> m_additionalDates;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user