Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary observations are now matched against responses with nearest time (1 second tolerance) #6988

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

eivindjahren
Copy link
Contributor

@eivindjahren eivindjahren commented Jan 22, 2024

Since summary files have precision loss of time, we need to include some
tolerance when matching responses to observations.

Also contains a workaround for storage not handling datetimes with
microseconds due to index overflow in netcdf3.
#6952

The added test currently takes ~40s to run, but improvements to ensemble_evaluator startup overhead (which is being worked on) should fix this.

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure tests pass locally (after every commit!)

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@eivindjahren eivindjahren force-pushed the add_cludge branch 4 times, most recently from 91e519a to fa0125d Compare January 23, 2024 07:38
@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bfb7547) 84.39% compared to head (b096a40) 84.48%.
Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6988      +/-   ##
==========================================
+ Coverage   84.39%   84.48%   +0.08%     
==========================================
  Files         367      366       -1     
  Lines       21884    21794      -90     
  Branches      900      900              
==========================================
- Hits        18470    18412      -58     
+ Misses       3120     3088      -32     
  Partials      294      294              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eivindjahren eivindjahren force-pushed the add_cludge branch 2 times, most recently from 7cdce3d to 15eb39a Compare January 23, 2024 14:21
@eivindjahren eivindjahren self-assigned this Jan 23, 2024
@eivindjahren eivindjahren marked this pull request as ready for review January 23, 2024 14:21
@eivindjahren eivindjahren changed the title Add workaround for problems with microseconds Summary observations are now matched against responses with nearest time (1 second tolerance) Jan 23, 2024
@eivindjahren eivindjahren added the release-notes:bug-fix Automatically categorise as bug fix in release notes label Jan 23, 2024
Copy link
Collaborator

@oyvindeide oyvindeide left a comment

Choose a reason for hiding this comment

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

Looks like a really good improvement! Some smaller comments

src/ert/config/summary_config.py Show resolved Hide resolved
f"""
NUM_REALIZATIONS 2
ECLBASE CASE
SUMMARY FOPR
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed because of the SUMMARY_OBSERVATION (but can be here)

tests/integration_tests/test_observation_times.py Outdated Show resolved Hide resolved
tests/unit_tests/test_load_forward_model.py Show resolved Hide resolved
tests/unit_tests/test_load_forward_model.py Show resolved Hide resolved
@eivindjahren eivindjahren force-pushed the add_cludge branch 3 times, most recently from 68c969d to 3983237 Compare January 24, 2024 09:39
@@ -316,7 +316,8 @@ def _read_spec(
hour=hour,
minute=minute,
second=microsecond // 10**6,
microsecond=microsecond % 10**6,
# Due to https://github.com/equinor/ert/issues/6952
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you make this comment stand-alone? Otherwise I foresee a future where the below line will simply be deleted, as I assume that it is related to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

start_date + unit.make_delta(float(vals[date_index]))
),
)
# Due to https://github.com/equinor/ert/issues/6952
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you make this comment stand-alone? Otherwise I foresee a future where the below line will simply be deleted, as I assume that it is related to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@eivindjahren eivindjahren force-pushed the add_cludge branch 2 times, most recently from b9fa349 to b096a40 Compare January 24, 2024 10:00
Since summary files have precision loss of time, we need to include some
tolerance when matching responses to observations.

Also contains a workaround for storage not handling datetimes with
microseconds due to index overflow in netcdf3.
equinor#6952
@eivindjahren eivindjahren merged commit 789d7dc into equinor:main Jan 24, 2024
42 of 44 checks passed
@eivindjahren eivindjahren deleted the add_cludge branch January 24, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:bug-fix Automatically categorise as bug fix in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants