Skip to content

Conversation

@eivindjahren
Copy link
Contributor

@eivindjahren eivindjahren commented Jan 19, 2026

This avoids an issue with resdata.geometry.Surface where floating point formatting
is erronously localized in irap files. This only applies to one test in ert so it is enough
to work around it by using xtgeo instead.

  • 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 unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

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: Add backport label to latest release (format: 'backport release-branch-name')

This is to avoid a bug in resdata where ascii irap
is erronously applied locale formatted floats.

Note that there is no longer a need to transpose
the output from load_parameters as that was only
there because resdata.Surface::__setitem__ would
use F-order of indices.
@eivindjahren eivindjahren requested a review from achaikou January 19, 2026 12:04
@eivindjahren eivindjahren self-assigned this Jan 19, 2026
@eivindjahren eivindjahren added the release-notes:flaky-test-fix PR fixes a flaky test label Jan 19, 2026
@eivindjahren eivindjahren moved this to Ready for Review in SCOUT Jan 19, 2026
@eivindjahren eivindjahren changed the title Fix surf locale Fix test failing for environments where floating point numbers are localized Jan 19, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.64%. Comparing base (c528c39) to head (6b20232).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12667      +/-   ##
==========================================
- Coverage   90.67%   90.64%   -0.04%     
==========================================
  Files         429      429              
  Lines       29803    29803              
==========================================
- Hits        27025    27015      -10     
- Misses       2778     2788      +10     
Flag Coverage Δ
cli-tests 37.56% <ø> (ø)
gui-tests 69.37% <ø> (-0.04%) ⬇️
performance-and-unit-tests 73.91% <ø> (-0.02%) ⬇️
test 38.07% <ø> (ø)

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 19, 2026

Merging this PR will not alter performance

✅ 22 untouched benchmarks


Comparing eivindjahren:fix_surf_locale (6b20232) with main (c528c39)

Open in CodSpeed

Copy link

@achaikou achaikou 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 qt no longer bothers my tests and the problem is fixed. Thank you!

From my side, just a couple of questions about the established approach to the code 🙂

config += config_str
expect_surface = Surface(
nx=2, ny=2, xinc=1, yinc=1, xstart=1, ystart=1, angle=0
expect_surface = RegularSurface(

Choose a reason for hiding this comment

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

Would appreciate some grand knowledge ☺️

So there are surfaces in 3 libraries:

  • resdata.Geometry.Surface (used before for writing)
  • xtgeo.RegularSurface (used now for writing)
  • surfio.IrapSurface (used now for reading surface data in create_runpath - ErtConfig - EnsembleConfig - SurfaceConfig)

What is the difference between those libraries and when should each be used?
What is the reason for read-write mismatch?

Comment on lines +140 to +141
actual_surface -= expect_surface
assert (actual_surface <= 1e-5).all()

Choose a reason for hiding this comment

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

This looks somewhat weird to me.

Is this an established ert-way to compare floating points regardless of values even when we deal with two surfaces with well defined integer values?

I would have expected something more straighforward, like
assert np.array_equal(actual_surface.values, expect_surface.values)

xori=1.0,
yori=1,
rotation=0.0,
values=values,

Choose a reason for hiding this comment

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

Intellisense/pylance or something keeps screaming at me that there is a type mismatch (values are list of lists, when xtgeo requires just a list)

Another place in the test it also complains about who-knows-what.

So my question is: how strict should we be to such warnings? I see those pop here and there.
Given all that "mypy" type checking I thought we cared?

@github-project-automation github-project-automation bot moved this from Ready for Review to Reviewed in SCOUT Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:flaky-test-fix PR fixes a flaky test

Projects

Status: Reviewed

Development

Successfully merging this pull request may close these issues.

3 participants