Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@daavid00
Copy link
Member

Adding missing conditional to avoid nans.

@daavid00
Copy link
Member Author

jenkins build this please

@blattms
Copy link
Member

blattms commented Jul 23, 2024

I see that this prevents nans, but to judge I would need to understand the original. Could you help me with that?

@daavid00
Copy link
Member Author

daavid00 commented Jul 23, 2024

For example for the grid generated using spe11c.txt, then using resdata:

from resdata.grid import Grid
resg = Grid("SPE11C.EGRID")
corners_resdata = resg.export_corners(resg.export_index())[0]
print(corners_resdata)
[  0.           0.         155.04167175   1.           0.
 155.04167175   0.         200.         131.60166931   1.
 200.         131.60166931   0.           0.         255.04167175
   1.           0.         255.04167175   0.         200.
 231.60166931   1.         200.         231.60166931]

while using opm:

from opm.io.ecl import EGrid
opmg = EGrid("SPE11C.EGRID")
corners_opm = opmg.xyz_from_ijk(0, 0, 0)
print(corners_opm)
([nan, nan, nan, nan, nan, nan, nan, nan], [nan, nan, nan, nan, nan, nan, nan, nan], 
 [155.0416717529297, 155.0416717529297, 131.60166931152344, 131.60166931152344, 255.0416717529297, 255.0416717529297, 231.60166931152344, 231.60166931152344])

This PR fixes these nans (also this conditional is present at the end of the file (lines 597-602)).

@blattms
Copy link
Member

blattms commented Jul 25, 2024

Thanks. I think I finally got it. Sometimes I do have my dense days 😅
Looks good.

@blattms blattms merged commit ee4f1b8 into OPM:master Jul 25, 2024
@daavid00 daavid00 deleted the fixNansInEgridMethod branch April 7, 2025 10:45
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.

2 participants