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

Improving performance and resdata as requirement #98

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading