Skip to content

Handle Missing Reference SMSPEC in Well Comparison Plots#7202

Open
bska wants to merge 1 commit into
OPM:masterfrom
bska:well-comp-new-cases
Open

Handle Missing Reference SMSPEC in Well Comparison Plots#7202
bska wants to merge 1 commit into
OPM:masterfrom
bska:well-comp-new-cases

Conversation

@bska

@bska bska commented Jun 25, 2026

Copy link
Copy Markdown
Member

Improve tests/plot_well_comparison.py so plot generation works when a new case has no reference summary yet.

  • Add analyze_new_case() to generate plots from the simulation case only, skipping TIME/YEARS and empty/all-zero curves.
  • In plot mode, check SMSPEC file existence before constructing ESmry:
    • run_analysis() when both reference and simulation files exist
    • analyze_new_case() when only simulation exists
    • fail with a clear error message when simulation is missing
  • Refactor analysis function signatures to accept prebuilt SMSPEC filenames (ref_smspec/sim_smspec) from main, avoiding duplicate filename construction inside the functions.

This avoids C++ exceptions from ESmry on missing files while keeping the existing compare workflow unchanged when references are available.

@bska bska added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Jun 25, 2026
@bska bska requested a review from Copilot June 25, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates tests/plot_well_comparison.py to prevent ESmry from throwing when the reference .SMSPEC is missing, enabling plot generation for “new” simulation cases that don’t yet have a reference summary.

Changes:

  • Refactors run_analysis() to accept prebuilt .SMSPEC filenames instead of constructing them internally.
  • Adds analyze_new_case() to generate plots from the simulation case only when the reference summary is absent.
  • Adds .SMSPEC existence checks in plot mode to select compare-vs-reference vs sim-only behavior, and exits with an error when the simulation summary is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/plot_well_comparison.py
Comment thread tests/plot_well_comparison.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread tests/plot_well_comparison.py Outdated
Comment thread tests/plot_well_comparison.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@bska

bska commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

jenkins build this please

Improve tests/plot_well_comparison.py so plot generation works when a
new case has no reference summary yet.

* Add analyze_new_case() to generate plots from the simulation case
    only, skipping TIME/YEARS and empty/all-zero curves.
* In plot mode, check SMSPEC file existence before constructing ESmry:
    - run_analysis() when both reference and simulation files exist
    - analyze_new_case() when only simulation exists
    - fail with a clear error message when simulation is missing
* Refactor analysis function signatures to accept prebuilt SMSPEC
    filenames (ref_smspec/sim_smspec) from main, avoiding duplicate
    filename construction inside the functions.

This avoids C++ exceptions from ESmry on missing files while keeping
the existing compare workflow unchanged when references are available.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bska bska force-pushed the well-comp-new-cases branch from 286d302 to 6469ad8 Compare June 25, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants