Skip to content

Commit

Permalink
Add test case for non-adaptive localisation
Browse files Browse the repository at this point in the history
Add option to specify alternative settings for the test case using a yml file
Replaced gaussianfft as python module for simulation of gaussian fields with gstools.
write scaling factor in same file format as input fields
Add config file for test example
Add example case with  ROFF and GRDECL file
Add cases with RMS grid index origin
Add case with actnum
fix_grid_index_order in non-adaptive localisation
Update tests for localisation due to c-index order
Fixed a bug when field_scale keyword is missing
Added script to convert from roff to grdecl ascii format
Added test case with constant scaling factor
Added an new test case with regions in localisation
Added test case using scaling field from file
Removed unnecessary files
Add test using scaling from file using RMS grid index origo
local_script_lib typing
Create ert config files. New script to generate reference cases.
Remove unused files
Type annotation in local_script_lib.py
Updated doc-string for test_full.py
Type def for local_script_lib.py
moved test files to new directory
Updated test_full.py due to changes in how ert storage deliver field parameters
  • Loading branch information
oddvarlia committed Jan 5, 2024
1 parent 17c5848 commit fe0d1c0
Show file tree
Hide file tree
Showing 34 changed files with 3,551 additions and 9 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ test = [
"pandas-stubs",
"types-setuptools",
"types-PyYAML",
"gstools",
]

[tool.black]
Expand Down
9 changes: 0 additions & 9 deletions semeio/workflows/localisation/local_script_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,15 +1078,6 @@ def add_ministeps(
param_for_field,
user_config.log_level,
)

# write_qc_parameter_field(
# node_name,
# corr_spec.name,
# corr_spec.field_scale,
# grid_for_field,
# param_for_field,
# user_config.log_level,
# )
update_step["row_scaling_parameters"].append(
[node_name, row_scaling]
)
Expand Down
55 changes: 55 additions & 0 deletions tests/workflows/localisation/example_case/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## Directory for Test Case for Non-Adaptive Localisation (`LOCALISATION_JOB`)
### Main Components:
- **ERT config file:** `sim_field.ert`
The ERT model depends on:
- `scripts/sim_fields.py`
- `scripts/common_functions.py`
- **ERT Keyword Input:**
- **GRID:** Input grid is made by `scripts/make_reference_data.py`
- **OBS_CONFIG:** Observations are extracted from an upscaled realization made by `scripts/make_reference_data.py`
- **GEN_DATA:** Prediction of observables made by forward model `SIM_FIELD` which runs `scripts/sim_fields.py`
- **FIELD:** Prior realizations of field made by forward model `SIM_FIELD` which runs `scripts/sim_fields.py`
- **Other ERT Input Files:**
- `localisation.wf`
- **Other Files:**
- `randomseeds.txt`: Not used by ERT, but by `sim_fields.py`. This file can be generated by `scripts/make_reference_data.py`
- `UpscaledGrid.EGRID`: Not used by ERT, but by `sim_fields.py`. This file can be generated by `scripts/make_reference_data.py`
### Typical Workflow:
- **Preparation to create reference data:**
- Prepare ERT config input by running `scripts/make_reference_data.py`.
- The preparation step is **only necessary** if the reference data need to be updated.
- QC manually the created reference data (GRDECL files to appear in the init_files directory).
- The created reference data should be checked into git if they are modified.
- The reference data is used to check the results from running pytest on test_full.py

​- **Run the pytest on test_full.py**
- The test script will run through a number of cases and compare a selected realization with the reference.

- **How to modify the test:**
- To modify the test, edit the template file for the ERT configuration file
- Edit the alternative parameter settings in the file common_function.py
- Run the script scripts/make_reference_data.py
- QC manually the created reference data files
- Add the new reference files to git

