mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make it possible to edit case group statistics
This commit is contained in:
parent
4e33b7454f
commit
beb6256f53
@ -169,6 +169,7 @@ if (PYTHON_EXECUTABLE)
|
||||
"rips/View.py"
|
||||
"rips/examples/InstanceExample.py"
|
||||
"rips/examples/CommandExample.py"
|
||||
"rips/examples/CaseGridGroup.py"
|
||||
"rips/examples/CaseInfoStreamingExample.py"
|
||||
"rips/examples/SoilPorvAsync.py"
|
||||
"rips/examples/SoilPorvSync.py"
|
||||
|
@ -26,10 +26,9 @@ class PdmObject:
|
||||
listOfKeywords.append(keyword)
|
||||
return listOfKeywords
|
||||
|
||||
def getValue(self, keyword):
|
||||
value = self.pb2Object.parameters[keyword]
|
||||
def __toValue(self, value):
|
||||
if value.lower() == 'false':
|
||||
return False
|
||||
return False
|
||||
elif value.lower() == 'true':
|
||||
return True
|
||||
else:
|
||||
@ -43,18 +42,43 @@ class PdmObject:
|
||||
except ValueError:
|
||||
# We may have a string. Strip internal start and end quotes
|
||||
value = value.strip('\"')
|
||||
if self.__islist(value):
|
||||
return self.__makelist(value)
|
||||
return value
|
||||
|
||||
def setValue(self, keyword, value):
|
||||
def __fromValue(self, value):
|
||||
if isinstance(value, bool):
|
||||
if value:
|
||||
self.pb2Object.parameters[keyword] = "true"
|
||||
return "true"
|
||||
else:
|
||||
self.pb2Object.parameters[keyword] = "false"
|
||||
return "false"
|
||||
elif isinstance(value, list):
|
||||
listofstrings = []
|
||||
for val in value:
|
||||
listofstrings.append(self.__fromValue(val))
|
||||
return "[" + ", ".join(listofstrings) + "]"
|
||||
elif isinstance(value, str):
|
||||
self.pb2Object.parameters[keyword] = "\"" + str(value) + "\""
|
||||
return "\"" + str(value) + "\""
|
||||
else:
|
||||
self.pb2Object.parameters[keyword] = str(value)
|
||||
return str(value)
|
||||
|
||||
def getValue(self, keyword):
|
||||
value = self.pb2Object.parameters[keyword]
|
||||
return self.__toValue(value)
|
||||
|
||||
def __islist(self, value):
|
||||
return value.startswith("[") and value.endswith("]")
|
||||
|
||||
def __makelist(self, liststring):
|
||||
liststring = liststring.lstrip("[")
|
||||
liststring = liststring.rstrip("]")
|
||||
strings = liststring.split(", ")
|
||||
values = []
|
||||
for string in strings:
|
||||
values.append(self.__toValue(string))
|
||||
return values
|
||||
|
||||
def setValue(self, keyword, value):
|
||||
self.pb2Object.parameters[keyword] = self.__fromValue(value)
|
||||
|
||||
def descendants(self, classKeyword):
|
||||
request = PdmObject_pb2.PdmChildObjectRequest(object=self.pb2Object, child_keyword=classKeyword)
|
||||
|
@ -11,4 +11,17 @@ casePaths.append("../../../../TestModels/Case_with_10_timesteps/Real0/BRUGGE_000
|
||||
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)
|
||||
print("Group name = " + groupName)
|
||||
|
||||
caseGroups = resInsight.project.descendants("RimIdenticalGridCaseGroup");
|
||||
for caseGroup in caseGroups:
|
||||
print ("#### Case Group ####")
|
||||
for kw in caseGroup.keywords():
|
||||
print (kw, caseGroup.getValue(kw))
|
||||
statCases = caseGroup.descendants("RimStatisticalCalculation")
|
||||
for statCase in statCases:
|
||||
print(" ## Stat Case ##")
|
||||
for skw in statCase.keywords():
|
||||
print(" ", skw, statCase.getValue(skw))
|
||||
statCase.setValue("DynamicPropertiesToCalculate", statCase.getValue("DynamicPropertiesToCalculate") + ["SWAT"])
|
||||
statCase.update()
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RicNewViewFeature.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
@ -73,20 +74,20 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
|
||||
m_selectionSummary.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
m_selectionSummary.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultType, "ResultType", "Result Type", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_resultType, "ResultType", "Result Type", "", "", "");
|
||||
m_resultType.xmlCapability()->setIOWritable(false);
|
||||
CAF_PDM_InitFieldNoDefault(&m_porosityModel, "PorosityModel", "Porosity Model", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_porosityModel, "PorosityModel", "Porosity Model", "", "", "");
|
||||
m_porosityModel.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedDynamicProperties, "DynamicPropertiesToCalculate", "Dyn Prop", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedStaticProperties, "StaticPropertiesToCalculate", "Stat Prop", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedGeneratedProperties, "GeneratedPropertiesToCalculate", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedInputProperties, "InputPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedDynamicProperties, "DynamicPropertiesToCalculate", "Dyn Prop", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedStaticProperties, "StaticPropertiesToCalculate", "Stat Prop", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedGeneratedProperties, "GeneratedPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedInputProperties, "InputPropertiesToCalculate", "", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedFractureDynamicProperties, "FractureDynamicPropertiesToCalculate", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedFractureStaticProperties, "FractureStaticPropertiesToCalculate", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedFractureGeneratedProperties, "FractureGeneratedPropertiesToCalculate", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedFractureInputProperties, "FractureInputPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedFractureDynamicProperties, "FractureDynamicPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedFractureStaticProperties, "FractureStaticPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedFractureGeneratedProperties, "FractureGeneratedPropertiesToCalculate", "", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_selectedFractureInputProperties, "FractureInputPropertiesToCalculate", "", "", "", "");
|
||||
|
||||
m_selectedDynamicProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
m_selectedStaticProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
@ -98,16 +99,16 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
|
||||
m_selectedFractureGeneratedProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
m_selectedFractureInputProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&m_calculatePercentiles, "CalculatePercentiles", true, "Calculate Percentiles", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_percentileCalculationType, "PercentileCalculationType", "Method", "", "", "");
|
||||
RICF_InitField(&m_calculatePercentiles, "CalculatePercentiles", true, "Calculate Percentiles", "", "", "");
|
||||
RICF_InitFieldNoDefault(&m_percentileCalculationType, "PercentileCalculationType", "Method", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_lowPercentile, "LowPercentile", 10.0, "Low", "", "", "");
|
||||
CAF_PDM_InitField(&m_midPercentile, "MidPercentile", 50.0, "Mid", "", "", "");
|
||||
CAF_PDM_InitField(&m_highPercentile, "HighPercentile", 90.0, "High", "", "", "");
|
||||
RICF_InitField(&m_lowPercentile, "LowPercentile", 10.0, "Low", "", "", "");
|
||||
RICF_InitField(&m_midPercentile, "MidPercentile", 50.0, "Mid", "", "", "");
|
||||
RICF_InitField(&m_highPercentile, "HighPercentile", 90.0, "High", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RiaDefines::undefinedResultName(), "Well Data Source Case", "", "", "" );
|
||||
RICF_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RiaDefines::undefinedResultName(), "Well Data Source Case", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, "Use Zero as Inactive Cell Value", "", "", "");
|
||||
RICF_InitField(&m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, "Use Zero as Inactive Cell Value", "", "", "");
|
||||
|
||||
m_populateSelectionAfterLoadingGrid = false;
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -55,10 +58,12 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
||||
{
|
||||
CAF_PDM_InitObject("Grid Case Group", ":/GridCaseGroup16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Grid Case Group"), "Name", "", "", "");
|
||||
RICF_InitField(&name, "UserDescription", QString("Grid Case Group"), "Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&groupId, "GroupId", -1, "Case Group ID", "", "" ,"");
|
||||
RICF_InitField(&groupId, "GroupId", -1, "Case Group ID", "", "" ,"");
|
||||
groupId.uiCapability()->setUiReadOnly(true);
|
||||
groupId.capability<RicfFieldHandle>()->setIOWriteable(false);
|
||||
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&statisticsCaseCollection, "StatisticsCaseCollection", "statisticsCaseCollection ChildArrayField", "", "", "");
|
||||
statisticsCaseCollection.uiCapability()->setUiHidden(true);
|
||||
|
Loading…
Reference in New Issue
Block a user