#5372 Implement getting reservoir bounding box from Python

This commit is contained in:
Gaute Lindkvist
2020-01-23 14:43:51 +01:00
parent 8bbfe9e7af
commit 23e6bc2e86
11 changed files with 131 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ if resinsight is not None:
print("Case name: " + case.name)
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:

View File

@@ -222,6 +222,19 @@ class Case(PdmObject):
"""
return self.__case_stub.GetTimeSteps(self.__request).dates
def reservoir_boundingbox(self):
"""Get the reservoir bounding box
Returns: A class with six double members: min_x, max_x, min_y, max_y, min_z, max_z
"""
return self.__case_stub.GetReservoirBoundingBox(self.__request)
def reservoir_depth_range(self):
"""Get the reservoir depth range
Returns: A tuple with two members. The first is the minimum depth, the second is the maximum depth
"""
bbox = self.reservoir_boundingbox()
return -bbox.max_z, -bbox.min_z
def days_since_start(self):
"""Get a list of decimal values representing days since the start of the simulation"""
return self.__case_stub.GetDaysSinceStart(self.__request).day_decimals

View File

@@ -1,5 +1,6 @@
import sys
import os
import math
import pytest
import grpc
import tempfile
@@ -23,6 +24,21 @@ def test_OneCase(rips_instance, initialize_test):
cases = rips_instance.project.cases()
assert(len(cases) is 1)
def test_BoundingBox(rips_instance, initialize_test):
case = rips_instance.project.load_case(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID")
assert(case.name == "TEST10K_FLT_LGR_NNC")
boundingbox = case.reservoir_boundingbox()
assert(math.isclose(3382.90, boundingbox.min_x, abs_tol=1.0e-1))
assert(math.isclose(5850.48, boundingbox.max_x, abs_tol=1.0e-1))
assert(math.isclose(4157.45, boundingbox.min_y, abs_tol=1.0e-1))
assert(math.isclose(7354.93, boundingbox.max_y, abs_tol=1.0e-1))
assert(math.isclose(-4252.61, boundingbox.min_z, abs_tol=1.0e-1))
assert(math.isclose(-4103.60, boundingbox.max_z, abs_tol=1.0e-1))
min_depth, max_depth = case.reservoir_depth_range()
assert(math.isclose(4103.60, min_depth, abs_tol=1.0e-1))
assert(math.isclose(4252.61, max_depth, abs_tol=1.0e-1))
def test_MultipleCases(rips_instance, initialize_test):
case_paths = []
case_paths.append(dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID")