def test_create(self): config = self.createTestPath("local/custom_kw/mini_config") with ErtTestContext("python/enkf/data/custom_kw_simulated", config) as context: ert = context.getErt() es_update = ESUpdate( ert ) self.assertFalse( es_update.hasModule( "NO_NOT_THIS_MODULE" )) with self.assertRaises(KeyError): m = es_update.getModule( "STD_ENKF_XXX" ) module = es_update.getModule( "STD_ENKF" )
def test_create(self): config = self.createTestPath("local/custom_kw/mini_config") with ErtTestContext("python/enkf/data/custom_kw_simulated", config) as context: ert = context.getErt() es_update = ESUpdate(ert) self.assertFalse(es_update.hasModule("NO_NOT_THIS_MODULE")) with self.assertRaises(KeyError): m = es_update.getModule("STD_ENKF_XXX") module = es_update.getModule("STD_ENKF")
def update(self, line): arguments = splitArguments(line) if len(arguments) == 1: case_name = arguments[0] ert = self.ert() fs_manager = ert.getEnkfFsManager() es_update = ESUpdate( ert ) target_fs = fs_manager.getFileSystem(case_name) source_fs = fs_manager.getCurrentFileSystem( ) success = es_update.smootherUpdate( source_fs , target_fs ) if not success: self.lastCommandFailed("Unable to perform update") else: self.lastCommandFailed("Expected one argument: <target_fs> received: '%s'" % line)
def run(self): target = self._run_widget.target_case() source = self._run_widget.source_case() ert = ERT.ert fs_manager = ert.getEnkfFsManager() es_update = ESUpdate(ert) target_fs = fs_manager.getFileSystem(target) source_fs = fs_manager.getFileSystem(source) success = es_update.smootherUpdate( source_fs , target_fs ) if not success: msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setWindowTitle("Run Analysis") msg.setText("Unable to run analysis for case '%s'." % source) msg.setStandardButtons(QMessageBox.Ok) msg.exec_() return ERT.ertChanged.emit() self._dialog.accept()
def __init__(self, model_config, strict=True, verbose=True): c_ptr = self._alloc(model_config, strict, verbose) super(EnKFMain, self).__init__(c_ptr) # The model_config argument can be None; the only reason to # allow that possibility is to be able to test that the # site-config loads correctly. if model_config is None: self.__simulation_runner = None self.__fs_manager = None self.__es_update = None else: self.__simulation_runner = EnkfSimulationRunner(self) self.__fs_manager = EnkfFsManager(self) self.__es_update = ESUpdate(self) self.__key_manager = KeyManager(self)
def __init__(self, model_config, strict=True, verbose=True): if model_config is not None and not isfile(model_config): raise IOError('No such configuration file "%s".' % model_config) c_ptr = self._alloc(model_config, strict, verbose) if c_ptr: super(EnKFMain, self).__init__(c_ptr) else: raise ValueError( 'Failed to construct EnKFMain instance from config %s.' % model_config) # The model_config argument can be None; the only reason to # allow that possibility is to be able to test that the # site-config loads correctly. if model_config is None: self.__simulation_runner = None self.__fs_manager = None self.__es_update = None else: self.__simulation_runner = EnkfSimulationRunner(self) self.__fs_manager = EnkfFsManager(self) self.__es_update = ESUpdate(self) self.__key_manager = KeyManager(self)