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

Use step plot for rate vectors #8671

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Use step plot for rate vectors #8671

merged 2 commits into from
Sep 13, 2024

Conversation

xjules
Copy link
Contributor

@xjules xjules commented Sep 10, 2024

Issue
Resolves #8574

  • Add test for is_rate

Approach
If ensemble is rate plot it via draw_style="steps"

image

(Screenshot of new behavior in GUI if applicable)

  • 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

@xjules xjules self-assigned this Sep 10, 2024
@xjules xjules changed the title Add step plot for rate vectors Use step plot for rate vectors Sep 10, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 90.76923% with 6 lines in your changes missing coverage. Please review.

Project coverage is 90.90%. Comparing base (a7b09b7) to head (511f613).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ert/shared/storage/summary_key_utils.py 90.32% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8671      +/-   ##
==========================================
- Coverage   90.90%   90.90%   -0.01%     
==========================================
  Files         342      343       +1     
  Lines       21207    21271      +64     
==========================================
+ Hits        19279    19337      +58     
- Misses       1928     1934       +6     
Flag Coverage Δ
gui-tests 76.11% <66.15%> (-0.04%) ⬇️
integration-tests 53.41% <43.07%> (-0.02%) ⬇️
unit-tests 69.00% <90.76%> (+0.35%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@berland
Copy link
Contributor

berland commented Sep 11, 2024

An idea is to use a summary key generator with hypothesis and prove that the resdata C-code and this Python-code is doing exactly the same.

@@ -45,11 +46,13 @@ def plot(
plot_context.deactivateDateSupport()
plot_context.x_axis = plot_context.INDEX_AXIS

draw_style = "steps-pre" if is_rate(plot_context.key()) else None
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried changing steps-pre to something non-sensical to check if it would fail any tests. At least not any tests in tests/unit_tests/gui failed. Could you have a check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently there is no "rate" plot tests. Maybe I can add one that will see if draw_style was set?

Copy link
Contributor

Choose a reason for hiding this comment

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

at least there should be a test that triggers the line to uncover blatant mistakes in e.g. the string arguments given to matplotlib

This adds a key util function is_rate which determines whether the key
represents a rate or not (Source: resdata). Additionally, adding tests
that validate that the is_rate gives consinsent results
with Summary.is_rate function.
 - exploits "steps-pre" drawing style
 - tests that draw_style is set correctly
Copy link
Contributor

@berland berland left a comment

Choose a reason for hiding this comment

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

👍🏻

@xjules xjules merged commit d8b17e4 into equinor:main Sep 13, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotting of rate vectors is wrong
3 participants