def run(self, *args):
        facade = LibresFacade(self.ert())

        parser = spearman_job_parser()
        args = parser.parse_args(args)

        spearman_job(facade, args.threshold, args.dry_run)
Exemple #2
0
def test_main_entry_point_gen_data(monkeypatch):
    scal_job = Mock()
    monkeypatch.setattr(spearman, "scaling_job", scal_job)

    test_data_dir = os.path.join(TEST_DATA_DIR, "local", "snake_oil")

    shutil.copytree(test_data_dir, "test_data")
    os.chdir(os.path.join("test_data"))

    res_config = ResConfig("snake_oil.ert")

    ert = EnKFMain(res_config)
    facade = LibresFacade(ert)

    spearman.spearman_job(facade, 1.0, False)

    assert scal_job.call_count == 71
    def run(self, *args):
        facade = LibresFacade(self.ert())

        obs_keys = [
            facade.get_observation_key(nr)
            for nr, _ in enumerate(facade.get_observations())
        ]
        measured_data = MeasuredData(facade, obs_keys)

        parser = spearman_job_parser()
        args = parser.parse_args(args)

        scaling_configs = spearman_job(measured_data, args.threshold)

        if not args.dry_run:
            try:
                CorrelatedObservationsScalingJob(
                    self.ert()).run(scaling_configs)
            except EmptyDatasetException:
                pass
Exemple #4
0
def run(misfit_preprocessor_config, measured_data, reporter):
    config = assemble_config(misfit_preprocessor_config, measured_data)
    if not config.valid:
        raise ValidationError("Invalid configuration of misfit preprocessor",
                              config.errors)

    config = config.snapshot
    if config.clustering.method == SPEARMAN_CORRELATION:
        sconfig = config.clustering.spearman_correlation
        scaling_configs = spearman_job(
            measured_data,
            sconfig.fcluster.t,
            reporter,
            criterion=sconfig.fcluster.criterion,
            depth=sconfig.fcluster.depth,
            method=sconfig.linkage.method,
            metric=sconfig.linkage.metric,
        )
    else:
        raise AssertionError("Unknown clustering method: {}".format(
            config.clustering.method))

    return scaling_configs