本文整理汇总了Python中ert.enkf.enkf_main.EnKFMain类的典型用法代码示例。如果您正苦于以下问题:Python EnKFMain类的具体用法?Python EnKFMain怎么用?Python EnKFMain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EnKFMain类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_context
def test_run_context(self):
with TestAreaContext("enkf_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config")
fs_manager = main.getEnkfFsManager()
fs = fs_manager.getCurrentFileSystem( )
iactive = BoolVector(initial_size = 10 , default_value = True)
iactive[0] = False
iactive[1] = False
run_context = main.getRunContextENSEMPLE_EXPERIMENT( fs , iactive )
self.assertEqual( len(run_context) , 8 )
with self.assertRaises(IndexError):
run_context[8]
with self.assertRaises(TypeError):
run_context["String"]
run_arg = run_context[0]
self.assertTrue( isinstance( run_arg , RunArg ))
with self.assertRaises(ValueError):
run_context.iensGet(0)
with self.assertRaises(ValueError):
run_context.iensGet(1)
arg0 = run_context[0]
arg2 = run_context.iensGet( 2 )
示例2: test_with_enkf_fs
def test_with_enkf_fs(self):
config_file = self.createTestPath("Statoil/config/with_data/config")
with TestAreaContext("enkf/summary_key_set/enkf_fs", store_area=True) as context:
context.copy_parent_content(config_file)
fs = EnkfFs("storage/default")
summary_key_set = fs.getSummaryKeySet()
summary_key_set.addSummaryKey("FOPT")
summary_key_set.addSummaryKey("WWCT")
summary_key_set.addSummaryKey("WOPR")
fs.umount()
ert = EnKFMain("config", site_config=None)
fs = ert.getEnkfFsManager().getCurrentFileSystem()
summary_key_set = fs.getSummaryKeySet()
self.assertTrue("FOPT" in summary_key_set)
self.assertTrue("WWCT" in summary_key_set)
self.assertTrue("WOPR" in summary_key_set)
ensemble_config = ert.ensembleConfig()
self.assertTrue("FOPT" in ensemble_config)
self.assertTrue("WWCT" in ensemble_config)
self.assertTrue("WOPR" in ensemble_config)
self.assertFalse("TCPU" in ensemble_config)
示例3: test_repr
def test_repr( self ):
with TestAreaContext("enkf_test", store_area=True) as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config")
pfx = 'EnKFMain(ensemble_size'
self.assertEqual(pfx, repr(main)[:len(pfx)])
main.free()
示例4: test_enkf_create_config_file
def test_enkf_create_config_file(self):
config_file = "test_new_config"
dbase_type = "BLOCK_FS"
num_realizations = 42
with TestAreaContext("python/ens_condif/create_config" , store_area = True) as ta:
EnKFMain.createNewConfig(config_file, "storage" , dbase_type, num_realizations)
main = EnKFMain(config_file)
self.assertEqual(main.getEnsembleSize(), num_realizations)
示例5: test_enkf_state
def test_enkf_state(self):
with TestAreaContext("enkf_library_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config")
state = main.getRealisation( 0 )
with self.assertRaises(TypeError):
state.addSubstKeyword( "GEO_ID" , 45)
state.addSubstKeyword("GEO_ID" , "45")
示例6: test_ecl_config_creation
def test_ecl_config_creation(self):
with self.assertRaises(NotImplementedError):
ecl_config = EclConfig()
with TestAreaContext("enkf_library_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config", self.site_config)
self.assertIsInstance(main.analysis_config(), AnalysisConfig)
self.assertIsInstance(main.ecl_config(), EclConfig)
with self.assertRaises(AttributeError):
self.assertIsInstance(main.ecl_config().get_refcase(), EclSum)
time_map = main.get_fs().get_time_map()
self.assertIsInstance(time_map, TimeMap)
del main
示例7: test_ecl_config_creation
def test_ecl_config_creation(self):
with TestAreaContext("enkf_library_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config", self.site_config)
self.assertIsInstance(main.analysisConfig(), AnalysisConfig)
self.assertIsInstance(main.eclConfig(), EclConfig)
with self.assertRaises(ValueError): # Null pointer!
self.assertIsInstance(main.eclConfig().getRefcase(), EclSum)
file_system = main.getEnkfFsManager().getCurrentFileSystem()
self.assertEqual(file_system.getCaseName(), "default")
time_map = file_system.getTimeMap()
self.assertIsInstance(time_map, TimeMap)
main.free()
示例8: test_observations
def test_observations(self):
with TestAreaContext("enkf_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config")
count = 10
summary_key = "test_key"
observation_key = "test_obs_key"
summary_observation_node = EnkfConfigNode.createSummaryConfigNode(summary_key, LoadFailTypeEnum.LOAD_FAIL_EXIT)
observation_vector = ObsVector(EnkfObservationImplementationType.SUMMARY_OBS, observation_key, summary_observation_node, count)
main.getObservations().addObservationVector(observation_vector)
values = []
for index in range(0, count):
value = index * 10.5
std = index / 10.0
summary_observation_node = SummaryObservation(summary_key, observation_key, value, std)
observation_vector.installNode(index, summary_observation_node)
self.assertEqual(observation_vector.getNode(index), summary_observation_node)
self.assertEqual(value, summary_observation_node.getValue())
values.append((index, value, std))
observations = main.getObservations()
test_vector = observations[observation_key]
index = 0
for node in test_vector:
self.assertTrue( isinstance( node , SummaryObservation ))
self.assertEqual( node.getValue( ) , index * 10.5 )
index += 1
self.assertEqual(observation_vector, test_vector)
for index, value, std in values:
self.assertTrue(test_vector.isActive(index))
summary_observation_node = test_vector.getNode(index)
"""@type: SummaryObservation"""
self.assertEqual(value, summary_observation_node.getValue())
self.assertEqual(std, summary_observation_node.getStandardDeviation())
self.assertEqual(summary_key, summary_observation_node.getSummaryKey())
main.free()
示例9: test_bootstrap
def test_bootstrap( self ):
with TestAreaContext("enkf_test", store_area=True) as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config", self.site_config_file)
self.assertTrue(main, "Load failed")
main.free()
示例10: test_config
def test_config( self ):
with TestAreaContext("enkf_test") as work_area:
work_area.copy_directory(self.case_directory)
main = EnKFMain("simple_config/minimum_config", self.site_config_file)
self.assertIsInstance(main.ensembleConfig(), EnsConfig)
self.assertIsInstance(main.analysisConfig(), AnalysisConfig)
self.assertIsInstance(main.getModelConfig(), ModelConfig)
#self.assertIsInstance(main.local_config(), LocalConfig) #warn: Should this be None?
self.assertIsInstance(main.siteConfig(), SiteConfig)
self.assertIsInstance(main.eclConfig(), EclConfig)
self.assertIsInstance(main.plot_config(), PlotConfig)
# self.main.load_obs(obs_config_file)
self.assertIsInstance(main.getObservations(), EnkfObs)
self.assertIsInstance(main.get_templates(), ErtTemplates)
self.assertIsInstance(main.getEnkfFsManager().getFileSystem(), EnkfFs)
# self.assertIsInstance(main.iget_member_config(0), MemberConfig)
self.assertIsInstance(main.getMemberRunningState(0), EnKFState)
main.free()
示例11: main
def main():
app = QtGui.QApplication(sys.argv) #Early so that QT is initialized before other imports
from ert_gui.pages.config.configpages import ConfigPages
from ert_gui.pages.plot.plotpanel import PlotPanel
splash = QtGui.QSplashScreen(resourceImage("newsplash") , QtCore.Qt.WindowStaysOnTopHint)
splash.show()
splash.showMessage("Starting up...", QtCore.Qt.AlignLeft, QtCore.Qt.white)
app.processEvents()
window = Application()
splash.showMessage("Bootstrapping...", QtCore.Qt.AlignLeft, QtCore.Qt.white)
app.processEvents()
ert = ErtWrapper( )
strict = True
site_config = os.getenv("ERT_SITE_CONFIG")
if len(sys.argv) == 1:
print "-----------------------------------------------------------------"
print "-- You must supply the name of configuration file as the first --"
print "-- commandline argument: --"
print "-- --"
print "-- bash% gert <config_file> --"
print "-- --"
print "-- If the configuration file does not exist, gert will create --"
print "-- create a new configuration file. --"
print "-----------------------------------------------------------------"
#sys.exit(0)
else:
enkf_config = sys.argv[1]
if not os.path.exists(enkf_config):
print "Trying to start new config"
new_configuration_dialog = NewConfigurationDialog(enkf_config)
success = new_configuration_dialog.exec_()
if not success:
print "Can not run without a configuration file."
sys.exit(1)
else:
enkf_config = new_configuration_dialog.getConfigurationPath()
firste_case_name = new_configuration_dialog.getCaseName()
dbase_type = new_configuration_dialog.getDBaseType()
num_realizations = new_configuration_dialog.getNumberOfRealizations()
storage_path = new_configuration_dialog.getStoragePath()
EnKFMain.create_new_config(enkf_config, storage_path , firste_case_name, dbase_type, num_realizations)
strict = False
ert.bootstrap(enkf_config, site_config = site_config, strict = strict)
window.setSaveFunction(ert.save)
splash.showMessage("Creating GUI...", QtCore.Qt.AlignLeft, QtCore.Qt.white)
app.processEvents()
window.addPage("Configuration", resourceIcon("config"), ConfigPages(window))
window.addPage("Init" , resourceIcon("db"), InitPanel(window))
window.addPage("Run" , resourceIcon("run"), RunPanel(window))
window.addPage("Plots", resourceIcon("plot"), PlotPanel())
splash.showMessage("Communicating with ERT...", QtCore.Qt.AlignLeft, QtCore.Qt.white)
app.processEvents()
ContentModel.contentModel = ert
ContentModel.updateObservers()
window.show()
splash.finish(window)
sys.exit(app.exec_())
示例12: test_site_bootstrap
def test_site_bootstrap( self ):
with TestAreaContext("enkf_test", store_area=True) as work_area:
EnKFMain.loadSiteConfig()