Skip to content

Commit d4f4549

Browse files
committed
Storage migration
1 parent 1a8cdff commit d4f4549

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/ert/storage/local_storage.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ def _save_index(self) -> None:
448448
@require_write
449449
def _migrate(self, version: int) -> None:
450450
from ert.storage.migration import ( # noqa: PLC0415
451+
to2,
451452
to3,
452453
to4,
453454
to5,
@@ -502,7 +503,7 @@ def _migrate(self, version: int) -> None:
502503

503504
elif version < _LOCAL_STORAGE_VERSION:
504505
migrations = list(
505-
enumerate([to3, to4, to5, to6, to7, to8, to9, to10], start=1)
506+
enumerate([to2, to3, to4, to5, to6, to7, to8, to9, to10], start=1)
506507
)
507508
for from_version, migration in migrations[version - 1 :]:
508509
print(f"* Updating storage to version: {from_version + 1}")

src/ert/storage/migration/to10.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ def migrate(path: Path) -> None:
1212
with open(experiment / "parameter.json", "w", encoding="utf-8") as fout:
1313
for param in parameters_json.values():
1414
if param["_ert_kind"] == "GenKwConfig":
15-
del param["template_file"]
16-
del param["output_file"]
15+
param.pop("template_file", None)
16+
param.pop("output_file", None)
1717
fout.write(json.dumps(parameters_json, indent=4))
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{'BPR': GenKwConfig(name='BPR', forward_init=False, update=True, template_file='/home/eivind/Projects/ert/test-data/all_data_types/template.txt', output_file='params.txt', transform_function_definitions=[{'name': 'BPR', 'param_name': 'NORMAL', 'values': ['0', '1']}], forward_init_file=None), 'PORO': Field(name='PORO', forward_init=False, update=True, nx=2, ny=3, nz=4, file_format=<FieldFileFormat.GRDECL: 'grdecl'>, output_transformation=None, input_transformation=None, truncation_min=None, truncation_max=None, forward_init_file='data/poro%d.grdecl', output_file=PosixPath('poro.grdecl'), grid_file='/home/eivind/Projects/ert/test-data/all_data_types/refcase/CASE.EGRID', mask_file=''), 'TOP': SurfaceConfig(name='TOP', forward_init=False, update=True, ncol=2, nrow=3, xori=0.0, yori=0.0, xinc=1.0, yinc=1.0, rotation=0.0, yflip=1, forward_init_file='data/surf%d.irap', output_file='surf.irap', base_surface_path='data/basesurf.irap')}
1+
{'BPR': GenKwConfig(name='BPR', forward_init=False, update=True, transform_function_definitions=[{'name': 'BPR', 'param_name': 'NORMAL', 'values': ['0', '1']}], forward_init_file=None), 'PORO': Field(name='PORO', forward_init=False, update=True, nx=2, ny=3, nz=4, file_format=<FieldFileFormat.GRDECL: 'grdecl'>, output_transformation=None, input_transformation=None, truncation_min=None, truncation_max=None, forward_init_file='data/poro%d.grdecl', output_file=PosixPath('poro.grdecl'), grid_file='/home/eivind/Projects/ert/test-data/all_data_types/refcase/CASE.EGRID', mask_file=''), 'TOP': SurfaceConfig(name='TOP', forward_init=False, update=True, ncol=2, nrow=3, xori=0.0, yori=0.0, xinc=1.0, yinc=1.0, rotation=0.0, yflip=1, forward_init_file='data/surf%d.irap', output_file='surf.irap', base_surface_path='data/basesurf.irap')}

0 commit comments

Comments
 (0)