#4430 Add python method to get coarsening info for case.

Equivalent to GetCoarseningInfo in Octave.
This commit is contained in:
Kristian Bendiksen
2020-02-20 21:40:43 +01:00
parent d497f04d0d
commit 8167d9f700
5 changed files with 70 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
###################################################################################
# This example will connect to ResInsight, retrieve a list of cases and print info
#
#
###################################################################################
# Import the ResInsight Processing Server Module
@@ -19,11 +19,16 @@ if resinsight is not None:
print("Case type: " + case.type)
print("Case grid path: " + case.grid_path())
print("Case reservoir bounding box:", case.reservoir_boundingbox())
timesteps = case.time_steps()
for t in timesteps:
print("Year: " + str(t.year))
print("Month: " + str(t.month))
coarsening_info = case.coarsening_info()
if coarsening_info:
print("Coarsening information:")
for c in coarsening_info:
print("[{}, {}, {}] - [{}, {}, {}]".format(c.min.x, c.min.y, c.min.z,
c.max.x, c.max.y, c.max.z))

View File

@@ -971,3 +971,12 @@ class Case(PdmObject):
for value in chunk.cells:
cells.append(value)
return cells
def coarsening_info(self):
"""Get a coarsening information for all grids in the case.
Returns:
A list of CoarseningInfo objects with two Vec3i min and max objects
for each entry.
"""
return self.__case_stub.GetCoarseningInfoArray(self.__request).data

View File

@@ -113,6 +113,10 @@ def test_10k(rips_instance, initialize_test):
check_corner(cell_corners[cell_index].c6, expected_corners[6])
check_corner(cell_corners[cell_index].c7, expected_corners[7])
# No coarsening info for this case
coarsening_info = case.coarsening_info()
assert(len(coarsening_info) == 0)
def test_PdmObject(rips_instance, initialize_test):
case_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
case = rips_instance.project.load_case(path=case_path)