Skip to content

Commit

Permalink
Updated test_full.py due to changes in how ert storage deliver field …
Browse files Browse the repository at this point in the history
…parameters
  • Loading branch information
oddvarlia committed Jan 3, 2024
1 parent 3d010d2 commit 36c2c02
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/workflows/localisation/example_case/test_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,24 @@ def test_that_localization_works_with_different_settings(
with open_storage(facade.enspath) as storage:
realization = 5
es_prior = storage.get_ensemble_by_name("es_prior")
es_prior_results = es_prior.load_parameters("FIELDPAR").sel(
es_prior_xdata = es_prior.load_parameters("FIELDPAR").sel(
realizations=realization
)
es_prior_values_from_storage = es_prior_xdata["values"].values

es_posterior = storage.get_ensemble_by_name("es_posterior")
es_posterior_results = es_posterior.load_parameters("FIELDPAR").sel(
es_posterior_xdata = es_posterior.load_parameters("FIELDPAR").sel(
realizations=realization
)
es_posterior_values_from_storage = es_posterior_xdata["values"].values

# Write to file for easier QC of differences
es_prior_from_storage = xtgeo.GridProperty(
ncol=dims[0],
nrow=dims[1],
nlay=dims[2],
name="prior_storage",
values=es_prior_results.values,
values=es_prior_values_from_storage,
)
es_prior_from_storage.mask_undef()
es_prior_from_storage.to_file("prior_storage.roff", fformat="roff")
Expand All @@ -244,22 +246,22 @@ def test_that_localization_works_with_different_settings(
nrow=dims[1],
nlay=dims[2],
name="posterior_storage",
values=es_posterior_results.values,
values=es_posterior_values_from_storage,
)
es_posterior_from_storage.mask_undef()
es_posterior_from_storage.to_file("posterior_storage.roff", fformat="roff")

# Check with reference
assert np.allclose(
es_prior_expected.values3d,
np.round(es_prior_results.values, 4),
np.round(es_prior_values_from_storage, 4),
atol=1e-4,
equal_nan=True,
)

assert np.allclose(
es_posterior_expected.values3d,
np.round(es_posterior_results.values, 4),
np.round(es_posterior_values_from_storage, 4),
atol=1e-4,
equal_nan=True,
)

0 comments on commit 36c2c02

Please sign in to comment.