mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#14514 Orion Events: Include report dates in schedule
This commit is contained in:
@@ -816,11 +816,6 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellEventTimeline_generateSche
|
||||
wellPathsWithEvents = timeline->getWellPathsWithEvents();
|
||||
}
|
||||
|
||||
if ( dates.empty() )
|
||||
{
|
||||
return std::unexpected( QString( "No events found in timeline" ) );
|
||||
}
|
||||
|
||||
// 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.
|
||||
@@ -839,6 +834,11 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellEventTimeline_generateSche
|
||||
dates.assign( mergedDates.begin(), mergedDates.end() );
|
||||
}
|
||||
|
||||
if ( dates.empty() )
|
||||
{
|
||||
return std::unexpected( QString( "No events or additional dates found in timeline" ) );
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> mswWellPaths = m_exportMswForWells.ptrReferencedObjectsByType();
|
||||
std::set<const RimWellPath*> mswWells( mswWellPaths.begin(), mswWellPaths.end() );
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ def main():
|
||||
)
|
||||
print(f" Events applied: {report.events_applied}")
|
||||
print(f" Events skipped: {report.events_skipped}")
|
||||
print(f" Report dates: {report.report_dates}")
|
||||
for warning in report.warnings:
|
||||
print(f" WARNING: {warning}")
|
||||
for error in report.errors:
|
||||
@@ -86,11 +87,13 @@ def main():
|
||||
|
||||
# Generate Eclipse schedule text from the timeline.
|
||||
print("\n4. Generating Eclipse schedule text...")
|
||||
if report.events_applied == 0:
|
||||
print(" No events applied - skipping schedule generation.")
|
||||
if report.events_applied == 0 and not report.report_dates:
|
||||
print(" No events or report dates found - skipping schedule generation.")
|
||||
return
|
||||
schedule_text = timeline.generate_schedule_text(
|
||||
eclipse_case=case, export_msw_for_wells=project.well_paths()
|
||||
eclipse_case=case,
|
||||
export_msw_for_wells=project.well_paths(),
|
||||
additional_dates=report.report_dates,
|
||||
)
|
||||
if schedule_text:
|
||||
print(f" Generated schedule text ({len(schedule_text)} characters):")
|
||||
|
||||
@@ -1880,6 +1880,24 @@ class TestOrionEventsIntegration:
|
||||
assert " 300" in schedule
|
||||
assert "RESTART\n" not in schedule
|
||||
|
||||
def test_report_only_document_generates_schedule(self, project_with_case_and_wells):
|
||||
project, case, timeline = project_with_case_and_wells
|
||||
document = parse_orion_events(
|
||||
"ORIONEVENTS 2.0\nREPORT 2024-02-01\nREPORT 2024-06-01\n"
|
||||
)
|
||||
|
||||
report = apply_orion_document(document, timeline, project)
|
||||
schedule = timeline.generate_schedule_text(
|
||||
eclipse_case=case,
|
||||
first_date_as_comment=False,
|
||||
additional_dates=report.report_dates,
|
||||
)
|
||||
|
||||
assert report.events_applied == 0
|
||||
assert report.report_dates == ["2024-02-01", "2024-06-01"]
|
||||
assert "1 'FEB' 2024" in schedule
|
||||
assert "1 'JUN' 2024" in schedule
|
||||
|
||||
def test_apply_creates_perforations_and_schedule(self, project_with_case_and_wells):
|
||||
"""End-to-end: parse -> apply -> set_timestamp -> generate schedule."""
|
||||
project, case, timeline = project_with_case_and_wells
|
||||
|
||||
Reference in New Issue
Block a user