Skip to content

Commit

Permalink
Create import_case_properties.py (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenherje committed Apr 27, 2023
1 parent 5d42171 commit 226db63
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/rips/PythonExamples/import_case_properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#######################################################
#
# This file shows how to import properties for a
# grid case created with .ROFFASC files
#
# Same procedure can also be used for .GRDECL files
#
#######################################################


# Access to environment variables and path tools
import os

# Load ResInsight Processing Server Client Library
import rips

# Connect to ResInsight instance
resinsight = rips.Instance.find()

# This requires the TestModels to be installed with ResInsight (RESINSIGHT_BUNDLE_TESTMODELS):
resinsight_exe_path = os.environ.get("RESINSIGHT_EXECUTABLE")

# Get the TestModels path from the executable path
resinsight_install_path = os.path.dirname(resinsight_exe_path)
test_models_path = os.path.join(resinsight_install_path, "TestModels")

# Get the .roff case
roff_case_path = os.path.join(
test_models_path, "reek/reek_box_grid_w_out_props.roffasc"
)
roff_case = resinsight.project.load_case(roff_case_path)

# PORO and EQLNUM should not be among available properties yet
for prop in roff_case.available_properties("INPUT_PROPERTY"):
print(prop)

# Import properties with file paths
poro_property_path = os.path.join(
test_models_path, "reek/reek_box_PORO_property.roffasc"
)
eqlnum_property_path = os.path.join(
test_models_path, "reek/reek_box_EQLNUM_property.roffasc"
)
roff_case.import_properties(file_names=[poro_property_path, eqlnum_property_path])

# PORO and EQLNUM should now be among available properties
for prop in roff_case.available_properties("INPUT_PROPERTY"):
print(prop)

0 comments on commit 226db63

Please sign in to comment.