### What the Script `sim_fields.py` Does:
1. It must be installed as a FORWARD model in ERT. This is done in the ERT config template file.
​1. Requires 4 input arguments: iteration number, realization_number, config file , config path
1. Get iteration and realisation number from ERT.
2. If iteration = 0, then:
- Simulate field and export to file to be used in `FIELD` keyword in ERT config file.
- Upscale field and optionally export to file for QC purpose.
Else:
- Import updated field from ERT.
- Upscale field and optionally export file for QC purpose.
3. Extract predicted values of observables from upscaled field (values for selected grid cells related to the upscaled grid) and write `GEN_DATA` files.
4. Optionally write some files for QC purpose.Directory for test case for non-adaptive localisation (LOCALISATION_JOB)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FIELDPAR
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.003016 -0.494571
-1.028435 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 -0.025932 -0.279426 -0.127581 0.017761 -0.193278
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 -0.829884
-1.867067 -2.117355 -1.216993 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 -1.915480 -2.726342 -3.124574
-2.504564 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 -0.876790 -0.636449 -0.371928 -0.186803 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.536597 0.157487
0.151960 0.261694 0.257023 0.275927 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.654710 -0.078125 -0.653691 -0.862671
-0.729918 -0.454728 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.901444
0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.899565 0.992203 0.749731 0.404224
-0.167782 -1.022487 -1.668451 -1.600215 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
-0.035406 1.009202 1.709299 1.983187 1.760534 0.946370
0.064703 -0.146747 0.213693 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.944598
1.588994 1.513464 1.166571 1.047943 1.075387 0.881568
0.389300 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.753952 1.023120 0.847401
0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791
999999999999999945575230987042816.000000 0.157758 0.172461 0.312229 0.509417 0.808807
1.215309 1.370256 0.795799 -0.342228 999999999999999945575230987042816.000000 -1.374976
-0.900708 0.206069 1.040176 1.223922 1.279978 1.478402
1.243197 0.178017 999999999999999945575230987042816.000000 -1.919407 -1.234238 0.040584
1.085511 1.344037 0.997618 0.657986 0.617346 0.557741
-0.841584 -1.226023 -1.207091 -0.902073 -0.387598 0.025259
-0.029104 -0.373039 -0.433728 0.006049 0.545837 -0.318973
-0.824143 -0.816984 -0.678996 -0.777436 -0.967488 -0.856602
-0.316280 999999999999999945575230987042816.000000 1.752741 1.156656 0.156627 -0.349148
-0.425633 -0.648444 -1.098076 -1.299050 -0.878778 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 2.215707 0.622777 -1.049959 -1.704248 -1.537606
-1.549673 -2.107112 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000
-1.249170 -2.481425 -2.643038 -2.015550 -1.732791 999999999999999945575230987042816.000000
999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 /
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FIELDPAR
0.648341 0.376487 0.306689 0.234835 0.003016 -0.494571
-1.028435 -1.095739 -0.725329 -0.679467 0.526481 0.509107
0.391517 -0.025932 -0.279426 -0.127581 0.017761 -0.193278
-0.633775 -1.029683 0.859417 0.607622 0.091949 -0.829884
-1.867067 -2.117355 -1.216993 -0.109772 0.090068 -0.479618
0.439765 -0.143754 -1.070861 -1.915480 -2.726342 -3.124574
-2.504564 -1.177302 -0.224223 -0.178808 -0.057085 -0.287224
-0.724738 -0.876790 -0.636449 -0.371928 -0.186803 0.130124
0.381840 0.089729 1.202264 0.996304 0.536597 0.157487
0.151960 0.261694 0.257023 0.275927 0.215435 -0.279581
1.430932 1.254107 0.654710 -0.078125 -0.653691 -0.862671
-0.729918 -0.454728 -0.200309 -0.092174 1.324994 0.901444
0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499
-0.598027 -0.028493 0.899565 0.992203 0.749731 0.404224
-0.167782 -1.022487 -1.668451 -1.600215 -1.044804 -0.566005
-0.035406 1.009202 1.709299 1.983187 1.760534 0.946370
0.064703 -0.146747 0.213693 0.432429 -0.049208 0.944598
1.588994 1.513464 1.166571 1.047943 1.075387 0.881568
0.389300 -0.185701 0.296088 0.753952 1.023120 0.847401
0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791
0.235147 0.157758 0.172461 0.312229 0.509417 0.808807
1.215309 1.370256 0.795799 -0.342228 -0.995523 -1.374976
-0.900708 0.206069 1.040176 1.223922 1.279978 1.478402
1.243197 0.178017 -1.679243 -1.919407 -1.234238 0.040584
1.085511 1.344037 0.997618 0.657986 0.617346 0.557741
-0.841584 -1.226023 -1.207091 -0.902073 -0.387598 0.025259
-0.029104 -0.373039 -0.433728 0.006049 0.545837 -0.318973
-0.824143 -0.816984 -0.678996 -0.777436 -0.967488 -0.856602
-0.316280 0.517896 1.752741 1.156656 0.156627 -0.349148
-0.425633 -0.648444 -1.098076 -1.299050 -0.878778 -0.019675
2.535338 2.215707 0.622777 -1.049959 -1.704248 -1.537606
-1.549673 -2.107112 -2.676758 -2.857547 0.662012 0.092502
-1.249170 -2.481425 -2.643038 -2.015550 -1.732791 -2.259825
-3.021738 -3.374325 /
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FIELDPAR
0.648341 0.376487 0.306689 0.234835 0.003016 -0.494571
-1.028435 -1.095739 -0.725329 -0.679467 0.526481 0.509107
0.391517 -0.025932 -0.279426 -0.127581 0.017761 -0.193278
-0.633775 -1.029683 0.859417 0.607622 0.091949 -0.829884
-1.867067 -2.117355 -1.216993 -0.109772 0.090068 -0.479618
0.439765 -0.143754 -1.070861 -1.915480 -2.726342 -3.124574
-2.504564 -1.177302 -0.224223 -0.178808 -0.057085 -0.287224
-0.724738 -0.876790 -0.636449 -0.371928 -0.186803 0.130124
0.381840 0.089729 1.202264 0.996304 0.536597 0.157487
0.151960 0.261694 0.257023 0.275927 0.215435 -0.279581
1.430932 1.254107 0.654710 -0.078125 -0.653691 -0.862671
-0.729918 -0.454728 -0.200309 -0.092174 1.324994 0.901444
0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499
-0.598027 -0.028493 0.899565 0.992203 0.749731 0.404224
-0.167782 -1.022487 -1.668451 -1.600215 -1.044804 -0.566005
-0.035406 1.009202 1.709299 1.983187 1.760534 0.946370
0.064703 -0.146747 0.213693 0.432429 -0.049208 0.944598
1.588994 1.513464 1.166571 1.047943 1.075387 0.881568
0.389300 -0.185701 0.296088 0.753952 1.023120 0.847401
0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791
0.235147 0.157758 0.172461 0.312229 0.509417 0.808807
1.215309 1.370256 0.795799 -0.342228 -0.995523 -1.374976
-0.900708 0.206069 1.040176 1.223922 1.279978 1.478402
1.243197 0.178017 -1.679243 -1.919407 -1.234238 0.040584
1.085511 1.344037 0.997618 0.657986 0.617346 0.557741
-0.841584 -1.226023 -1.207091 -0.902073 -0.387598 0.025259
-0.029104 -0.373039 -0.433728 0.006049 0.545837 -0.318973
-0.824143 -0.816984 -0.678996 -0.777436 -0.967488 -0.856602
-0.316280 0.517896 1.752741 1.156656 0.156627 -0.349148
-0.425633 -0.648444 -1.098076 -1.299050 -0.878778 -0.019675
2.535338 2.215707 0.622777 -1.049959 -1.704248 -1.537606
-1.549673 -2.107112 -2.676758 -2.857547 0.662012 0.092502
-1.249170 -2.481425 -2.643038 -2.015550 -1.732791 -2.259825
-3.021738 -3.374325 /
Loading

0 comments on commit fe0d1c0

Please sign in to comment.