Beispiel #1
0
 def test_model_config_dict_constructor(self):
     case_directory = self.createTestPath("local/configuration_tests")
     with TestAreaContext("test_constructor") as work_area:
         work_area.copy_directory(case_directory)
         res_config = ResConfig(
             user_config_file="configuration_tests/model_config.ert")
         config_dict = {
             ConfigKeys.MAX_RESAMPLE:
             1,
             ConfigKeys.JOBNAME:
             "model_config_test",
             ConfigKeys.RUNPATH:
             "/tmp/simulations/run%d",
             ConfigKeys.NUM_REALIZATIONS:
             10,
             ConfigKeys.ENSPATH:
             "configuration_tests/Ensemble",
             ConfigKeys.TIME_MAP:
             "configuration_tests/input/refcase/time_map.txt",
             ConfigKeys.OBS_CONFIG:
             ("configuration_tests/input/observations/observations.txt"),
             ConfigKeys.DATAROOT:
             "configuration_tests/",
             ConfigKeys.HISTORY_SOURCE:
             HistorySourceEnum(1),
             ConfigKeys.GEN_KW_EXPORT_NAME:
             "parameter_test.json",
             ConfigKeys.FORWARD_MODEL: [
                 {
                     ConfigKeys.NAME:
                     "COPY_FILE",
                     ConfigKeys.ARGLIST: ("<FROM>=input/schedule.sch, "
                                          "<TO>=output/schedule_copy.sch"),
                 },
                 {
                     ConfigKeys.NAME: "SNAKE_OIL_SIMULATOR",
                     ConfigKeys.ARGLIST: "",
                 },
                 {
                     ConfigKeys.NAME: "SNAKE_OIL_NPV",
                     ConfigKeys.ARGLIST: "",
                 },
                 {
                     ConfigKeys.NAME: "SNAKE_OIL_DIFF",
                     ConfigKeys.ARGLIST: "",
                 },
             ],
         }
         model_config = ModelConfig(
             data_root="",
             joblist=res_config.site_config.get_installed_jobs(),
             last_history_restart=res_config.ecl_config.
             getLastHistoryRestart(),
             refcase=res_config.ecl_config.getRefcase(),
             config_dict=config_dict,
         )
         self.assertEqual(model_config, res_config.model_config)
Beispiel #2
0
    def _get_history_src_enum(config_dict, config_content):
        hist_src_enum = None
        if config_dict and ConfigKeys.HISTORY_SOURCE in config_dict:
            hist_src_enum = config_dict.get(ConfigKeys.HISTORY_SOURCE)

        if config_content and config_content.hasKey(ConfigKeys.HISTORY_SOURCE):
            hist_src_str = config_content.getValue(ConfigKeys.HISTORY_SOURCE)
            hist_src_enum = HistorySourceEnum.from_string(hist_src_str)

        return hist_src_enum