Skip to content

Commit ce01fce

Browse files
committed
fmuobs Add support to ert observation with localization
1 parent 6d34949 commit ce01fce

3 files changed

Lines changed: 149 additions & 3 deletions

File tree

src/subscript/fmuobs/parsers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ def flatten_observation_unit(
358358

359359
for subunit in subunit_keys:
360360
if len(subunit.split()) < 2:
361+
if subunit.upper() in ("LOCALIZATION"):
362+
# Ignore LOCALIZATION subunit
363+
logger.debug("Ignoring unlabeled subunit block: %s", subunit)
364+
continue
361365
# It must be two strings, like "OBS P1", or "SEGMENT FIRST_YEAR".
362366
raise ValueError("Wrong observation subunit syntax: " + str(subunit))
363367
obs_subunits.append(

tests/test_fmuobs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def fixture_readonly_testdata_dir(monkeypatch):
3333
("ert-doc.csv", "csv"),
3434
("fmu-ensemble-obs.yml", "yaml"),
3535
("drogon_wbhp_rft_wct_gor_tracer_4d.obs", "ert"),
36+
("drogon_wbhp_rft_wct_gor_tracer_plt_local.obs", "ert"),
3637
],
3738
)
3839
def test_autoparse_file(filename, expected_format, readonly_testdata_dir):
@@ -161,6 +162,7 @@ def test_roundtrip_ertobs(filename, readonly_testdata_dir):
161162
("ert-doc.csv"),
162163
("fmu-ensemble-obs.yml"),
163164
("drogon_wbhp_rft_wct_gor_tracer_4d.obs"),
165+
("drogon_wbhp_rft_wct_gor_tracer_plt_local.obs"),
164166
],
165167
)
166168
def test_roundtrip_yaml(filename, readonly_testdata_dir):
@@ -206,6 +208,7 @@ def test_roundtrip_yaml(filename, readonly_testdata_dir):
206208
("ert-doc.csv"),
207209
("fmu-ensemble-obs.yml"),
208210
("drogon_wbhp_rft_wct_gor_tracer_4d.obs"),
211+
("drogon_wbhp_rft_wct_gor_tracer_plt_local.obs"),
209212
],
210213
)
211214
def test_roundtrip_resinsight(filename, readonly_testdata_dir):
@@ -228,14 +231,18 @@ def test_roundtrip_resinsight(filename, readonly_testdata_dir):
228231

229232
# LABEL is not part of the ResInsight format, and a made-up label
230233
# is obtained through the roundtrip (when importing back). Skip it
231-
# when comparing.
234+
# when comparing. ERROR_MODE is also not preserved in ResInsight format.
232235

233236
pd.testing.assert_frame_equal(
234237
ri_roundtrip_dframe.sort_index(axis="columns").drop(
235-
["LABEL", "COMMENT", "SUBCOMMENT"], axis="columns", errors="ignore"
238+
["LABEL", "COMMENT", "SUBCOMMENT", "ERROR_MODE"],
239+
axis="columns",
240+
errors="ignore",
236241
),
237242
dframe.sort_index(axis="columns").drop(
238-
["LABEL", "COMMENT", "SUBCOMMENT"], axis="columns", errors="ignore"
243+
["LABEL", "COMMENT", "SUBCOMMENT", "ERROR_MODE"],
244+
axis="columns",
245+
errors="ignore",
239246
),
240247
check_like=True,
241248
)

0 commit comments

Comments
 (0)