ert 17.1.7__py3-none-any.whl → 18.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _ert/events.py +19 -2
- ert/__main__.py +8 -7
- ert/analysis/_enif_update.py +8 -4
- ert/analysis/_update_commons.py +16 -6
- ert/cli/main.py +6 -3
- ert/cli/monitor.py +7 -0
- ert/config/__init__.py +13 -3
- ert/config/_create_observation_dataframes.py +60 -12
- ert/config/_observations.py +14 -1
- ert/config/_read_summary.py +8 -6
- ert/config/ensemble_config.py +6 -14
- ert/config/ert_config.py +19 -13
- ert/config/{everest_objective_config.py → everest_response.py} +23 -12
- ert/config/ext_param_config.py +133 -1
- ert/config/field.py +12 -8
- ert/config/forward_model_step.py +108 -6
- ert/config/gen_data_config.py +2 -6
- ert/config/gen_kw_config.py +0 -9
- ert/config/known_response_types.py +14 -0
- ert/config/parameter_config.py +0 -17
- ert/config/parsing/config_keywords.py +1 -0
- ert/config/parsing/config_schema.py +12 -0
- ert/config/parsing/config_schema_deprecations.py +11 -0
- ert/config/parsing/config_schema_item.py +1 -1
- ert/config/queue_config.py +4 -4
- ert/config/response_config.py +0 -7
- ert/config/rft_config.py +230 -0
- ert/config/summary_config.py +2 -6
- ert/config/violations.py +0 -0
- ert/config/workflow_fixtures.py +2 -1
- ert/dark_storage/client/__init__.py +2 -2
- ert/dark_storage/client/_session.py +4 -4
- ert/dark_storage/client/client.py +2 -2
- ert/dark_storage/compute/misfits.py +7 -6
- ert/dark_storage/endpoints/compute/misfits.py +2 -2
- ert/dark_storage/endpoints/observations.py +4 -4
- ert/dark_storage/endpoints/responses.py +15 -1
- ert/ensemble_evaluator/__init__.py +8 -1
- ert/ensemble_evaluator/evaluator.py +81 -29
- ert/ensemble_evaluator/event.py +6 -0
- ert/ensemble_evaluator/snapshot.py +3 -1
- ert/ensemble_evaluator/state.py +1 -0
- ert/field_utils/__init__.py +8 -0
- ert/field_utils/field_utils.py +211 -1
- ert/gui/ertwidgets/__init__.py +23 -16
- ert/gui/ertwidgets/analysismoduleedit.py +2 -2
- ert/gui/ertwidgets/checklist.py +1 -1
- ert/gui/ertwidgets/create_experiment_dialog.py +3 -1
- ert/gui/ertwidgets/ensembleselector.py +2 -2
- ert/gui/ertwidgets/models/__init__.py +2 -0
- ert/gui/ertwidgets/models/activerealizationsmodel.py +2 -1
- ert/gui/ertwidgets/models/path_model.py +1 -1
- ert/gui/ertwidgets/models/targetensemblemodel.py +2 -1
- ert/gui/ertwidgets/models/text_model.py +1 -1
- ert/gui/ertwidgets/searchbox.py +13 -4
- ert/gui/{suggestor → ertwidgets/suggestor}/_suggestor_message.py +13 -4
- ert/gui/main.py +11 -6
- ert/gui/main_window.py +1 -2
- ert/gui/simulation/ensemble_experiment_panel.py +1 -1
- ert/gui/simulation/ensemble_information_filter_panel.py +1 -1
- ert/gui/simulation/ensemble_smoother_panel.py +1 -1
- ert/gui/simulation/evaluate_ensemble_panel.py +1 -1
- ert/gui/simulation/experiment_panel.py +1 -1
- ert/gui/simulation/manual_update_panel.py +31 -8
- ert/gui/simulation/multiple_data_assimilation_panel.py +12 -8
- ert/gui/simulation/run_dialog.py +25 -4
- ert/gui/simulation/single_test_run_panel.py +2 -2
- ert/gui/summarypanel.py +1 -1
- ert/gui/tools/load_results/load_results_panel.py +1 -1
- ert/gui/tools/manage_experiments/storage_info_widget.py +7 -7
- ert/gui/tools/manage_experiments/storage_widget.py +1 -2
- ert/gui/tools/plot/plot_api.py +13 -10
- ert/gui/tools/plot/plot_window.py +12 -0
- ert/gui/tools/plot/plottery/plot_config.py +2 -0
- ert/gui/tools/plot/plottery/plot_context.py +14 -0
- ert/gui/tools/plot/plottery/plots/ensemble.py +9 -2
- ert/gui/tools/plot/plottery/plots/statistics.py +59 -19
- ert/mode_definitions.py +2 -0
- ert/plugins/__init__.py +0 -1
- ert/plugins/hook_implementations/workflows/gen_data_rft_export.py +10 -2
- ert/plugins/hook_specifications/__init__.py +0 -2
- ert/plugins/hook_specifications/jobs.py +0 -9
- ert/plugins/plugin_manager.py +2 -33
- ert/resources/shell_scripts/delete_directory.py +2 -2
- ert/run_models/__init__.py +18 -5
- ert/run_models/_create_run_path.py +56 -23
- ert/run_models/ensemble_experiment.py +10 -4
- ert/run_models/ensemble_information_filter.py +8 -1
- ert/run_models/ensemble_smoother.py +9 -3
- ert/run_models/evaluate_ensemble.py +8 -6
- ert/run_models/event.py +7 -3
- ert/run_models/everest_run_model.py +155 -44
- ert/run_models/initial_ensemble_run_model.py +23 -22
- ert/run_models/manual_update.py +4 -2
- ert/run_models/manual_update_enif.py +37 -0
- ert/run_models/model_factory.py +81 -22
- ert/run_models/multiple_data_assimilation.py +21 -10
- ert/run_models/run_model.py +54 -34
- ert/run_models/single_test_run.py +7 -4
- ert/run_models/update_run_model.py +4 -2
- ert/runpaths.py +5 -6
- ert/sample_prior.py +9 -4
- ert/scheduler/driver.py +37 -0
- ert/scheduler/event.py +3 -1
- ert/scheduler/job.py +23 -13
- ert/scheduler/lsf_driver.py +6 -2
- ert/scheduler/openpbs_driver.py +7 -1
- ert/scheduler/scheduler.py +5 -0
- ert/scheduler/slurm_driver.py +6 -2
- ert/services/__init__.py +2 -2
- ert/services/_base_service.py +31 -15
- ert/services/ert_server.py +317 -0
- ert/shared/_doc_utils/ert_jobs.py +1 -4
- ert/shared/storage/connection.py +3 -3
- ert/shared/version.py +3 -3
- ert/storage/local_ensemble.py +25 -5
- ert/storage/local_experiment.py +6 -14
- ert/storage/local_storage.py +35 -30
- ert/storage/migration/to18.py +12 -0
- ert/storage/migration/to8.py +4 -4
- ert/substitutions.py +12 -28
- ert/validation/active_range.py +7 -7
- ert/validation/rangestring.py +16 -16
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/METADATA +8 -7
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/RECORD +160 -159
- everest/bin/config_branch_script.py +3 -6
- everest/bin/everconfigdump_script.py +1 -9
- everest/bin/everest_script.py +21 -11
- everest/bin/kill_script.py +2 -2
- everest/bin/monitor_script.py +2 -2
- everest/bin/utils.py +6 -3
- everest/config/__init__.py +4 -1
- everest/config/control_config.py +61 -2
- everest/config/control_variable_config.py +2 -1
- everest/config/everest_config.py +38 -16
- everest/config/forward_model_config.py +5 -3
- everest/config/install_data_config.py +7 -5
- everest/config/install_job_config.py +7 -3
- everest/config/install_template_config.py +3 -3
- everest/config/optimization_config.py +19 -6
- everest/config/output_constraint_config.py +8 -2
- everest/config/server_config.py +6 -49
- everest/config/utils.py +25 -105
- everest/config/validation_utils.py +10 -10
- everest/config_file_loader.py +13 -2
- everest/detached/everserver.py +7 -8
- everest/everest_storage.py +6 -10
- everest/gui/everest_client.py +0 -1
- everest/gui/main_window.py +2 -2
- everest/optimizer/everest2ropt.py +59 -32
- everest/optimizer/opt_model_transforms.py +12 -13
- everest/optimizer/utils.py +0 -29
- everest/strings.py +0 -5
- ert/config/everest_constraints_config.py +0 -95
- ert/services/storage_service.py +0 -127
- everest/config/sampler_config.py +0 -103
- everest/simulator/__init__.py +0 -88
- everest/simulator/everest_to_ert.py +0 -51
- /ert/gui/{suggestor → ertwidgets/suggestor}/__init__.py +0 -0
- /ert/gui/{suggestor → ertwidgets/suggestor}/_colors.py +0 -0
- /ert/gui/{suggestor → ertwidgets/suggestor}/suggestor.py +0 -0
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/WHEEL +0 -0
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/entry_points.txt +0 -0
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/licenses/COPYING +0 -0
- {ert-17.1.7.dist-info → ert-18.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,19 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import contextlib
|
|
2
4
|
import json
|
|
3
5
|
import logging
|
|
4
6
|
import os
|
|
5
7
|
from collections.abc import Sequence
|
|
6
|
-
from typing import Any
|
|
8
|
+
from typing import TYPE_CHECKING, Any
|
|
7
9
|
|
|
8
10
|
import numpy as np
|
|
9
11
|
import pandas as pd
|
|
10
12
|
import polars as pl
|
|
11
|
-
from PyQt6.QtWidgets import QCheckBox, QWidget
|
|
12
13
|
|
|
13
14
|
from ert.config import ErtPlugin
|
|
14
15
|
from ert.plugins import CancelPluginException
|
|
15
16
|
from ert.storage import Storage
|
|
16
17
|
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from PyQt6.QtWidgets import QWidget
|
|
20
|
+
|
|
17
21
|
logger = logging.getLogger(__name__)
|
|
18
22
|
|
|
19
23
|
|
|
@@ -240,6 +244,10 @@ class GenDataRFTCSVExportJob(ErtPlugin):
|
|
|
240
244
|
list_edit = ListEditBox(ensemble_with_data_dict)
|
|
241
245
|
list_edit.setObjectName("list_of_ensembles")
|
|
242
246
|
|
|
247
|
+
# Lazy load qt outside of gui to allow
|
|
248
|
+
# running of ert in cli without wm
|
|
249
|
+
from PyQt6.QtWidgets import QCheckBox # noqa: PLC0415
|
|
250
|
+
|
|
243
251
|
drop_const_columns_check = QCheckBox()
|
|
244
252
|
drop_const_columns_check.setChecked(False)
|
|
245
253
|
drop_const_columns_check.setObjectName("drop_const_columns_check")
|
|
@@ -5,7 +5,6 @@ from .forward_model_steps import (
|
|
|
5
5
|
from .help_resources import help_links
|
|
6
6
|
from .jobs import (
|
|
7
7
|
ertscript_workflow,
|
|
8
|
-
installable_jobs,
|
|
9
8
|
installable_workflow_jobs,
|
|
10
9
|
job_documentation,
|
|
11
10
|
legacy_ertscript_workflow,
|
|
@@ -20,7 +19,6 @@ __all__ = [
|
|
|
20
19
|
"forward_model_configuration",
|
|
21
20
|
"help_links",
|
|
22
21
|
"installable_forward_model_steps",
|
|
23
|
-
"installable_jobs",
|
|
24
22
|
"installable_workflow_jobs",
|
|
25
23
|
"job_documentation",
|
|
26
24
|
"legacy_ertscript_workflow",
|
|
@@ -9,15 +9,6 @@ if TYPE_CHECKING:
|
|
|
9
9
|
from ert.plugins.plugin_response import PluginResponse
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
@no_type_check
|
|
13
|
-
@hook_specification
|
|
14
|
-
def installable_jobs() -> PluginResponse[dict[str, str]]:
|
|
15
|
-
"""
|
|
16
|
-
:return: dict with job names as keys and path to config as value
|
|
17
|
-
:rtype: PluginResponse with data as dict[str,str]
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
|
|
21
12
|
@no_type_check
|
|
22
13
|
@hook_specification(firstresult=True)
|
|
23
14
|
def job_documentation(job_name: str) -> PluginResponse[dict[str, str] | None]:
|
ert/plugins/plugin_manager.py
CHANGED
|
@@ -5,7 +5,6 @@ import logging
|
|
|
5
5
|
import warnings
|
|
6
6
|
from argparse import ArgumentParser
|
|
7
7
|
from collections.abc import Callable, Mapping, Sequence
|
|
8
|
-
from pathlib import Path
|
|
9
8
|
from typing import TYPE_CHECKING, Any, Literal, TypeVar, overload
|
|
10
9
|
|
|
11
10
|
import pluggy
|
|
@@ -13,15 +12,14 @@ from pydantic import BaseModel, Field
|
|
|
13
12
|
from typing_extensions import TypedDict
|
|
14
13
|
|
|
15
14
|
from ert.config import (
|
|
16
|
-
ForwardModelStep,
|
|
17
15
|
ForwardModelStepDocumentation,
|
|
18
16
|
ForwardModelStepPlugin,
|
|
19
17
|
KnownQueueOptions,
|
|
20
18
|
LegacyWorkflowConfigs,
|
|
21
19
|
LocalQueueOptions,
|
|
20
|
+
SiteInstalledForwardModelStep,
|
|
22
21
|
WorkflowConfigs,
|
|
23
22
|
WorkflowJob,
|
|
24
|
-
forward_model_step_from_config_contents,
|
|
25
23
|
workflow_job_from_file,
|
|
26
24
|
)
|
|
27
25
|
from ert.trace import add_span_processor
|
|
@@ -251,32 +249,9 @@ class ErtPluginManager(pluggy.PluginManager):
|
|
|
251
249
|
return merged_dict
|
|
252
250
|
return {k: v[0] for k, v in merged_dict.items()}
|
|
253
251
|
|
|
254
|
-
def get_installable_jobs(self) -> Mapping[str, str]:
|
|
255
|
-
return ErtPluginManager._merge_dicts(self.hook.installable_jobs())
|
|
256
|
-
|
|
257
252
|
def _get_config_workflow_jobs(self) -> dict[str, str]:
|
|
258
253
|
return ErtPluginManager._merge_dicts(self.hook.installable_workflow_jobs())
|
|
259
254
|
|
|
260
|
-
def get_documentation_for_jobs(self) -> dict[str, Any]:
|
|
261
|
-
job_docs = {
|
|
262
|
-
k: {
|
|
263
|
-
"config_file": v[0],
|
|
264
|
-
"source_package": v[1].plugin_name,
|
|
265
|
-
"source_function_name": v[1].function_name,
|
|
266
|
-
}
|
|
267
|
-
for k, v in ErtPluginManager._merge_dicts(
|
|
268
|
-
self.hook.installable_jobs(), include_plugin_data=True
|
|
269
|
-
).items()
|
|
270
|
-
}
|
|
271
|
-
for key, value in job_docs.items():
|
|
272
|
-
value.update(
|
|
273
|
-
ErtPluginManager._evaluate_job_doc_hook(
|
|
274
|
-
self.hook.job_documentation,
|
|
275
|
-
key,
|
|
276
|
-
)
|
|
277
|
-
)
|
|
278
|
-
return job_docs
|
|
279
|
-
|
|
280
255
|
def get_documentation_for_forward_model_steps(
|
|
281
256
|
self,
|
|
282
257
|
) -> dict[str, ForwardModelStepDocumentation]:
|
|
@@ -353,7 +328,7 @@ class ErtPluginManager(pluggy.PluginManager):
|
|
|
353
328
|
|
|
354
329
|
|
|
355
330
|
class ErtRuntimePlugins(BaseModel):
|
|
356
|
-
installed_forward_model_steps: Mapping[str,
|
|
331
|
+
installed_forward_model_steps: Mapping[str, SiteInstalledForwardModelStep] = Field(
|
|
357
332
|
default_factory=dict
|
|
358
333
|
)
|
|
359
334
|
installed_workflow_jobs: Mapping[str, WorkflowJob] = Field(default_factory=dict)
|
|
@@ -380,12 +355,6 @@ def get_site_plugins(
|
|
|
380
355
|
else {}
|
|
381
356
|
)
|
|
382
357
|
|
|
383
|
-
for job_name, job_path in plugin_manager.get_installable_jobs().items():
|
|
384
|
-
fm_step = forward_model_step_from_config_contents(
|
|
385
|
-
Path(job_path).read_text(encoding="utf-8"), job_path, job_name
|
|
386
|
-
)
|
|
387
|
-
all_forward_model_steps[job_name] = fm_step
|
|
388
|
-
|
|
389
358
|
all_workflow_jobs: dict[str, WorkflowJob] = dict[str, WorkflowJob](
|
|
390
359
|
plugin_manager.get_ertscript_workflows().get_workflows()
|
|
391
360
|
) | dict[str, WorkflowJob](
|
|
@@ -48,8 +48,8 @@ def delete_directory(path: str) -> None:
|
|
|
48
48
|
for file in files:
|
|
49
49
|
delete_file(os.path.join(root, file))
|
|
50
50
|
|
|
51
|
-
for
|
|
52
|
-
delete_empty_directory(os.path.join(root,
|
|
51
|
+
for dir_ in dirs:
|
|
52
|
+
delete_empty_directory(os.path.join(root, dir_))
|
|
53
53
|
|
|
54
54
|
else:
|
|
55
55
|
raise OSError(f"Entry:'{path}' is not a directory")
|
ert/run_models/__init__.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
from .ensemble_experiment import EnsembleExperiment
|
|
2
|
-
from .ensemble_information_filter import
|
|
3
|
-
|
|
1
|
+
from .ensemble_experiment import EnsembleExperiment, EnsembleExperimentConfig
|
|
2
|
+
from .ensemble_information_filter import (
|
|
3
|
+
EnsembleInformationFilter,
|
|
4
|
+
EnsembleInformationFilterConfig,
|
|
5
|
+
)
|
|
6
|
+
from .ensemble_smoother import EnsembleSmoother, EnsembleSmootherConfig
|
|
7
|
+
from .evaluate_ensemble import EvaluateEnsembleConfig
|
|
4
8
|
from .event import (
|
|
5
9
|
RunModelEvent,
|
|
6
10
|
RunModelStatusEvent,
|
|
@@ -9,21 +13,29 @@ from .event import (
|
|
|
9
13
|
RunModelUpdateEndEvent,
|
|
10
14
|
)
|
|
11
15
|
from .model_factory import create_model
|
|
12
|
-
from .multiple_data_assimilation import
|
|
16
|
+
from .multiple_data_assimilation import (
|
|
17
|
+
MultipleDataAssimilation,
|
|
18
|
+
MultipleDataAssimilationConfig,
|
|
19
|
+
)
|
|
13
20
|
from .run_model import (
|
|
14
21
|
ErtRunError,
|
|
15
22
|
RunModel,
|
|
16
23
|
RunModelAPI,
|
|
17
24
|
StatusEvents,
|
|
18
25
|
)
|
|
19
|
-
from .single_test_run import SingleTestRun
|
|
26
|
+
from .single_test_run import SingleTestRun, SingleTestRunConfig
|
|
20
27
|
|
|
21
28
|
__all__ = [
|
|
22
29
|
"EnsembleExperiment",
|
|
30
|
+
"EnsembleExperimentConfig",
|
|
23
31
|
"EnsembleInformationFilter",
|
|
32
|
+
"EnsembleInformationFilterConfig",
|
|
24
33
|
"EnsembleSmoother",
|
|
34
|
+
"EnsembleSmootherConfig",
|
|
25
35
|
"ErtRunError",
|
|
36
|
+
"EvaluateEnsembleConfig",
|
|
26
37
|
"MultipleDataAssimilation",
|
|
38
|
+
"MultipleDataAssimilationConfig",
|
|
27
39
|
"RunModel",
|
|
28
40
|
"RunModelAPI",
|
|
29
41
|
"RunModelEvent",
|
|
@@ -32,6 +44,7 @@ __all__ = [
|
|
|
32
44
|
"RunModelUpdateBeginEvent",
|
|
33
45
|
"RunModelUpdateEndEvent",
|
|
34
46
|
"SingleTestRun",
|
|
47
|
+
"SingleTestRunConfig",
|
|
35
48
|
"StatusEvents",
|
|
36
49
|
"create_model",
|
|
37
50
|
]
|
|
@@ -2,9 +2,11 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import logging
|
|
5
|
+
import math
|
|
5
6
|
import os
|
|
6
7
|
import time
|
|
7
8
|
from collections.abc import Iterable, Mapping
|
|
9
|
+
from copy import deepcopy
|
|
8
10
|
from datetime import UTC, datetime
|
|
9
11
|
from pathlib import Path
|
|
10
12
|
from typing import TYPE_CHECKING, Any
|
|
@@ -22,6 +24,7 @@ from ert.config import (
|
|
|
22
24
|
SurfaceConfig,
|
|
23
25
|
)
|
|
24
26
|
from ert.config.design_matrix import DESIGN_MATRIX_GROUP
|
|
27
|
+
from ert.config.distribution import LogNormalSettings, LogUnifSettings
|
|
25
28
|
from ert.config.ert_config import create_forward_model_json
|
|
26
29
|
from ert.substitutions import Substitutions, substitute_runpath_name
|
|
27
30
|
from ert.utils import log_duration
|
|
@@ -78,18 +81,18 @@ def _value_export_json(
|
|
|
78
81
|
if len(values) == 0:
|
|
79
82
|
return
|
|
80
83
|
|
|
81
|
-
#
|
|
82
|
-
json_out: dict[str,
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
# parameter file is {param: {"value": value}}
|
|
85
|
+
json_out: dict[str, dict[str, float | str]] = {}
|
|
86
|
+
for param_map in values.values():
|
|
87
|
+
for param, value in param_map.items():
|
|
88
|
+
json_out[param] = {"value": value}
|
|
85
89
|
|
|
86
90
|
# Disallow NaN from being written: ERT produces the parameters and the only
|
|
87
91
|
# way for the output to be NaN is if the input is invalid or if the sampling
|
|
88
92
|
# function is buggy. Either way, that would be a bug and we can report it by
|
|
89
93
|
# having json throw an error.
|
|
90
|
-
|
|
91
|
-
json_out,
|
|
92
|
-
)
|
|
94
|
+
with path.open("w") as f:
|
|
95
|
+
json.dump(json_out, f, allow_nan=False, indent=0, separators=(", ", " : "))
|
|
93
96
|
|
|
94
97
|
|
|
95
98
|
def _generate_parameter_files(
|
|
@@ -128,6 +131,7 @@ def _generate_parameter_files(
|
|
|
128
131
|
df = fs._load_scalar_keys(keys=keys, realizations=iens, transformed=True)
|
|
129
132
|
scalar_data = df.to_dicts()[0]
|
|
130
133
|
exports: dict[str, dict[str, float | str]] = {}
|
|
134
|
+
log_exports: dict[str, dict[str, float | str]] = {}
|
|
131
135
|
for param in parameter_configs:
|
|
132
136
|
# For the first iteration we do not write the parameter
|
|
133
137
|
# to run path, as we expect to read if after the forward
|
|
@@ -135,16 +139,34 @@ def _generate_parameter_files(
|
|
|
135
139
|
if param.forward_init and iteration == 0:
|
|
136
140
|
continue
|
|
137
141
|
export_values: dict[str, dict[str, float | str]] | None = None
|
|
142
|
+
log_export_values: dict[str, dict[str, float | str]] | None = {}
|
|
138
143
|
if param.name in scalar_data:
|
|
139
|
-
|
|
144
|
+
scalar_value = scalar_data[param.name]
|
|
145
|
+
export_values = {param.group_name: {param.name: scalar_value}}
|
|
146
|
+
if isinstance(param, GenKwConfig) and isinstance(
|
|
147
|
+
param.distribution, (LogNormalSettings, LogUnifSettings)
|
|
148
|
+
):
|
|
149
|
+
if isinstance(scalar_value, float) and scalar_value > 0:
|
|
150
|
+
log_value = math.log10(scalar_value)
|
|
151
|
+
log_export_values = {
|
|
152
|
+
f"LOG10_{param.group_name}": {param.name: log_value}
|
|
153
|
+
}
|
|
154
|
+
else:
|
|
155
|
+
logger.warning(
|
|
156
|
+
"Could not export the log10 value of "
|
|
157
|
+
f"{scalar_value} as it is invalid"
|
|
158
|
+
)
|
|
140
159
|
else:
|
|
141
160
|
export_values = param.write_to_runpath(Path(run_path), iens, fs)
|
|
142
161
|
if export_values:
|
|
143
162
|
for group, vals in export_values.items():
|
|
144
163
|
exports.setdefault(group, {}).update(vals)
|
|
164
|
+
if log_export_values:
|
|
165
|
+
for group, vals in log_export_values.items():
|
|
166
|
+
log_exports.setdefault(group, {}).update(vals)
|
|
145
167
|
continue
|
|
146
168
|
|
|
147
|
-
_value_export_txt(run_path, export_base_name, exports)
|
|
169
|
+
_value_export_txt(run_path, export_base_name, exports | log_exports)
|
|
148
170
|
_value_export_json(run_path, export_base_name, exports)
|
|
149
171
|
return exports
|
|
150
172
|
|
|
@@ -167,13 +189,28 @@ def _manifest_to_json(ensemble: Ensemble, iens: int, iter_: int) -> dict[str, An
|
|
|
167
189
|
# Add expected response files to manifest
|
|
168
190
|
for response_config in ensemble.experiment.response_configuration.values():
|
|
169
191
|
for input_file in response_config.expected_input_files:
|
|
170
|
-
manifest[f"{response_config.
|
|
171
|
-
|
|
192
|
+
manifest[f"{response_config.type}_{input_file}"] = substitute_runpath_name(
|
|
193
|
+
input_file, iens, iter_
|
|
172
194
|
)
|
|
173
195
|
|
|
174
196
|
return manifest
|
|
175
197
|
|
|
176
198
|
|
|
199
|
+
def _make_param_substituter(
|
|
200
|
+
substituter: Substitutions,
|
|
201
|
+
param_data: Mapping[str, Mapping[str, str | float]],
|
|
202
|
+
) -> Substitutions:
|
|
203
|
+
param_substituter = deepcopy(substituter)
|
|
204
|
+
for values in param_data.values():
|
|
205
|
+
for param_name, value in values.items():
|
|
206
|
+
if isinstance(value, (int, float)):
|
|
207
|
+
formatted_value = f"{value:.6g}"
|
|
208
|
+
else:
|
|
209
|
+
formatted_value = str(value)
|
|
210
|
+
param_substituter[f"<{param_name}>"] = formatted_value
|
|
211
|
+
return param_substituter
|
|
212
|
+
|
|
213
|
+
|
|
177
214
|
@log_duration(logger, logging.INFO)
|
|
178
215
|
def create_run_path(
|
|
179
216
|
run_args: list[RunArg],
|
|
@@ -211,25 +248,21 @@ def create_run_path(
|
|
|
211
248
|
ensemble.iteration,
|
|
212
249
|
)
|
|
213
250
|
timings["generate_parameter_files"] += time.perf_counter() - start_time
|
|
251
|
+
real_iter_substituter = substituter.real_iter_substituter(
|
|
252
|
+
run_arg.iens, ensemble.iteration
|
|
253
|
+
)
|
|
254
|
+
param_substituter = _make_param_substituter(
|
|
255
|
+
real_iter_substituter, param_data
|
|
256
|
+
)
|
|
214
257
|
for (
|
|
215
258
|
source_file_content,
|
|
216
259
|
target_file,
|
|
217
260
|
) in ensemble.experiment.templates_configuration:
|
|
218
261
|
start_time = time.perf_counter()
|
|
219
|
-
target_file =
|
|
220
|
-
target_file, run_arg.iens, ensemble.iteration
|
|
221
|
-
)
|
|
222
|
-
result = substituter.substitute_real_iter(
|
|
223
|
-
source_file_content,
|
|
224
|
-
run_arg.iens,
|
|
225
|
-
ensemble.iteration,
|
|
226
|
-
)
|
|
262
|
+
target_file = real_iter_substituter.substitute(target_file)
|
|
227
263
|
timings["substitute_real_iter"] += time.perf_counter() - start_time
|
|
228
264
|
start_time = time.perf_counter()
|
|
229
|
-
result =
|
|
230
|
-
result,
|
|
231
|
-
param_data,
|
|
232
|
-
)
|
|
265
|
+
result = param_substituter.substitute(source_file_content)
|
|
233
266
|
timings["substitute_parameters"] += time.perf_counter() - start_time
|
|
234
267
|
start_time = time.perf_counter()
|
|
235
268
|
target = run_path / target_file
|
|
@@ -13,14 +13,22 @@ from ert.config import (
|
|
|
13
13
|
ResponseConfig,
|
|
14
14
|
)
|
|
15
15
|
from ert.ensemble_evaluator import EvaluatorServerConfig
|
|
16
|
-
from ert.run_models.initial_ensemble_run_model import
|
|
16
|
+
from ert.run_models.initial_ensemble_run_model import (
|
|
17
|
+
InitialEnsembleRunModel,
|
|
18
|
+
InitialEnsembleRunModelConfig,
|
|
19
|
+
)
|
|
17
20
|
from ert.storage import Ensemble
|
|
18
21
|
from ert.trace import tracer
|
|
19
22
|
|
|
20
23
|
logger = logging.getLogger(__name__)
|
|
21
24
|
|
|
22
25
|
|
|
23
|
-
class
|
|
26
|
+
class EnsembleExperimentConfig(InitialEnsembleRunModelConfig):
|
|
27
|
+
target_ensemble: str
|
|
28
|
+
supports_rerunning_failed_realizations: ClassVar[bool] = True
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class EnsembleExperiment(InitialEnsembleRunModel, EnsembleExperimentConfig):
|
|
24
32
|
"""
|
|
25
33
|
This workflow will create a new experiment and a new ensemble from
|
|
26
34
|
the user configuration.<br>It will never overwrite existing ensembles, and
|
|
@@ -28,8 +36,6 @@ class EnsembleExperiment(InitialEnsembleRunModel):
|
|
|
28
36
|
"""
|
|
29
37
|
|
|
30
38
|
_ensemble_id: UUID | None = PrivateAttr(None)
|
|
31
|
-
supports_rerunning_failed_realizations: ClassVar[bool] = True
|
|
32
|
-
target_ensemble: str
|
|
33
39
|
|
|
34
40
|
@property
|
|
35
41
|
def _ensemble(self) -> Ensemble:
|
|
@@ -7,11 +7,18 @@ from ert.run_models.ensemble_smoother import EnsembleSmoother
|
|
|
7
7
|
from ert.storage import Ensemble
|
|
8
8
|
|
|
9
9
|
from ..analysis import enif_update
|
|
10
|
+
from .initial_ensemble_run_model import InitialEnsembleRunModelConfig
|
|
11
|
+
from .update_run_model import UpdateRunModelConfig
|
|
10
12
|
|
|
11
13
|
logger = logging.getLogger(__name__)
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
class
|
|
16
|
+
class EnsembleInformationFilterConfig(
|
|
17
|
+
InitialEnsembleRunModelConfig, UpdateRunModelConfig
|
|
18
|
+
): ...
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class EnsembleInformationFilter(EnsembleSmoother, EnsembleInformationFilterConfig):
|
|
15
22
|
def update_ensemble_parameters(
|
|
16
23
|
self, prior: Ensemble, posterior: Ensemble, weight: float
|
|
17
24
|
) -> None:
|
|
@@ -14,8 +14,11 @@ from ert.config import (
|
|
|
14
14
|
ResponseConfig,
|
|
15
15
|
)
|
|
16
16
|
from ert.ensemble_evaluator import EvaluatorServerConfig
|
|
17
|
-
from ert.run_models.initial_ensemble_run_model import
|
|
18
|
-
|
|
17
|
+
from ert.run_models.initial_ensemble_run_model import (
|
|
18
|
+
InitialEnsembleRunModel,
|
|
19
|
+
InitialEnsembleRunModelConfig,
|
|
20
|
+
)
|
|
21
|
+
from ert.run_models.update_run_model import UpdateRunModel, UpdateRunModelConfig
|
|
19
22
|
from ert.storage import Ensemble
|
|
20
23
|
from ert.trace import tracer
|
|
21
24
|
|
|
@@ -26,7 +29,10 @@ from .run_model import ErtRunError
|
|
|
26
29
|
logger = logging.getLogger(__name__)
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
class
|
|
32
|
+
class EnsembleSmootherConfig(InitialEnsembleRunModelConfig, UpdateRunModelConfig): ...
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class EnsembleSmoother(InitialEnsembleRunModel, UpdateRunModel, EnsembleSmootherConfig):
|
|
30
36
|
_total_iterations: int = PrivateAttr(default=2)
|
|
31
37
|
|
|
32
38
|
@tracer.start_as_current_span(f"{__name__}.run_experiment")
|
|
@@ -10,12 +10,17 @@ from ert.ensemble_evaluator import EvaluatorServerConfig
|
|
|
10
10
|
from ert.trace import tracer
|
|
11
11
|
|
|
12
12
|
from ..run_arg import create_run_arguments
|
|
13
|
-
from .run_model import RunModel
|
|
13
|
+
from .run_model import RunModel, RunModelConfig
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class EvaluateEnsembleConfig(RunModelConfig):
|
|
19
|
+
ensemble_id: str
|
|
20
|
+
supports_rerunning_failed_realizations: ClassVar[bool] = True
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class EvaluateEnsemble(RunModel, EvaluateEnsembleConfig):
|
|
19
24
|
"""
|
|
20
25
|
This workflow will evaluate ensembles which have parameters, but no simulation
|
|
21
26
|
has been performed, so there are no responses. This can be used in instances
|
|
@@ -24,14 +29,11 @@ class EvaluateEnsemble(RunModel):
|
|
|
24
29
|
ensemble, and will not reflect any changes to the user configuration on disk.
|
|
25
30
|
"""
|
|
26
31
|
|
|
27
|
-
ensemble_id: str
|
|
28
|
-
supports_rerunning_failed_realizations: ClassVar[bool] = True
|
|
29
|
-
|
|
30
32
|
def model_post_init(self, ctx: Any) -> None:
|
|
31
33
|
super().model_post_init(ctx)
|
|
32
34
|
try:
|
|
33
35
|
ensemble = self._storage.get_ensemble(UUID(self.ensemble_id))
|
|
34
|
-
self.
|
|
36
|
+
self._start_iteration = ensemble.iteration
|
|
35
37
|
except KeyError as err:
|
|
36
38
|
raise ValueError(f"No ensemble: {self.ensemble_id}") from err
|
|
37
39
|
|
ert/run_models/event.py
CHANGED
|
@@ -6,6 +6,7 @@ from uuid import UUID
|
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, ConfigDict, Field, TypeAdapter
|
|
8
8
|
|
|
9
|
+
from _ert.events import EnsembleEvaluationWarning
|
|
9
10
|
from ert.analysis import (
|
|
10
11
|
AnalysisStatusEvent,
|
|
11
12
|
AnalysisTimeEvent,
|
|
@@ -15,6 +16,7 @@ from ert.ensemble_evaluator.event import (
|
|
|
15
16
|
EndEvent,
|
|
16
17
|
FullSnapshotEvent,
|
|
17
18
|
SnapshotUpdateEvent,
|
|
19
|
+
StartEvent,
|
|
18
20
|
WarningEvent,
|
|
19
21
|
)
|
|
20
22
|
|
|
@@ -90,17 +92,19 @@ StatusEvents = (
|
|
|
90
92
|
AnalysisStatusEvent
|
|
91
93
|
| AnalysisTimeEvent
|
|
92
94
|
| EndEvent
|
|
93
|
-
| EverestStatusEvent
|
|
94
95
|
| EverestBatchResultEvent
|
|
96
|
+
| EverestStatusEvent
|
|
95
97
|
| FullSnapshotEvent
|
|
96
|
-
|
|
|
98
|
+
| RunModelDataEvent
|
|
97
99
|
| RunModelErrorEvent
|
|
98
100
|
| RunModelStatusEvent
|
|
99
101
|
| RunModelTimeEvent
|
|
100
102
|
| RunModelUpdateBeginEvent
|
|
101
|
-
| RunModelDataEvent
|
|
102
103
|
| RunModelUpdateEndEvent
|
|
104
|
+
| SnapshotUpdateEvent
|
|
105
|
+
| StartEvent
|
|
103
106
|
| WarningEvent
|
|
107
|
+
| EnsembleEvaluationWarning
|
|
104
108
|
)
|
|
105
109
|
|
|
106
110
|
|