Skip to content

Commit

Permalink
Merge pull request #98 from daavid00/resdataOPM
Browse files Browse the repository at this point in the history
Improving performance and resdata as requirement
  • Loading branch information
daavid00 authored Dec 2, 2024
2 parents feac0f5 + ee2561b commit 567b2af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
19 changes: 9 additions & 10 deletions src/pyopmspe11/utils/mapproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
import numpy as np
import pandas as pd
from shapely.geometry import Polygon
from resdata.resfile import ResdataFile
from resdata.grid import Grid

try:
from opm.io.ecl import EGrid as OpmGrid
from opm.io.ecl import EclFile as OpmFile
except ImportError:
print("The opm Python package was not found, using resdata")
try:
from resdata.resfile import ResdataFile
from resdata.grid import Grid
except ImportError:
print("The resdata Python package was not found, using opm")
pass


def grid(dic):
Expand Down Expand Up @@ -461,11 +458,13 @@ def get_cell_info(dic, i):
else:
dic["xyz"] = dic["gridf"].get_xyz(global_index=i)
dic["ijk"] = dic["gridf"].get_ijk(global_index=i)
vxyz = dic["gridf"].export_corners(dic["gridf"].export_index())[i]
if "vxyz" not in dic:
dic["vxyz"] = dic["gridf"].export_corners(dic["gridf"].export_index())
dic["corns"] = (
f"{vxyz[0]}, {dic['dims'][2] -vxyz[2]}, {vxyz[3]}, "
+ f"{dic['dims'][2] -vxyz[5]}, {vxyz[15]}, {dic['dims'][2] -vxyz[17]}, "
+ f"{vxyz[12]}, {dic['dims'][2] - vxyz[14]}"
f"{dic['vxyz'][i][0]}, {dic['dims'][2] - dic['vxyz'][i][2]}, {dic['vxyz'][i][3]}, "
+ f"{dic['dims'][2] - dic['vxyz'][i][5]}, {dic['vxyz'][i][15]}, "
+ f"{dic['dims'][2] - dic['vxyz'][i][17]}, "
+ f"{dic['vxyz'][i][12]}, {dic['dims'][2] - dic['vxyz'][i][14]}"
)


Expand Down
11 changes: 4 additions & 7 deletions src/pyopmspe11/visualization/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from resdata.grid import Grid
from resdata.resfile import ResdataFile
from resdata.summary import Summary

try:
from opm.io.ecl import EclFile as OpmFile
from opm.io.ecl import EGrid as OpmGrid
from opm.io.ecl import ERst as OpmRestart
from opm.io.ecl import ESmry as OpmSummary
except ImportError:
print("The Python package opm was not found, using resdata")
try:
from resdata.grid import Grid
from resdata.resfile import ResdataFile
from resdata.summary import Summary
except ImportError:
print("The resdata Python package was not found, using opm")
pass

GAS_DEN_REF = 1.86843
WAT_DEN_REF = 998.108
Expand Down

0 comments on commit 567b2af

Please sign in to comment.