Skip to content

Commit c3c3624

Browse files
committed
Add save_experiment_data to scalar parameter
1 parent 0822f6f commit c3c3624

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/ert/config/scalar_parameter.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import math
44
import os
5+
import shutil
56
import warnings
67
from collections import defaultdict
78
from collections.abc import Iterable
@@ -410,6 +411,24 @@ def save_parameters(
410411
# which parameters are being written whithin the data array
411412
pass
412413

414+
def save_experiment_data(
415+
self,
416+
experiment_path: Path,
417+
) -> None:
418+
templates: dict[str, str] = {}
419+
for group_name, params in self.groups.items():
420+
for param in params:
421+
if param.template_file is not None:
422+
templates[group_name] = param.template_file
423+
break
424+
425+
for template_file in templates.values():
426+
incoming_template_file_path = Path(template_file)
427+
template_file_path = Path(
428+
experiment_path / incoming_template_file_path.name
429+
)
430+
shutil.copyfile(incoming_template_file_path, template_file_path)
431+
413432
def save_updated_parameters_and_copy_remaining(
414433
self,
415434
source_ensemble: Ensemble,
@@ -502,7 +521,6 @@ def write_to_runpath(
502521
if param.template_file is not None and param.output_file is not None:
503522
outfiles[group_name] = (param.template_file, param.output_file)
504523
break
505-
print(f"DEBUG {outfiles} {data}")
506524
for group_name, (template_file, output_file) in outfiles.items():
507525
target_file = substitute_runpath_name(
508526
output_file, real_nr, ensemble.iteration

0 commit comments

Comments
 (0)