mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4463 Working creation of grid case groups
This commit is contained in:
@@ -71,7 +71,8 @@ class Commands:
|
||||
|
||||
"""
|
||||
commandReply = self.__execute(loadCase=Cmd.FilePathRequest(path=path))
|
||||
assert commandReply.HasField("loadCaseResult")
|
||||
assert(commandReply is not None)
|
||||
assert(commandReply.HasField("loadCaseResult"))
|
||||
return Case(self.channel, commandReply.loadCaseResult.id)
|
||||
|
||||
def replaceCase(self, newGridFile, caseId=0):
|
||||
@@ -83,7 +84,7 @@ class Commands:
|
||||
|
||||
"""
|
||||
return self.__execute(replaceCase=Cmd.ReplaceCaseRequest(newGridFile=newGridFile,
|
||||
caseId=caseId))
|
||||
caseId=caseId))
|
||||
|
||||
def replaceSourceCases(self, gridListFile, caseGroupId=0):
|
||||
"""Replace all source cases within a case group
|
||||
@@ -94,7 +95,22 @@ class Commands:
|
||||
|
||||
"""
|
||||
return self.__execute(replaceSourceCases=Cmd.ReplaceSourceCasesRequest(gridListFile=gridListFile,
|
||||
caseGroupId=caseGroupId))
|
||||
caseGroupId=caseGroupId))
|
||||
|
||||
def createGridCaseGroup(self, casePaths):
|
||||
"""Create a Grid Case Group from a list of cases
|
||||
|
||||
Arguments:
|
||||
casePaths (list): list of file path strings
|
||||
|
||||
Returns:
|
||||
A case group id and name
|
||||
"""
|
||||
commandReply = self.__execute(createGridCaseGroup=Cmd.CreateGridCaseGroupRequest(casePaths=casePaths))
|
||||
assert(commandReply is not None)
|
||||
assert(commandReply.HasField("createGridCaseGroupResult"))
|
||||
return (commandReply.createGridCaseGroupResult.groupId, commandReply.createGridCaseGroupResult.groupName)
|
||||
|
||||
##################
|
||||
# Export Commands
|
||||
##################
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '../../'))
|
||||
import rips
|
||||
|
||||
resInsight = rips.Instance.find()
|
||||
|
||||
casePaths = []
|
||||
casePaths.append("../../../../TestModels/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
||||
casePaths.append("../../../../TestModels/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
||||
groupId, groupName = resInsight.commands.createGridCaseGroup(casePaths=casePaths)
|
||||
print("Group id = " + str(groupId))
|
||||
print("Group name = " + groupName)
|
||||
@@ -88,4 +88,4 @@ def test_replaceCase(rips_instance, initializeTest):
|
||||
assert(len(cases) is 1)
|
||||
case = project.case(id=0)
|
||||
assert(case.name == "Real0--BRUGGE_0000.EGRID")
|
||||
assert(case.id == 0)
|
||||
assert(case.id == 0)
|
||||
|
||||
@@ -33,4 +33,12 @@ def test_exportPropertyInView(rips_instance, initializeTest):
|
||||
rips_instance.commands.exportPropertyInViews(0, "3D View", 0)
|
||||
expectedFileName = case.name + "-" + str("3D_View") + "-" + "T0" + "-SOIL"
|
||||
fullPath = tmpdirname + "/" + expectedFileName
|
||||
assert(os.path.exists(fullPath))
|
||||
assert(os.path.exists(fullPath))
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith('linux'), reason="Brugge is currently exceptionally slow on Linux")
|
||||
def test_loadGridCaseGroup(rips_instance, initializeTest):
|
||||
casePaths = []
|
||||
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
||||
casePaths.append(dataroot.PATH + "/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
||||
groupId, groupName = rips_instance.commands.createGridCaseGroup(casePaths=casePaths)
|
||||
print(groupId, groupName)
|
||||
Reference in New Issue
Block a user