Python: Add first_date_as_comment option to generate_schedule_text

Some commercial simulators reject a DATES keyword whose value equals the
simulation start date. The earliest event date is, by construction, that start
date, so generate_schedule_text now emits it as a comment line (e.g.
"-- Date: 1 JAN 2024") instead of a DATES keyword by default.

The new first_date_as_comment parameter (default True) threads from the Python
wrapper through the GenerateSchedule scriptable method into
RicScheduleDataGenerator. Only the first/earliest date is affected; later dates
are always emitted as DATES keywords. Pass first_date_as_comment=False to
restore the previous behavior.
This commit is contained in:
Kristian Bendiksen committed 2026-06-01 11:28:27 +02:00
1 parent c722aa83e5
commit cb9274ecd6
6 files changed
+122 -18

No files matched your search

+7
View File
@@ -288,6 +288,7 @@ def generate_schedule_text(
self: WellEventTimeline,
eclipse_case: EclipseCase,
export_msw_for_wells: List[WellPath] = [],
first_date_as_comment: bool = True,
) -> str:
"""Generate Eclipse schedule text for all wells in the collection.
@@ -304,6 +305,11 @@ def generate_schedule_text(
multi-segment-well keywords (WELSEGS, COMPSEGS, WSEGVALV, WSEGAICD)
are exported. Wells not in the list get no MSW keywords. An empty
list (the default) suppresses MSW export for all wells.
first_date_as_comment (bool): When True (the default), the first
(earliest) date is written as a comment line (e.g. "-- Date: 1 JAN
2024") instead of a DATES keyword. This avoids a DATES entry equal
to the simulation start date, which some commercial simulators
reject. Later dates are always emitted as DATES keywords.
Returns:
str: Eclipse schedule text containing DATES, COMPDAT, WELSEGS, WCONPROD, etc.
@@ -346,6 +352,7 @@ def generate_schedule_text(
container = self.generate_schedule(
eclipse_case=eclipse_case,
export_msw_for_wells=export_msw_for_wells,
first_date_as_comment=first_date_as_comment,
)
if container and container.values:
return "".join(container.values)