當前位置: 首頁>>代碼示例>>Python>>正文


Python EnKFMain.create_new_config方法代碼示例

本文整理匯總了Python中ert.enkf.enkf_main.EnKFMain.create_new_config方法的典型用法代碼示例。如果您正苦於以下問題:Python EnKFMain.create_new_config方法的具體用法?Python EnKFMain.create_new_config怎麽用?Python EnKFMain.create_new_config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ert.enkf.enkf_main.EnKFMain的用法示例。


在下文中一共展示了EnKFMain.create_new_config方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from ert.enkf.enkf_main import EnKFMain [as 別名]
# 或者: from ert.enkf.enkf_main.EnKFMain import create_new_config [as 別名]
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_())
開發者ID:JacobStoren,項目名稱:ert,代碼行數:71,代碼來源:gert_main.py


注:本文中的ert.enkf.enkf_main.EnKFMain.create_new_config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。