Skip to content

Distance-based localiztion test script for testing full update workflow using ERT storage with ensemble experiments - #230

Closed
oddvarlia wants to merge 15 commits into
mainfrom
real_case_test
Closed

Distance-based localiztion test script for testing full update workflow using ERT storage with ensemble experiments#230
oddvarlia wants to merge 15 commits into
mainfrom
real_case_test

Conversation

@oddvarlia

@oddvarlia oddvarlia commented Aug 15, 2025

Copy link
Copy Markdown
Collaborator

The script is initially using Drogon case from this summer.
The distance-based localization depends on having position for observations (well prod observations and seismic points for 4D)
This is currently not available in ERT and storage directories created by ERT so the information must be taken from the FMU setup for seismic observations and the RMS forward model.

A script to extract position data from wells using RMS project is included
The plan is to get position data for the seismic observations as well by loading files with seismic data points including position from ERT project.

Main goal of this branch is to test and evaluate performance of distance-based localization before the method is implemented in ERT code.

This branch is built on the branch Distance-based localization per 15.08.2025

@oddvarlia
oddvarlia marked this pull request as draft August 15, 2025 12:22
@oddvarlia
oddvarlia requested a review from dafeda August 15, 2025 12:23
Comment thread distance_based_on_real_case.py Outdated
groups = list(param_config_all.keys())
realizations = ensemble.get_realization_list_with_responses()
group_number = 0
for group_name in groups:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use enumerate to avoid having to increment group_number manually.
for group_number, group_name in enumerate(groups)

Comment thread distance_based_on_real_case.py Outdated
smoother = DistanceESMDA(
covariance=C_D, observations=observations, alpha=alpha, seed=seed
)
smoother.prepare_assimilation(Y, truncation=0.99)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can as part of the assimilate_batch function and only do the actual calculations if self.X3 and self.D` are not already set.

# Turn on/off export of field parameters into 3D parameter files in ROFF format to be read by RMS.
WRITE_STATS_PARAMS = True

# Common definition of ERTBOX for all zones in Drogon

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the grid file specified using the GRID keyword in the Drogon project contain all this information?

Comment thread distance_based_on_real_case.py Outdated
OBS_FILE_PATH = (
"/project/fmu/users/olia/drogon_20250623_11-50/resmod/ff/25.0.0/rms/model/"
)
OBS_FILE = "summary_obs_with_localization_attributes.csv"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you push this file to the repo as well or is it perhaps too big?

Comment thread distance_based_on_real_case.py Outdated
OBS_SUMMARY_WITH_LOCAL_ATTRIBUTES_FILE = OBS_FILE_PATH + OBS_FILE

# Hard-coded a classification of parameter groups into scalars, 2D or 3D field parameters
# NOTE: This should be available from ERT storage (ERT knows about the source the keyword FIELD, SURFACE GEN_KW)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's one way to get the parameter type:

with open_storage(storage_path, "r") as storage:
    experiment = storage.get_experiment_by_name(experiment_name)
    
print(experiment.parameter_configuration["COND"].type)
# >> field

print(experiment.parameter_configuration["INIT_TEMP_SCALE"].type)
# >> gen_kw

Comment thread distance_based_on_real_case.py Outdated
# (e.g for permeabilit or porosity) could be <zone_name>_<facies>_<petro_name>
# for petrophysical fields to be updated simultaneously with facies update from APS.
# For reservoir zones without facies modelling, the convention could be <zone_name>_<petro_name>
# NOTE: An additional parameter in FIELD keyword with zone name can solve the problem if naming convention

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue has been created on this that needs more information:

equinor/ert#11517

@dafeda

dafeda commented Sep 5, 2025

Copy link
Copy Markdown
Collaborator

I suggest we generate .csv files that are comma delimited and not delimited by space. This can avoid potential bugs if for example a zone name has a space in its name.

@oddvarlia
oddvarlia force-pushed the real_case_test branch 3 times, most recently from a5846f6 to 0b1f9a9 Compare September 7, 2025 21:05
@oddvarlia
oddvarlia force-pushed the real_case_test branch 3 times, most recently from 7505b9c to 14a73ba Compare September 23, 2025 10:59
@oddvarlia
oddvarlia force-pushed the real_case_test branch 2 times, most recently from 6992e30 to c7e0d02 Compare October 4, 2025 08:57
@oddvarlia

Copy link
Copy Markdown
Collaborator Author

The class DistanceESMDA is now merged into main. See merged PR 240. The test script with additional help scripts for RMS and yml files for drogon case is not merged.

@oddvarlia
oddvarlia force-pushed the real_case_test branch 2 times, most recently from 8baf006 to 780f49a Compare January 20, 2026 10:31
@oddvarlia
oddvarlia force-pushed the real_case_test branch 3 times, most recently from 577d167 to b5f3fae Compare February 15, 2026 09:10
dafeda and others added 13 commits March 6, 2026 18:52
…ning on a case from ERT storage

Added description of implementation steps
Update create_obs_with_localisation_attributes
update distance_based_on_real_case.py
Working version with summary data
Added seismic obs and RFT obs
Attempt to save update to ERT storage
Added tracer obs
Added tracer obs file
Added ESMDA update to scalars
Modified the path to where on scratch to find the ensemble
Ensure that updated ensemble in storage has iteration greater than 0
Added new scaling function
Changed seismic_range
Update scalar parameters
Updated document lines
Updated test_distance_based.ipynb to initialize ESMDA before each update
Update code and use ertbox parameters from storage
Update input to handle seismic and rft obs per zone
Added adaptive localisation for scalara parameters
Added functionality to simulate spatially correlated seismic observation errors
Added option to specify D matrix as input to ESMDA and DistanceESMDA
update distance_based_on_real_case.py to work with new version of storage
Update experimental.py and test_experimental.py to be equal to main
@dafeda

dafeda commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Closing as this was not meant to be merged but was pushed for discussions.

@dafeda dafeda closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants