ert 17.0.0__py3-none-any.whl → 17.1.1__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/config/design_matrix.py +43 -23
- ert/config/ert_config.py +25 -6
- ert/config/field.py +11 -65
- ert/config/gen_kw_config.py +1 -12
- ert/field_utils/field_utils.py +1 -2
- ert/run_models/_create_run_path.py +23 -3
- ert/run_models/multiple_data_assimilation.py +1 -1
- ert/shared/version.py +3 -3
- ert/storage/local_storage.py +3 -1
- ert/storage/migration/to16.py +38 -0
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/METADATA +1 -1
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/RECORD +17 -16
- everest/bin/visualization_script.py +3 -4
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/WHEEL +0 -0
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/entry_points.txt +0 -0
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/licenses/COPYING +0 -0
- {ert-17.0.0.dist-info → ert-17.1.1.dist-info}/top_level.txt +0 -0
ert/config/design_matrix.py
CHANGED
|
@@ -25,6 +25,7 @@ class DesignMatrix:
|
|
|
25
25
|
xls_filename: Path
|
|
26
26
|
design_sheet: str
|
|
27
27
|
default_sheet: str | None
|
|
28
|
+
priority_source: str = "design_matrix"
|
|
28
29
|
|
|
29
30
|
def __post_init__(self) -> None:
|
|
30
31
|
try:
|
|
@@ -33,6 +34,9 @@ class DesignMatrix:
|
|
|
33
34
|
self.design_matrix_df,
|
|
34
35
|
self.parameter_configurations,
|
|
35
36
|
) = self.read_and_validate_design_matrix()
|
|
37
|
+
self.parameter_priority = {
|
|
38
|
+
cfg.name: self.priority_source for cfg in self.parameter_configurations
|
|
39
|
+
}
|
|
36
40
|
except (ValueError, AttributeError) as exc:
|
|
37
41
|
raise ConfigValidationError.with_context(
|
|
38
42
|
f"Error reading design matrix {self.xls_filename}"
|
|
@@ -45,7 +49,7 @@ class DesignMatrix:
|
|
|
45
49
|
def from_config_list(cls, config_list: list[str | dict[str, str]]) -> DesignMatrix:
|
|
46
50
|
filename = Path(cast(str, config_list[0]))
|
|
47
51
|
options = cast(dict[str, str], config_list[1])
|
|
48
|
-
valid_options = ["DESIGN_SHEET", "DEFAULT_SHEET"]
|
|
52
|
+
valid_options = ["DESIGN_SHEET", "DEFAULT_SHEET", "PRIORITY"]
|
|
49
53
|
option_errors = [
|
|
50
54
|
ErrorInfo(
|
|
51
55
|
f"Option {option} is not a valid DESIGN_MATRIX option. "
|
|
@@ -59,6 +63,7 @@ class DesignMatrix:
|
|
|
59
63
|
raise ConfigValidationError.from_collected(option_errors)
|
|
60
64
|
design_sheet = options.get("DESIGN_SHEET", "DesignSheet")
|
|
61
65
|
default_sheet = options.get("DEFAULT_SHEET", None)
|
|
66
|
+
priority_source = options.get("PRIORITY", DataSource.DESIGN_MATRIX)
|
|
62
67
|
errors = []
|
|
63
68
|
if filename.suffix not in {
|
|
64
69
|
".xlsx",
|
|
@@ -75,6 +80,13 @@ class DesignMatrix:
|
|
|
75
80
|
"DESIGN_SHEET and DEFAULT_SHEET can not point to the same sheet."
|
|
76
81
|
).set_context(config_list)
|
|
77
82
|
)
|
|
83
|
+
if priority_source not in {DataSource.DESIGN_MATRIX, DataSource.SAMPLED}:
|
|
84
|
+
errors.append(
|
|
85
|
+
ErrorInfo(
|
|
86
|
+
f"PRIORITY must be either '{DataSource.DESIGN_MATRIX}'"
|
|
87
|
+
f" or '{DataSource.SAMPLED}' priority is '{priority_source}'"
|
|
88
|
+
).set_context(config_list)
|
|
89
|
+
)
|
|
78
90
|
if errors:
|
|
79
91
|
raise ConfigValidationError.from_collected(errors)
|
|
80
92
|
assert design_sheet is not None
|
|
@@ -82,6 +94,7 @@ class DesignMatrix:
|
|
|
82
94
|
xls_filename=filename,
|
|
83
95
|
design_sheet=design_sheet,
|
|
84
96
|
default_sheet=default_sheet,
|
|
97
|
+
priority_source=priority_source,
|
|
85
98
|
)
|
|
86
99
|
|
|
87
100
|
def merge_with_other(self, dm_other: DesignMatrix) -> None:
|
|
@@ -99,24 +112,17 @@ class DesignMatrix:
|
|
|
99
112
|
common_keys = set(
|
|
100
113
|
self.design_matrix_df.select(pl.exclude("realization")).columns
|
|
101
114
|
) & set(dm_other.design_matrix_df.columns)
|
|
102
|
-
non_identical_cols = set()
|
|
103
115
|
if common_keys:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
f"Design Matrices '{self.xls_filename.name} "
|
|
113
|
-
f"({self.design_sheet} {self.default_sheet or ''})' and "
|
|
114
|
-
f"'{dm_other.xls_filename.name} ({dm_other.design_sheet} "
|
|
115
|
-
f"{dm_other.default_sheet or ''})' "
|
|
116
|
-
"contains non identical columns with the same name: "
|
|
117
|
-
f"{non_identical_cols}!"
|
|
118
|
-
)
|
|
116
|
+
errors.append(
|
|
117
|
+
ErrorInfo(
|
|
118
|
+
f"Design Matrices '{self.xls_filename.name} "
|
|
119
|
+
f"({self.design_sheet} {self.default_sheet or ''})' and "
|
|
120
|
+
f"'{dm_other.xls_filename.name} ({dm_other.design_sheet} "
|
|
121
|
+
f"{dm_other.default_sheet or ''})' "
|
|
122
|
+
"contains columns with the same name: "
|
|
123
|
+
f"{common_keys}!"
|
|
119
124
|
)
|
|
125
|
+
)
|
|
120
126
|
|
|
121
127
|
if errors:
|
|
122
128
|
raise ConfigValidationError.from_collected(errors)
|
|
@@ -125,9 +131,7 @@ class DesignMatrix:
|
|
|
125
131
|
self.design_matrix_df = pl.concat(
|
|
126
132
|
[
|
|
127
133
|
self.design_matrix_df,
|
|
128
|
-
dm_other.design_matrix_df.select(
|
|
129
|
-
pl.exclude([*list(common_keys), "realization"])
|
|
130
|
-
),
|
|
134
|
+
dm_other.design_matrix_df.select(pl.exclude(["realization"])),
|
|
131
135
|
],
|
|
132
136
|
how="horizontal",
|
|
133
137
|
)
|
|
@@ -145,6 +149,7 @@ class DesignMatrix:
|
|
|
145
149
|
for cfg in dm_other.parameter_configurations
|
|
146
150
|
if cfg.name not in common_keys
|
|
147
151
|
)
|
|
152
|
+
self.parameter_priority.update(dm_other.parameter_priority)
|
|
148
153
|
|
|
149
154
|
def merge_with_existing_parameters(
|
|
150
155
|
self, existing_parameters: list[ParameterConfig]
|
|
@@ -166,9 +171,24 @@ class DesignMatrix:
|
|
|
166
171
|
|
|
167
172
|
for param_cfg in existing_parameters:
|
|
168
173
|
if isinstance(param_cfg, GenKwConfig) and param_cfg.name in design_cfgs:
|
|
169
|
-
param_cfg.input_source = DataSource
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
param_cfg.input_source = DataSource(
|
|
175
|
+
self.parameter_priority.get(
|
|
176
|
+
param_cfg.name, DataSource.DESIGN_MATRIX.value
|
|
177
|
+
)
|
|
178
|
+
)
|
|
179
|
+
param_cfg.update = (
|
|
180
|
+
param_cfg.input_source == DataSource.SAMPLED and param_cfg.update
|
|
181
|
+
)
|
|
182
|
+
param_cfg.distribution = (
|
|
183
|
+
RawSettings()
|
|
184
|
+
if param_cfg.input_source == DataSource.DESIGN_MATRIX
|
|
185
|
+
else param_cfg.distribution
|
|
186
|
+
)
|
|
187
|
+
param_cfg.group = (
|
|
188
|
+
DataSource.DESIGN_MATRIX.value.upper()
|
|
189
|
+
if param_cfg.input_source == DataSource.DESIGN_MATRIX
|
|
190
|
+
else param_cfg.group
|
|
191
|
+
)
|
|
172
192
|
del design_cfgs[param_cfg.name]
|
|
173
193
|
new_param_configs += [param_cfg]
|
|
174
194
|
if design_cfgs.values():
|
ert/config/ert_config.py
CHANGED
|
@@ -38,7 +38,7 @@ from .forward_model_step import (
|
|
|
38
38
|
ForwardModelStepWarning,
|
|
39
39
|
)
|
|
40
40
|
from .gen_data_config import GenDataConfig
|
|
41
|
-
from .gen_kw_config import GenKwConfig
|
|
41
|
+
from .gen_kw_config import DataSource, GenKwConfig
|
|
42
42
|
from .model_config import ModelConfig
|
|
43
43
|
from .parse_arg_types_list import parse_arg_types_list
|
|
44
44
|
from .parsing import (
|
|
@@ -1025,11 +1025,30 @@ class ErtConfig(BaseModel):
|
|
|
1025
1025
|
if isinstance(cfg, GenKwConfig) and cfg.name in dm_params
|
|
1026
1026
|
]
|
|
1027
1027
|
if overwrite_params:
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1028
|
+
param_sampled = [
|
|
1029
|
+
k
|
|
1030
|
+
for k in overwrite_params
|
|
1031
|
+
if analysis_config.design_matrix.parameter_priority[k]
|
|
1032
|
+
== DataSource.SAMPLED
|
|
1033
|
+
]
|
|
1034
|
+
param_design = [
|
|
1035
|
+
k
|
|
1036
|
+
for k in overwrite_params
|
|
1037
|
+
if analysis_config.design_matrix.parameter_priority[k]
|
|
1038
|
+
== DataSource.DESIGN_MATRIX
|
|
1039
|
+
]
|
|
1040
|
+
if param_sampled:
|
|
1041
|
+
ConfigWarning.warn(
|
|
1042
|
+
f"Parameters {param_sampled} "
|
|
1043
|
+
"are also defined in design matrix, but due to the sampled"
|
|
1044
|
+
" priority they will remain as such."
|
|
1045
|
+
)
|
|
1046
|
+
if param_design:
|
|
1047
|
+
ConfigWarning.warn(
|
|
1048
|
+
f"Parameters {param_design} "
|
|
1049
|
+
"will be overridden by design matrix. This will cause "
|
|
1050
|
+
"updates to be turned off for these parameters."
|
|
1051
|
+
)
|
|
1033
1052
|
|
|
1034
1053
|
if dm_errors:
|
|
1035
1054
|
raise ConfigValidationError.from_collected(dm_errors)
|
ert/config/field.py
CHANGED
|
@@ -4,7 +4,6 @@ import itertools
|
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
6
|
from collections.abc import Iterator
|
|
7
|
-
from functools import cached_property
|
|
8
7
|
from pathlib import Path
|
|
9
8
|
from typing import TYPE_CHECKING, Any, Literal, Self, cast, overload
|
|
10
9
|
|
|
@@ -21,7 +20,6 @@ from ert.field_utils import (
|
|
|
21
20
|
calculate_ertbox_parameters,
|
|
22
21
|
get_shape,
|
|
23
22
|
read_field,
|
|
24
|
-
read_mask,
|
|
25
23
|
save_field,
|
|
26
24
|
)
|
|
27
25
|
from ert.substitutions import substitute_runpath_name
|
|
@@ -67,30 +65,6 @@ def create_flattened_cube_graph(px: int, py: int, pz: int) -> nx.Graph[int]:
|
|
|
67
65
|
return G
|
|
68
66
|
|
|
69
67
|
|
|
70
|
-
def adjust_graph_for_masking(
|
|
71
|
-
G: nx.Graph[int], mask: npt.NDArray[np.bool_]
|
|
72
|
-
) -> nx.Graph[int]:
|
|
73
|
-
"""
|
|
74
|
-
Adjust the graph G according to the masking indices.
|
|
75
|
-
Removes nodes specified by the mask and relabels the remaining nodes
|
|
76
|
-
to have consecutive labels from 0 to G.number_of_nodes - 1.
|
|
77
|
-
Parameters:
|
|
78
|
-
- G: The graph to adjust
|
|
79
|
-
- mask: Boolean mask flattened array
|
|
80
|
-
Returns:
|
|
81
|
-
- The adjusted graph
|
|
82
|
-
"""
|
|
83
|
-
# Step 1: Remove nodes specified by mask_indices
|
|
84
|
-
mask_indices = np.where(mask)[0]
|
|
85
|
-
G.remove_nodes_from(mask_indices)
|
|
86
|
-
|
|
87
|
-
# Step 2: Relabel remaining nodes to 0, 1, 2, ..., G.number_of_nodes - 1
|
|
88
|
-
new_labels = {old_label: new_label for new_label, old_label in enumerate(G.nodes())}
|
|
89
|
-
G = nx.relabel_nodes(G, new_labels, copy=True)
|
|
90
|
-
|
|
91
|
-
return G
|
|
92
|
-
|
|
93
|
-
|
|
94
68
|
class Field(ParameterConfig):
|
|
95
69
|
type: Literal["field"] = "field"
|
|
96
70
|
ertbox_params: ErtboxParameters
|
|
@@ -102,16 +76,11 @@ class Field(ParameterConfig):
|
|
|
102
76
|
forward_init_file: str
|
|
103
77
|
output_file: Path
|
|
104
78
|
grid_file: str
|
|
105
|
-
mask_file: Path | None = None
|
|
106
79
|
|
|
107
80
|
@field_serializer("output_file")
|
|
108
81
|
def serialize_output_file(self, path: Path) -> str:
|
|
109
82
|
return str(path)
|
|
110
83
|
|
|
111
|
-
@field_serializer("mask_file")
|
|
112
|
-
def serialize_mask_file(self, path: Path | None) -> str | None:
|
|
113
|
-
return str(path) if path is not None else None
|
|
114
|
-
|
|
115
84
|
@property
|
|
116
85
|
def parameter_keys(self) -> list[str]:
|
|
117
86
|
return []
|
|
@@ -239,11 +208,7 @@ class Field(ParameterConfig):
|
|
|
239
208
|
)
|
|
240
209
|
|
|
241
210
|
def __len__(self) -> int:
|
|
242
|
-
|
|
243
|
-
return self.ertbox_params.nx * self.ertbox_params.ny * self.ertbox_params.nz
|
|
244
|
-
|
|
245
|
-
# Uses int() to convert to standard python int for mypy
|
|
246
|
-
return int(np.size(self.mask) - np.count_nonzero(self.mask))
|
|
211
|
+
return self.ertbox_params.nx * self.ertbox_params.ny * self.ertbox_params.nz
|
|
247
212
|
|
|
248
213
|
@log_duration(_logger, custom_name="load_field")
|
|
249
214
|
def read_from_runpath(
|
|
@@ -258,7 +223,6 @@ class Field(ParameterConfig):
|
|
|
258
223
|
read_field(
|
|
259
224
|
run_path / file_name,
|
|
260
225
|
self.name,
|
|
261
|
-
self.mask,
|
|
262
226
|
Shape(
|
|
263
227
|
self.ertbox_params.nx,
|
|
264
228
|
self.ertbox_params.ny,
|
|
@@ -294,16 +258,11 @@ class Field(ParameterConfig):
|
|
|
294
258
|
from_data: npt.NDArray[np.float64],
|
|
295
259
|
iens_active_index: npt.NDArray[np.int_],
|
|
296
260
|
) -> Iterator[tuple[int, xr.Dataset]]:
|
|
261
|
+
nx, ny, nz = self.ertbox_params.nx, self.ertbox_params.ny, self.ertbox_params.nz
|
|
262
|
+
|
|
297
263
|
for i, realization in enumerate(iens_active_index):
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
mask=self.mask,
|
|
301
|
-
fill_value=np.nan,
|
|
302
|
-
dtype=from_data.dtype,
|
|
303
|
-
)
|
|
304
|
-
ma[~ma.mask] = from_data[:, i]
|
|
305
|
-
ma = ma.reshape(self.mask.shape) # type: ignore
|
|
306
|
-
ds = xr.Dataset({"values": (["x", "y", "z"], ma.filled())})
|
|
264
|
+
values = from_data[:, i].reshape((nx, ny, nz))
|
|
265
|
+
ds = xr.Dataset({"values": (["x", "y", "z"], values)})
|
|
307
266
|
yield int(realization), ds
|
|
308
267
|
|
|
309
268
|
def load_parameters(
|
|
@@ -314,7 +273,7 @@ class Field(ParameterConfig):
|
|
|
314
273
|
ensemble_size = len(ds.realizations)
|
|
315
274
|
da = xr.DataArray(
|
|
316
275
|
[
|
|
317
|
-
np.ma.MaskedArray(data=d
|
|
276
|
+
np.ma.MaskedArray(data=d).compressed() # type: ignore
|
|
318
277
|
for d in ds["values"].values.reshape(ensemble_size, -1)
|
|
319
278
|
]
|
|
320
279
|
)
|
|
@@ -337,31 +296,18 @@ class Field(ParameterConfig):
|
|
|
337
296
|
self.truncation_min,
|
|
338
297
|
self.truncation_max,
|
|
339
298
|
),
|
|
340
|
-
self.mask,
|
|
341
299
|
fill_value=np.nan,
|
|
342
300
|
)
|
|
343
301
|
|
|
344
|
-
def save_experiment_data(self, experiment_path: Path) -> None:
|
|
345
|
-
mask_path = experiment_path / "grid_mask.npy"
|
|
346
|
-
if not mask_path.exists():
|
|
347
|
-
mask, _ = read_mask(self.grid_file)
|
|
348
|
-
np.save(mask_path, mask)
|
|
349
|
-
self.mask_file = mask_path
|
|
350
|
-
|
|
351
|
-
@cached_property
|
|
352
|
-
def mask(self) -> Any:
|
|
353
|
-
if self.mask_file is None:
|
|
354
|
-
raise ValueError(
|
|
355
|
-
"In order to get Field.mask, Field.save_experiment_data has"
|
|
356
|
-
" to be called first"
|
|
357
|
-
)
|
|
358
|
-
return np.load(self.mask_file)
|
|
359
|
-
|
|
360
302
|
def load_parameter_graph(self) -> nx.Graph: # type: ignore
|
|
361
303
|
parameter_graph = create_flattened_cube_graph(
|
|
362
304
|
px=self.ertbox_params.nx, py=self.ertbox_params.ny, pz=self.ertbox_params.nz
|
|
363
305
|
)
|
|
364
|
-
|
|
306
|
+
new_labels = {
|
|
307
|
+
old_label: new_label
|
|
308
|
+
for new_label, old_label in enumerate(parameter_graph.nodes())
|
|
309
|
+
}
|
|
310
|
+
return nx.relabel_nodes(parameter_graph, new_labels, copy=True)
|
|
365
311
|
|
|
366
312
|
@property
|
|
367
313
|
def nx(self) -> int:
|
ert/config/gen_kw_config.py
CHANGED
|
@@ -217,18 +217,7 @@ class GenKwConfig(ParameterConfig):
|
|
|
217
217
|
real_nr: int,
|
|
218
218
|
ensemble: Ensemble,
|
|
219
219
|
) -> dict[str, dict[str, float | str]]:
|
|
220
|
-
|
|
221
|
-
"realization"
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
assert isinstance(df, pl.DataFrame)
|
|
225
|
-
if not df.width == 1:
|
|
226
|
-
raise ValueError(
|
|
227
|
-
f"GEN_KW {self.group_name}:{self.name} should be a single parameter!"
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
data = df.to_dicts()[0]
|
|
231
|
-
return {self.group_name: data}
|
|
220
|
+
raise NotImplementedError
|
|
232
221
|
|
|
233
222
|
def load_parameters(
|
|
234
223
|
self, ensemble: Ensemble, realizations: npt.NDArray[np.int_]
|
ert/field_utils/field_utils.py
CHANGED
|
@@ -216,7 +216,6 @@ def calculate_ertbox_parameters(
|
|
|
216
216
|
def read_field(
|
|
217
217
|
field_path: _PathLike,
|
|
218
218
|
field_name: str,
|
|
219
|
-
mask: npt.NDArray[np.bool_],
|
|
220
219
|
shape: Shape,
|
|
221
220
|
) -> np.ma.MaskedArray[Any, np.dtype[np.float32]]:
|
|
222
221
|
path = Path(field_path)
|
|
@@ -239,7 +238,7 @@ def read_field(
|
|
|
239
238
|
ext = path.suffix
|
|
240
239
|
raise ValueError(f'Could not read {field_path}. Unrecognized suffix "{ext}"')
|
|
241
240
|
|
|
242
|
-
return np.ma.MaskedArray(data=values,
|
|
241
|
+
return np.ma.MaskedArray(data=values, fill_value=np.nan) # type: ignore
|
|
243
242
|
|
|
244
243
|
|
|
245
244
|
def save_field(
|
|
@@ -16,9 +16,11 @@ from ert.config import (
|
|
|
16
16
|
Field,
|
|
17
17
|
ForwardModelStep,
|
|
18
18
|
GenKwConfig,
|
|
19
|
+
ParameterCardinality,
|
|
19
20
|
ParameterConfig,
|
|
20
21
|
SurfaceConfig,
|
|
21
22
|
)
|
|
23
|
+
from ert.config.design_matrix import DESIGN_MATRIX_GROUP
|
|
22
24
|
from ert.config.ert_config import create_forward_model_json
|
|
23
25
|
from ert.substitutions import Substitutions, substitute_runpath_name
|
|
24
26
|
from ert.utils import log_duration
|
|
@@ -54,7 +56,12 @@ def _value_export_txt(
|
|
|
54
56
|
for key, param_map in values.items():
|
|
55
57
|
for param, value in param_map.items():
|
|
56
58
|
if isinstance(value, (int | float)):
|
|
57
|
-
|
|
59
|
+
if key == DESIGN_MATRIX_GROUP:
|
|
60
|
+
print(f"{param} {value:g}", file=f)
|
|
61
|
+
else:
|
|
62
|
+
print(f"{key}:{param} {value:g}", file=f)
|
|
63
|
+
elif key == DESIGN_MATRIX_GROUP:
|
|
64
|
+
print(f"{param} {value}", file=f)
|
|
58
65
|
else:
|
|
59
66
|
print(f"{key}:{param} {value}", file=f)
|
|
60
67
|
|
|
@@ -109,15 +116,28 @@ def _generate_parameter_files(
|
|
|
109
116
|
Returns the union of parameters returned by write_to_runpath for each
|
|
110
117
|
parameter_config.
|
|
111
118
|
"""
|
|
119
|
+
# preload scalar parameters for this realization
|
|
120
|
+
keys = [
|
|
121
|
+
p.name
|
|
122
|
+
for p in parameter_configs
|
|
123
|
+
if p.cardinality == ParameterCardinality.multiple_configs_per_ensemble_dataset
|
|
124
|
+
]
|
|
125
|
+
scalar_data: dict[str, float | str] = {}
|
|
126
|
+
if keys:
|
|
127
|
+
df = fs._load_scalar_keys(keys=keys, realizations=iens, transformed=True)
|
|
128
|
+
scalar_data = df.to_dicts()[0]
|
|
112
129
|
exports: dict[str, dict[str, float | str]] = {}
|
|
113
|
-
|
|
114
130
|
for param in parameter_configs:
|
|
115
131
|
# For the first iteration we do not write the parameter
|
|
116
132
|
# to run path, as we expect to read if after the forward
|
|
117
133
|
# model has completed.
|
|
118
134
|
if param.forward_init and iteration == 0:
|
|
119
135
|
continue
|
|
120
|
-
export_values
|
|
136
|
+
export_values: dict[str, dict[str, float | str]] | None = None
|
|
137
|
+
if param.name in scalar_data:
|
|
138
|
+
export_values = {param.group_name: {param.name: scalar_data[param.name]}}
|
|
139
|
+
else:
|
|
140
|
+
export_values = param.write_to_runpath(Path(run_path), iens, fs)
|
|
121
141
|
if export_values:
|
|
122
142
|
for group, vals in export_values.items():
|
|
123
143
|
exports.setdefault(group, {}).update(vals)
|
|
@@ -92,7 +92,7 @@ class MultipleDataAssimilation(UpdateRunModel, InitialEnsembleRunModel):
|
|
|
92
92
|
observations=prior.experiment.observations,
|
|
93
93
|
simulation_arguments=prior.experiment.metadata,
|
|
94
94
|
name=f"Restart from {prior.name}",
|
|
95
|
-
templates=
|
|
95
|
+
templates=self.ert_templates,
|
|
96
96
|
)
|
|
97
97
|
except (KeyError, ValueError) as err:
|
|
98
98
|
raise ErtRunError(
|
ert/shared/version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '17.
|
|
32
|
-
__version_tuple__ = version_tuple = (17,
|
|
31
|
+
__version__ = version = '17.1.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (17, 1, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gf5fff23fc'
|
ert/storage/local_storage.py
CHANGED
|
@@ -30,7 +30,7 @@ from .realization_storage_state import RealizationStorageState
|
|
|
30
30
|
|
|
31
31
|
logger = logging.getLogger(__name__)
|
|
32
32
|
|
|
33
|
-
_LOCAL_STORAGE_VERSION =
|
|
33
|
+
_LOCAL_STORAGE_VERSION = 16
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class _Migrations(BaseModel):
|
|
@@ -497,6 +497,7 @@ class LocalStorage(BaseMode):
|
|
|
497
497
|
to13,
|
|
498
498
|
to14,
|
|
499
499
|
to15,
|
|
500
|
+
to16,
|
|
500
501
|
)
|
|
501
502
|
|
|
502
503
|
try:
|
|
@@ -541,6 +542,7 @@ class LocalStorage(BaseMode):
|
|
|
541
542
|
12: to13,
|
|
542
543
|
13: to14,
|
|
543
544
|
14: to15,
|
|
545
|
+
15: to16,
|
|
544
546
|
}
|
|
545
547
|
for from_version in range(version, _LOCAL_STORAGE_VERSION):
|
|
546
548
|
migrations[from_version].migrate(self.path)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
info = "Remove mask file from field config"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def migrate_field_param(parameters_json: dict[str, Any]) -> dict[str, Any]:
|
|
9
|
+
new_configs = {}
|
|
10
|
+
for param_config in parameters_json.values():
|
|
11
|
+
if param_config["type"] == "field":
|
|
12
|
+
del param_config["mask_file"]
|
|
13
|
+
|
|
14
|
+
new_configs[param_config["name"]] = param_config
|
|
15
|
+
return new_configs
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def delete_mask_file(experiment: Path) -> None:
|
|
19
|
+
# delete grid mask file if it exists
|
|
20
|
+
grid_mask_file = experiment / "grid_mask.npy"
|
|
21
|
+
if grid_mask_file.exists():
|
|
22
|
+
grid_mask_file.unlink()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def migrate_fields(experiment: Path) -> None:
|
|
26
|
+
with open(experiment / "parameter.json", encoding="utf-8") as fin:
|
|
27
|
+
parameters_json = json.load(fin)
|
|
28
|
+
|
|
29
|
+
new_parameter_configs = migrate_field_param(parameters_json)
|
|
30
|
+
Path(experiment / "parameter.json").write_text(
|
|
31
|
+
json.dumps(new_parameter_configs, indent=2), encoding="utf-8"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def migrate(path: Path) -> None:
|
|
36
|
+
for experiment in path.glob("experiments/*"):
|
|
37
|
+
migrate_fields(experiment)
|
|
38
|
+
delete_mask_file(experiment)
|
|
@@ -51,20 +51,20 @@ ert/config/_str_to_bool.py,sha256=AxNCJAuTtKF-562CRh7HgjQIyM7N-jjSlRJKvpCNk9I,85
|
|
|
51
51
|
ert/config/analysis_config.py,sha256=v-ZppIlP_NkmhtuYuxm31m2V3eA7YjvC3rDsMXm5qPk,8646
|
|
52
52
|
ert/config/analysis_module.py,sha256=TLluRobz_0NNMDSGFdM4L2t9agfvHyhoN-b1Rg8MAE4,2070
|
|
53
53
|
ert/config/capture_validation.py,sha256=8HGEbJ2z9FXeEaxSewejP7NtEh4LLomPwcdpC0CJlko,1252
|
|
54
|
-
ert/config/design_matrix.py,sha256=
|
|
54
|
+
ert/config/design_matrix.py,sha256=cJTvvUVKo9h5OPGjQDcq-cK0Pl3mm3P63RDKvK_n0xU,16993
|
|
55
55
|
ert/config/distribution.py,sha256=MdLQEnWZqDaAwbKI1maXxlurYousirlZbA8AIk6GITw,12734
|
|
56
56
|
ert/config/ensemble_config.py,sha256=8IgQOdzhczslScJJuVYlWKzALw6_IsqvZzSvMkiE8go,7438
|
|
57
|
-
ert/config/ert_config.py,sha256=
|
|
57
|
+
ert/config/ert_config.py,sha256=pYi1qywb95rtA1Kro-hoDHOucrUJCvSWiPTnAAmArt0,54231
|
|
58
58
|
ert/config/ert_plugin.py,sha256=hENwrc9FfhqUYjVpFYcmy66jDLgU_gagOJFBcYjxe6A,458
|
|
59
59
|
ert/config/ert_script.py,sha256=64FZ-dMI8DZtRLHWReC19KY-ZOsBhdgYkwAe9ZWLc_I,8405
|
|
60
60
|
ert/config/everest_constraints_config.py,sha256=vlsoXHGyoCoESZ4eFdsKlFWL0aEctRR0caBFwcuF1xk,3099
|
|
61
61
|
ert/config/everest_objective_config.py,sha256=fV9oxz3eIHCwICRIYWaQHgpTCqbcJ9XpQOrKJIj3UBc,3209
|
|
62
62
|
ert/config/ext_param_config.py,sha256=7UIPONpu5iutzpwixorD2hvswqSN5hKRyfLMWPXGeTM,3307
|
|
63
63
|
ert/config/external_ert_script.py,sha256=7htQDv1P7ykoj4Bz51xOWIDbs7P4z7HIft67Baba71Q,1169
|
|
64
|
-
ert/config/field.py,sha256=
|
|
64
|
+
ert/config/field.py,sha256=BDaBni_aQ2y1GpG37KodrmlBcG17bXgZLOzR72Llxmo,12093
|
|
65
65
|
ert/config/forward_model_step.py,sha256=v35ieiGdE5OA764q1eri2MGSNDEUtOlweBp2Vx56EpI,9926
|
|
66
66
|
ert/config/gen_data_config.py,sha256=Vuh3wGPL_R2jktPhX_dAR_SjYu0LADdRQJjn1H7VVV8,8554
|
|
67
|
-
ert/config/gen_kw_config.py,sha256=
|
|
67
|
+
ert/config/gen_kw_config.py,sha256=sDtmLmPAVgI-eI6OzBMORm6V2EnyqaOb6tKdnNLNIP8,10583
|
|
68
68
|
ert/config/lint_file.py,sha256=DZv2j2OzhArtr7oDDUin6lJRwP6Ww620b7Yh-0SHUFc,671
|
|
69
69
|
ert/config/model_config.py,sha256=puFBesPfksWM9Yp1qKa1gu_y7r2drZf9etJUBqGspu4,5056
|
|
70
70
|
ert/config/parameter_config.py,sha256=pZz0PstN_Mm4e2w3S_CxuXHZK11KeNjLAUhJIUqMXYg,6035
|
|
@@ -149,7 +149,7 @@ ert/exceptions/__init__.py,sha256=EJX9UqMSDD-a1Eqayy-D5jFL_ElyykdlOBAUaKAmA-g,99
|
|
|
149
149
|
ert/exceptions/_exceptions.py,sha256=dv4rs5oWe00PcelvGEsTscD3AKhI1uwwSjprMSHk4xw,188
|
|
150
150
|
ert/field_utils/__init__.py,sha256=6J1hZv7CfjThhYGp3eNCA0Nzc6UpI53fnqlnt5Y1D_U,420
|
|
151
151
|
ert/field_utils/field_file_format.py,sha256=QWDQYsba2zUfbMltBxReZqAZOYWkHb8kG_xY7BvBzO0,297
|
|
152
|
-
ert/field_utils/field_utils.py,sha256=
|
|
152
|
+
ert/field_utils/field_utils.py,sha256=E_riEUOQV113-NGRJT1EXBWO4m9gtPfoUSYUoazJYD0,8241
|
|
153
153
|
ert/field_utils/grdecl_io.py,sha256=kgSE3Fyr_7KDS1HQRmO7RQLMwgrkgJ_Tsmo7jE9GE1s,8971
|
|
154
154
|
ert/field_utils/roff_io.py,sha256=7gzGYKpOhSYiDVxyAndgyLGDcj1s21C7hFsO3E96poM,4030
|
|
155
155
|
ert/gui/__init__.py,sha256=AULn_ohaSWhaM-7oZuGYbagLfZ8PGL03vyiPTtSR0vk,625
|
|
@@ -367,7 +367,7 @@ ert/resources/workflows/jobs/shell/MOVE_DIRECTORY,sha256=Lh_u0-eCr5Usa8Xien44d6q
|
|
|
367
367
|
ert/resources/workflows/jobs/shell/MOVE_FILE,sha256=MET6aPtDTVaoEDiTZqKqx_hRayJP3Gn-yubdwrJqpjw,48
|
|
368
368
|
ert/resources/workflows/jobs/shell/SYMLINK,sha256=P6wYoLM6y7IqzJQE5ZWkKEj7ERfK9VTRJa6N1pKigeg,46
|
|
369
369
|
ert/run_models/__init__.py,sha256=MWZL_nWbAarzw8Ltuy1kU0LyZpxP07Nk86wGHwOQEv8,936
|
|
370
|
-
ert/run_models/_create_run_path.py,sha256=
|
|
370
|
+
ert/run_models/_create_run_path.py,sha256=5CJNFaBbsCnfzb9eoXGWdgFpuJiBXiPTsaHdyJcXbHQ,9007
|
|
371
371
|
ert/run_models/ensemble_experiment.py,sha256=dUOSNh8a8jKNoBesirvQU0qUUvZ1jcaCTCS1T4s0KCY,2833
|
|
372
372
|
ert/run_models/ensemble_information_filter.py,sha256=CN-yX3DJlRI7qMaLcEdTgpJMptVjU8d4c7o9HX61PQ0,1039
|
|
373
373
|
ert/run_models/ensemble_smoother.py,sha256=CEdcGSAo_yW3Sfvh3OjQjnhGcwwErDkq7aFZBkKsNOo,3623
|
|
@@ -377,7 +377,7 @@ ert/run_models/everest_run_model.py,sha256=vkHezGoQ2n2wix3lufd-zgfUTb6BAEoyTh-1R
|
|
|
377
377
|
ert/run_models/initial_ensemble_run_model.py,sha256=Kjl7cSRNT_yiHcXw-0RhwGn9ggSlWs3zq2nQGIVwNDA,3720
|
|
378
378
|
ert/run_models/manual_update.py,sha256=uhzeQnIL7QKUjKSzGM_Oby8PrQLqpsLEEJbM3k_EAIc,2929
|
|
379
379
|
ert/run_models/model_factory.py,sha256=3TbIjpFqooCYB3QoLjqkw9m-xnwvt3H12rSnfKAHUmA,18588
|
|
380
|
-
ert/run_models/multiple_data_assimilation.py,sha256=
|
|
380
|
+
ert/run_models/multiple_data_assimilation.py,sha256=pJa1X55dLBpDn13ukQR1W769qVPPQEiUAl1fjq6ArS4,8214
|
|
381
381
|
ert/run_models/run_model.py,sha256=ZhX1C2_NQRFe-i4wx7qaV4w8-BXmb6vHnz4p0ZhuFsQ,30234
|
|
382
382
|
ert/run_models/single_test_run.py,sha256=4MJeyZAN9uX5RdIni5vb3uymUexG3JtZBtERMUCjqPE,922
|
|
383
383
|
ert/run_models/update_run_model.py,sha256=sQO2kHH1zDF5GtEFSJIDG_2pCR4Qzj2tu7sFzQ9u2XA,5324
|
|
@@ -397,7 +397,7 @@ ert/services/storage_service.py,sha256=3hiQ5MVDD1ozFgndcy6HadK0qPVS1FAmL4P5p2LFf
|
|
|
397
397
|
ert/services/webviz_ert_service.py,sha256=J5vznqb_-DjlDMOze7tdvuBE4GWEPgJ5dIIXvRLKd0Y,650
|
|
398
398
|
ert/shared/__init__.py,sha256=OwgL-31MxA0fabETJ5Svw0tqJpHi569CZDRFHdHiqA0,644
|
|
399
399
|
ert/shared/net_utils.py,sha256=DDHIZLHdBnh7ZZ--1s-FUlsoNTSJJsfHmLQE44E2JqU,5324
|
|
400
|
-
ert/shared/version.py,sha256
|
|
400
|
+
ert/shared/version.py,sha256=lWK3GCMvVnSkDONSCqHwX1YrDpQtDsZaza8okvJgVAc,714
|
|
401
401
|
ert/shared/_doc_utils/__init__.py,sha256=zSl-NUpWLF167PVTvfjn0T50gExjvyWPw5OGq5Bt2Dc,983
|
|
402
402
|
ert/shared/_doc_utils/ert_jobs.py,sha256=425Ol3pk-rIjyQxoopAijKV-YiAESJy3yyoukBQle4s,8116
|
|
403
403
|
ert/shared/_doc_utils/everest_jobs.py,sha256=uBDN7tIwlBJIZVZ6ZFL1tkewEJJGDLoeVrFIIrJznvM,2081
|
|
@@ -416,7 +416,7 @@ ert/storage/__init__.py,sha256=W3sSffFeh60a3T3rGlylucgR1sYRQb2OEkAiqO0r1Y0,2053
|
|
|
416
416
|
ert/storage/load_status.py,sha256=7h_GdA2qYGgQ-M5AOIo7xG43ljwzEEgbRb7vg0xSYEE,304
|
|
417
417
|
ert/storage/local_ensemble.py,sha256=AZJIErrgC4UujVQMV0bri3DFjeY09Pu6qg4LtAonO-0,49811
|
|
418
418
|
ert/storage/local_experiment.py,sha256=L7SYZ7LVusjOv1c608aunk9MMMnxVZktHAeML0AvC8U,17098
|
|
419
|
-
ert/storage/local_storage.py,sha256=
|
|
419
|
+
ert/storage/local_storage.py,sha256=fH-yiLn3sMYO3v6-LgAzt_yL41Kc87JJhMx5HQP6R70,23236
|
|
420
420
|
ert/storage/mode.py,sha256=GJBlRSqS0Q06qDvaAztdcG-oV2MLsVID2Mo3OgQKjUw,2470
|
|
421
421
|
ert/storage/realization_storage_state.py,sha256=JdiBr__Ce5e1MzmRsRdMuwgCtiuHZRjsQ-as8ivTX7Q,220
|
|
422
422
|
ert/storage/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -426,6 +426,7 @@ ert/storage/migration/to12.py,sha256=C7OKokpU27DW39Pt8xb8OgqdWPGeyAxUr1sokyZh-LQ
|
|
|
426
426
|
ert/storage/migration/to13.py,sha256=uNpwzZPRF9dSFhAtIlmdIi8vGM35Md0n6e60NElegyU,5069
|
|
427
427
|
ert/storage/migration/to14.py,sha256=JO83mFTnmdAfdI6splnDS0nT2v541cpl7QzLBfwitOU,1476
|
|
428
428
|
ert/storage/migration/to15.py,sha256=mD0Fz5iNiEE_QeJRdVigDueUeFpNQUNyIm57jlpstcs,771
|
|
429
|
+
ert/storage/migration/to16.py,sha256=akX0tecczCiThkOWsRKwihQnCtZkFP92YSKh0EUkUOI,1137
|
|
429
430
|
ert/storage/migration/to6.py,sha256=Pj9lVCyPCOP0-dt4uypsZtS5Awbc8B7oaySu_VTwnnA,1514
|
|
430
431
|
ert/storage/migration/to7.py,sha256=hV5lLfaQegyvxsy_lWfsiQAYVPCvS8Oe0fYc_fvKXzY,4500
|
|
431
432
|
ert/storage/migration/to8.py,sha256=X5xMKPjpqVQYpnsU4PZqn4wVy5gOzlWpvDRYwvynKf8,5390
|
|
@@ -447,7 +448,7 @@ ert/validation/validation_status.py,sha256=f47_B7aS-9DEh6uaVzKxD97pXienkyTVVCqTy
|
|
|
447
448
|
ert/warnings/__init__.py,sha256=IBwQVkdD7Njaad9PAB-9K-kr15wnA4EBKboxyqgu9NA,214
|
|
448
449
|
ert/warnings/_warnings.py,sha256=7qhNZ0W4nnljzoOx6AXX7VlMv5pa34Ek5M5n1Ep0Kak,189
|
|
449
450
|
ert/warnings/specific_warning_handler.py,sha256=5dVXtOhzcMmtPBGx4AOddXNPfzTFOPA7RVtdH8hLv68,932
|
|
450
|
-
ert-17.
|
|
451
|
+
ert-17.1.1.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
451
452
|
everest/__init__.py,sha256=8_f50f6H3-onqaiuNCwC0Eiotdl9JuTxhwyF_54MVvU,306
|
|
452
453
|
everest/config_file_loader.py,sha256=7cOcT0nwsZ_bhqDkyZ60sIvh1kL2sG1gURqF3IHQ4hc,5287
|
|
453
454
|
everest/everest_storage.py,sha256=nfaTdab9kPlXZQiZWRR-Y7Zb-2kyQNhF0B914bU1IDQ,42269
|
|
@@ -464,7 +465,7 @@ everest/bin/kill_script.py,sha256=-PJC1CyWalbKACAwyVVD4RgSvgqYe5iljx9_lql12y4,32
|
|
|
464
465
|
everest/bin/main.py,sha256=eJhcM_cJHieWDs6f3R0IjKfw9VWoI9ZnkyLpic01pi4,3352
|
|
465
466
|
everest/bin/monitor_script.py,sha256=urwtBH4nlKVfb3IIVghNV3qOTbV8LqIW6l7eiaof_PQ,4467
|
|
466
467
|
everest/bin/utils.py,sha256=oAIMrgOoS4kBu4i945aEy6by7_UryAZuxaq0XhW1hbw,18819
|
|
467
|
-
everest/bin/visualization_script.py,sha256=
|
|
468
|
+
everest/bin/visualization_script.py,sha256=QUzTKRt1JeCRF4U5jGataLd3GZwCkJOFi0mwnWOpQMk,2729
|
|
468
469
|
everest/config/__init__.py,sha256=1LFhLqcJKgrqCRnq4fVLCHyZlCWlx1uOzmNfrkhA9So,1452
|
|
469
470
|
everest/config/control_config.py,sha256=SSyRnKLtH87xSIgM0N1UwtFwGsGkPvl-zeyah5uFEWg,10690
|
|
470
471
|
everest/config/control_variable_config.py,sha256=_jH0Hf7yFSk4f7FOibrKVj-12Muf5larrQx7k5Ag4AI,7681
|
|
@@ -514,8 +515,8 @@ everest/templates/well_drill.tmpl,sha256=9iLexmBHMsMQNXyyRK4GlmVuVpVIxRcCHpy1av5
|
|
|
514
515
|
everest/templates/well_order.tmpl,sha256=XJ1eVRkeyTdLu5sLsltJSSK6BDLN7rFOAqLdM3ZZy3w,75
|
|
515
516
|
everest/util/__init__.py,sha256=xEYLz6pUtgkH8VHer1RfoCwKiO70dBnuhHonsOPaOx0,1359
|
|
516
517
|
everest/util/forward_models.py,sha256=JPxHhLI6TrmQJwW50wwGBmw57TfRd8SG2svYhXFHrc8,1617
|
|
517
|
-
ert-17.
|
|
518
|
-
ert-17.
|
|
519
|
-
ert-17.
|
|
520
|
-
ert-17.
|
|
521
|
-
ert-17.
|
|
518
|
+
ert-17.1.1.dist-info/METADATA,sha256=YHNXoero9qqe9HSG_R5PEILZft2LmJOcWAyHrS3m6Yk,10005
|
|
519
|
+
ert-17.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
520
|
+
ert-17.1.1.dist-info/entry_points.txt,sha256=ChZ7vn8Qy9v9rT8GM2JtAvWDN3NVoy4BIcvVRtU73CM,189
|
|
521
|
+
ert-17.1.1.dist-info/top_level.txt,sha256=LRh9GfdfyDWfAGmrQgp_XdoMHA4v6aotw8xgsy5YyHE,17
|
|
522
|
+
ert-17.1.1.dist-info/RECORD,,
|
|
@@ -47,9 +47,10 @@ def _build_args_parser() -> argparse.ArgumentParser:
|
|
|
47
47
|
def visualization_entry(args: list[str] | None = None) -> None:
|
|
48
48
|
parser = _build_args_parser()
|
|
49
49
|
options = parser.parse_args(args)
|
|
50
|
+
logger = logging.getLogger(__name__)
|
|
50
51
|
with setup_logging(options):
|
|
52
|
+
logger.info(f"Starting everviz entrypoint with args {args} in {Path.cwd()}")
|
|
51
53
|
ever_config = options.config
|
|
52
|
-
|
|
53
54
|
EverestStorage.check_for_deprecated_seba_storage(
|
|
54
55
|
ever_config.optimization_output_dir
|
|
55
56
|
)
|
|
@@ -60,9 +61,7 @@ def visualization_entry(args: list[str] | None = None) -> None:
|
|
|
60
61
|
except ErtStorageException as err:
|
|
61
62
|
if "too old" in str(err):
|
|
62
63
|
# Open write storage to do a migration
|
|
63
|
-
|
|
64
|
-
"Migrating ERT storage from everviz entrypoint"
|
|
65
|
-
)
|
|
64
|
+
logger.info("Migrating ERT storage from everviz entrypoint")
|
|
66
65
|
open_storage(ever_config.storage_dir, mode="w").close()
|
|
67
66
|
|
|
68
67
|
storage = EverestStorage(output_dir=Path(ever_config.optimization_output_dir))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|