diff --git a/tests/jobs/localisation/example_case/example_test_config_A.yml b/tests/jobs/localisation/example_case/example_test_config_A.yml index dbec30d4d..d07031b7b 100644 --- a/tests/jobs/localisation/example_case/example_test_config_A.yml +++ b/tests/jobs/localisation/example_case/example_test_config_A.yml @@ -9,8 +9,8 @@ settings: name: "FIELDPAR" algorithm: "gstools" file_format: "ROFF" - initial_file_name: "init_files/FieldParam" - updated_file_name: "FieldParam" + initial_file_name_prefix: "init_files/FieldParam" + updated_file_name_prefix: "FieldParam" seed_file: "randomseeds.txt" variogram: "gaussian" correlation_range: [250, 500, 2.0] @@ -31,7 +31,9 @@ settings: file_format: "ROFF" write_upscaled_field: True response_function: "average" - gen_data_file_name: "UpscaledField_0.txt" + gen_data_file_prefix: "UpscaledField" + ert_config_template_file: "sim_field_template.ert" + ert_config_file: "sim_field.ert" observation: directory: "observations" @@ -45,6 +47,7 @@ settings: localisation: method: "gaussian" + use_localisation: True optional: write_obs_pred_diff_field_file: False diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_with_actnum_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A2_local.grdecl similarity index 100% rename from tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_with_actnum_local.grdecl rename to tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A2_local.grdecl diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_B_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_B_local.grdecl index bfbebec34..13da8ea21 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_B_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_B_local.grdecl @@ -1,14 +1,14 @@ 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.391516 -0.025932 -0.279426 -0.127581 0.017761 -0.193277 + 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.157488 - 0.151960 0.261694 0.257024 0.275927 0.215435 -0.279581 + 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 @@ -17,17 +17,17 @@ FIELDPAR -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.847402 + 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.995524 -1.374976 + 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.316279 0.517896 1.752741 1.156656 0.156627 -0.349148 + -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 diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_ordinary.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_D.grdecl similarity index 100% rename from tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_A_ordinary.grdecl rename to tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter0_D.grdecl diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_with_actnum_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A2_local.grdecl similarity index 72% rename from tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_with_actnum_local.grdecl rename to tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A2_local.grdecl index 96021a4d3..1da8b3060 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_with_actnum_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A2_local.grdecl @@ -14,18 +14,18 @@ FIELDPAR 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.982377 1.758363 0.945212 - 0.067284 -0.145434 0.208465 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.943345 - 1.580529 1.498230 1.151514 1.022309 1.025455 0.837623 - 0.364517 999999999999999945575230987042816.000000 999999999999999945575230987042816.000000 0.748398 0.996609 0.770220 - 0.482642 0.500991 0.511761 0.344313 0.048683 -0.495770 - 999999999999999945575230987042816.000000 0.151106 0.146383 0.237225 0.281354 0.027600 - -0.700057 -1.265361 -0.926060 -0.536416 999999999999999945575230987042816.000000 -1.372500 - -0.893308 0.209722 0.987814 0.935488 0.433830 0.111914 - 0.093310 -0.207517 999999999999999945575230987042816.000000 -1.918091 -1.223721 0.058541 - 1.078289 1.273392 0.870433 0.493450 0.436846 0.421394 - -0.841584 -1.226023 -1.207091 -0.900885 -0.384667 0.026655 - -0.030569 -0.376062 -0.439128 -0.002688 0.545837 -0.318973 + -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 diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_local.grdecl index 7a58c79fb..cf10f3847 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_local.grdecl @@ -14,18 +14,18 @@ FIELDPAR 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.982377 1.758363 0.945212 - 0.067284 -0.145434 0.208465 0.424655 -0.049208 0.943345 - 1.580529 1.498230 1.151514 1.022309 1.025455 0.837623 - 0.364517 -0.207938 0.295801 0.748398 0.996609 0.770220 - 0.482642 0.500991 0.511761 0.344313 0.048683 -0.495770 - 0.234445 0.151106 0.146383 0.237225 0.281354 0.027600 - -0.700057 -1.265361 -0.926060 -0.536416 -0.995309 -1.372500 - -0.893308 0.209722 0.987814 0.935488 0.433830 0.111914 - 0.093310 -0.207517 -1.679243 -1.918091 -1.223721 0.058541 - 1.078289 1.273392 0.870433 0.493450 0.436846 0.421394 - -0.841584 -1.226023 -1.207091 -0.900885 -0.384667 0.026655 - -0.030569 -0.376062 -0.439128 -0.002688 0.545837 -0.318973 + -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 diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_B_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_B_local.grdecl index b26d34269..a2565f7e8 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_B_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_B_local.grdecl @@ -1,33 +1,33 @@ FIELDPAR - 0.624927 0.324230 0.228608 0.164458 -0.032599 -0.500973 + 0.624927 0.324229 0.228608 0.164458 -0.032599 -0.500973 -1.024369 -1.092756 -0.724924 -0.679467 0.399306 0.268063 - 0.086651 -0.278560 -0.432895 -0.189405 0.011290 -0.187269 + 0.086651 -0.278560 -0.432895 -0.189404 0.011291 -0.187269 -0.630962 -1.029400 0.686212 0.319782 -0.270559 -1.173133 - -2.104531 -2.230151 -1.252772 -0.117290 0.089057 -0.479731 - 0.270529 -0.391326 -1.389473 -2.208690 -2.880918 -3.161224 - -2.503261 -1.174421 -0.223566 -0.178823 -0.086578 -0.331214 - -0.774439 -0.916956 -0.661302 -0.383426 -0.189057 0.130825 - 0.382087 0.089729 1.203307 0.998041 0.539396 0.159891 - 0.151799 0.259973 0.256340 0.275927 0.215435 -0.279581 + -2.104531 -2.230151 -1.252772 -0.117291 0.089057 -0.479731 + 0.270529 -0.391327 -1.389473 -2.208690 -2.880918 -3.161224 + -2.503261 -1.174421 -0.223567 -0.178823 -0.086578 -0.331214 + -0.774439 -0.916956 -0.661302 -0.383426 -0.189057 0.130826 + 0.382087 0.089729 1.203307 0.998041 0.539396 0.159890 + 0.151799 0.259974 0.256339 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.982377 1.758363 0.945212 - 0.067284 -0.145434 0.208465 0.424655 -0.049208 0.943345 - 1.580530 1.498229 1.151514 1.022309 1.025455 0.837623 - 0.364517 -0.207938 0.295801 0.748398 0.996609 0.770220 - 0.482642 0.500991 0.511761 0.344313 0.048683 -0.495770 - 0.234445 0.151106 0.146383 0.237225 0.281354 0.027600 - -0.700057 -1.265361 -0.926060 -0.536416 -0.995309 -1.372499 - -0.893308 0.209722 0.987814 0.935487 0.433831 0.111914 - 0.093310 -0.207516 -1.679243 -1.918091 -1.223721 0.058541 - 1.078289 1.273392 0.870433 0.493449 0.436846 0.421394 - -0.841584 -1.226023 -1.207091 -0.900886 -0.384667 0.026655 - -0.030569 -0.376062 -0.439128 -0.002688 0.545837 -0.318973 + -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.316279 0.517896 1.752741 1.156656 0.156627 -0.349148 + -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 diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_C_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_C_local.grdecl index 1b0980f12..19bfdca93 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_C_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_C_local.grdecl @@ -6,18 +6,18 @@ FIELDPAR -0.425633 -0.648444 -1.098076 -1.299050 -0.878778 -0.019675 0.545837 -0.318973 -0.824143 -0.816984 -0.678996 -0.777436 -0.967488 -0.856602 -0.316280 0.517896 -0.841584 -1.226023 - -1.207091 -0.900885 -0.384667 0.026655 -0.030569 -0.376062 - -0.439128 -0.002688 -1.679243 -1.918091 -1.223721 0.058541 - 1.078289 1.273392 0.870433 0.493450 0.436846 0.421394 - -0.995309 -1.372500 -0.893308 0.209722 0.987814 0.935488 - 0.433830 0.111914 0.093310 -0.207517 0.234445 0.151106 - 0.146383 0.237225 0.281354 0.027600 -0.700057 -1.265361 - -0.926060 -0.536416 0.295801 0.748398 0.996609 0.770220 - 0.482642 0.500991 0.511761 0.344313 0.048683 -0.495770 - -0.049208 0.943345 1.580529 1.498230 1.151514 1.022309 - 1.025455 0.837623 0.364517 -0.207938 -0.035406 1.009202 - 1.709299 1.982377 1.758363 0.945212 0.067284 -0.145434 - 0.208465 0.424655 0.899565 0.992203 0.749731 0.404224 + -1.207091 -0.902073 -0.387598 0.025259 -0.029104 -0.373039 + -0.433728 0.006049 -1.679243 -1.919407 -1.234238 0.040584 + 1.085511 1.344037 0.997618 0.657986 0.617346 0.557741 + -0.995523 -1.374976 -0.900708 0.206069 1.040176 1.223922 + 1.279978 1.478402 1.243197 0.178017 0.235147 0.157758 + 0.172461 0.312229 0.509417 0.808807 1.215309 1.370256 + 0.795799 -0.342228 0.296088 0.753952 1.023120 0.847401 + 0.682307 1.046445 1.562969 1.421198 0.483566 -0.607791 + -0.049208 0.944598 1.588994 1.513464 1.166571 1.047943 + 1.075387 0.881568 0.389300 -0.185701 -0.035406 1.009202 + 1.709299 1.983187 1.760534 0.946370 0.064703 -0.146747 + 0.213693 0.432429 0.899565 0.992203 0.749731 0.404224 -0.167782 -1.022487 -1.668451 -1.600215 -1.044804 -0.566005 1.324994 0.901444 0.074174 -0.849109 -1.649805 -1.964304 -1.696768 -1.163499 -0.598027 -0.028493 1.430932 1.254107 diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_ordinary.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_D.grdecl similarity index 100% rename from tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_A_ordinary.grdecl rename to tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_D.grdecl diff --git a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_E_local.grdecl b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_E_local.grdecl index 2f9cbe32d..db93aca61 100644 --- a/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_E_local.grdecl +++ b/tests/jobs/localisation/example_case/init_files/FieldParam_real5_iter1_E_local.grdecl @@ -1,18 +1,18 @@ FIELDPAR - 0.437157 0.050180 -0.127435 -0.204613 -0.318212 -0.600636 - -0.871271 -0.749843 -0.396724 -0.557775 0.256235 0.152052 - -0.008926 -0.400147 -0.605545 -0.366557 -0.040599 -0.030696 - -0.348322 -0.800146 0.631912 0.343905 -0.202315 -1.144366 - -2.178977 -2.387449 -1.415918 -0.234326 0.026918 -0.525326 - 0.080141 -0.510480 -1.489360 -2.349809 -3.054813 -3.266241 - -2.492812 -1.099355 -0.157619 -0.190904 -0.323095 -0.561905 - -1.001072 -1.127593 -0.860609 -0.562412 -0.273923 0.211469 - 0.381840 0.089729 1.308131 1.124455 0.711396 0.334829 - 0.135574 -0.087394 0.257023 0.275927 0.215435 -0.279581 - 1.657705 1.572180 1.051359 0.286969 -0.521453 -0.862671 - -0.729918 -0.454728 -0.200309 -0.092174 1.322720 0.952190 - 0.151160 -0.780158 -1.649805 -1.964304 -1.696768 -1.163499 - -0.598027 -0.028493 0.846478 0.922494 0.698696 0.404224 + 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 diff --git a/tests/jobs/localisation/example_case/init_files/Polygons.txt b/tests/jobs/localisation/example_case/init_files/polygons.txt similarity index 100% rename from tests/jobs/localisation/example_case/init_files/Polygons.txt rename to tests/jobs/localisation/example_case/init_files/polygons.txt diff --git a/tests/jobs/localisation/example_case/sim_field_case_A.ert b/tests/jobs/localisation/example_case/init_files/sim_field_template.ert similarity index 57% rename from tests/jobs/localisation/example_case/sim_field_case_A.ert rename to tests/jobs/localisation/example_case/init_files/sim_field_template.ert index 12f4ae634..806bbf7c7 100644 --- a/tests/jobs/localisation/example_case/sim_field_case_A.ert +++ b/tests/jobs/localisation/example_case/init_files/sim_field_template.ert @@ -1,8 +1,8 @@ -DEFINE $USER -DEFINE sim_field_A -DEFINE randomseeds.txt +DEFINE $$USER +DEFINE ${CASE_NAME} +DEFINE ${ENSEMBLE_SEED_FILE} DEFINE /example_config.yml --- DEFINE /example_test_config_A.yml + INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD ----------------------------------------------------- -- Observations @@ -14,26 +14,26 @@ OBS_CONFIG JOBNAME sim_fields_ -NUM_REALIZATIONS 10 -- Set number of realizations to run +NUM_REALIZATIONS ${NREAL} -- Set number of realizations to run MAX_RUNTIME 18000 -- Set the maximum allowed run time (in seconds) MIN_REALIZATIONS 1 -- Success criteria MAX_SUBMIT 1 -- How many times should the queue system retry a simulation. --- QUEUE_OPTION LSF MAX_RUNNING 100 -- Choke the number of simultaneous run --- QUEUE_OPTION LSF LSF_QUEUE mr -- Assign LSF cluster queue to use + QUEUE_SYSTEM LOCAL QUEUE_OPTION LOCAL MAX_RUNNING 10 -RANDOM_SEED 123456 -- ERT seed value +RANDOM_SEED ${ERT_START_SEED} -- ERT seed value RUNPATH simulations//realization-/iter- ENSPATH output//storage -- Storage of internal ert data UPDATE_LOG_PATH output//update_log -- Info of active and inactive data points RUNPATH_FILE output//runpath_file -- List of runpaths --- LOAD_WORKFLOW localisation.wf LOCALISATION_WORKFLOW --- HOOK_WORKFLOW LOCALISATION_WORKFLOW PRE_FIRST_UPDATE +-- Activate localisation setup +${LOAD_LOCALISATION_WORKFLOW} +${HOOK_LOCALISATION_WORKFLOW} --Result data from forward model-- -GEN_DATA RESULT_UPSCALED_FIELD RESULT_FILE:UpscaledField_%d.txt REPORT_STEPS:0 INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII +GEN_DATA RESULT_UPSCALED_FIELD RESULT_FILE:${RESPONSE_FILE_PREFIX}_%d.txt REPORT_STEPS:0 INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII ----------------------------------------------------- -- Forward models @@ -44,14 +44,13 @@ FORWARD_MODEL MAKE_DIRECTORY(=init_files) FORWARD_MODEL MAKE_DIRECTORY(=) -- The common seed file FORWARD_MODEL COPY_FILE(=/, =/) --- For QC purpose only -FORWARD_MODEL COPY_FILE(=/init_files/ObsField.roff, =/init_files/ObsField.roff) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD.EGRID, =/GRID_STANDARD.EGRID) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD_UPSCALED.EGRID, =/GRID_STANDARD_UPSCALED.EGRID) + +FORWARD_MODEL MAKE_SYMLINK(=/${GRID_FILE_NAME}, =/${GRID_FILE_NAME}) +FORWARD_MODEL MAKE_SYMLINK(=/${GRID_FILE_NAME_UPSCALED}, =/${GRID_FILE_NAME_UPSCALED}) -- The main forward model simulating gaussian field with trend, and upscale FORWARD_MODEL SIM_FIELD(=, =, =, =) -GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters +GRID /${GRID_FILE_NAME} -- Necessary for AHM using field parameters -FIELD FIELDPAR PARAMETER FieldParam.roff INIT_FILES:init_files/FieldParam.roff MIN:-5.0 MAX:5.0 FORWARD_INIT:True +FIELD FIELDPAR PARAMETER ${UPDATED_FIELDPARAM_FILE_NAME} INIT_FILES:${INITIAL_FIELDPARAM_FILE_NAME} MIN:-5.0 MAX:5.0 FORWARD_INIT:True diff --git a/tests/jobs/localisation/example_case/scripts/common_functions.py b/tests/jobs/localisation/example_case/scripts/common_functions.py index 4cc7f6c45..ac15e1e70 100644 --- a/tests/jobs/localisation/example_case/scripts/common_functions.py +++ b/tests/jobs/localisation/example_case/scripts/common_functions.py @@ -9,6 +9,7 @@ import shutil from dataclasses import asdict, dataclass from pathlib import Path +from string import Template from typing import Any, Dict, Tuple import gstools as gs @@ -57,8 +58,8 @@ class Field: name: str = "FIELDPAR" algorithm: str = "gstools" file_format: str = "ROFF" - initial_file_name: str = "init_files/FieldParam" - updated_file_name: str = "FieldParam" + initial_file_name_prefix: str = "init_files/FieldParam" + updated_file_name_prefix: str = "FieldParam" seed_file: str = "randomseeds.txt" variogram: str = "gaussian" correlation_range: Tuple[float] = (250.0, 500.0, 2.0) @@ -75,8 +76,8 @@ def reset_to_default(self): self.name = "FIELDPAR" self.algorithm = "gstools" self.file_format = "ROFF" - self.initial_file_name = "init_files/FieldParam" - self.updated_file_name = "FieldParam" + self.initial_file_name_prefix = "init_files/FieldParam" + self.updated_file_name_prefix = "FieldParam" self.seed_file = "randomseeds.txt" self.variogram = "gaussian" self.correlation_range = (250.0, 500.0, 2.0) @@ -108,7 +109,9 @@ class Response: file_format: str = "ROFF" write_upscaled_field: bool = True response_function: str = "average" - gen_data_file_name: str = "UpscaledField_0.txt" + gen_data_file_prefix: str = "UpscaledField" + ert_config_template_file: str = "init_files/sim_field_template.ert" + ert_config_file: str = "sim_field.ert" def reset_to_default(self): self.name = "UPSCALED" @@ -118,7 +121,9 @@ def reset_to_default(self): self.file_format = "ROFF" self.write_upscaled_field = True self.response_function = "average" - self.gen_data_file_name = "UpscaledField_0.txt" + self.gen_data_file_prefix = "UpscaledField" + self.ert_config_template_file = "init_files/sim_field_template.ert" + self.ert_config_file = "sim_field.ert" # pylint: disable=too-many-instance-attributes @@ -164,12 +169,14 @@ class Localisation: region_polygons: str = None region_file: str = None scaling_file: str = None + use_localisation: bool = True def reset_to_default(self): self.method = "gaussian" self.region_polygons = None self.region_file = None self.scaling_file = None + self.use_localisation = True @dataclass @@ -333,8 +340,8 @@ def update_settings(settings_original: Settings, config_dict: dict): "name", "algorithm", "file_format", - "initial_file_name", - "updated_file_name", + "initial_file_name_prefix", + "updated_file_name_prefix", "seed_file", "variogram", "correlation_range", @@ -364,11 +371,11 @@ def update_settings(settings_original: Settings, config_dict: dict): field.file_format = update_key( "file_format", field.file_format, field_dict, key ) - field.initial_file_name = update_key( - "initial_file_name", field.initial_file_name, field_dict, key + field.initial_file_name_prefix = update_key( + "initial_file_name_prefix", field.initial_file_name_prefix, field_dict, key ) - field.updated_file_name = update_key( - "updated_file_name", field.updated_file_name, field_dict, key + field.updated_file_name_prefix = update_key( + "updated_file_name_prefix", field.updated_file_name_prefix, field_dict, key ) field.seed_file = update_key("seed_file", field.seed_file, field_dict, key) field.variogram = update_key("variogram", field.variogram, field_dict, key) @@ -405,7 +412,9 @@ def update_settings(settings_original: Settings, config_dict: dict): "file_format", "write_upscaled_field", "response_function", - "gen_data_file_name", + "gen_data_file_prefix", + "ert_config_template_file", + "ert_config_file", ] if response_dict: err_msg = [] @@ -438,8 +447,20 @@ def update_settings(settings_original: Settings, config_dict: dict): response.response_function = update_key( "response_function", response.response_function, response_dict, key ) - response.gen_data_file_name = update_key( - "gen_data_file_name", response.gen_data_file_name, response_dict, key + response.gen_data_file_prefix = update_key( + "gen_data_file_prefix", response.gen_data_file_prefix, response_dict, key + ) + response.ert_config_template_file = update_key( + "ert_config_template_file", + response.ert_config_template_file, + response_dict, + key, + ) + response.ert_config_file = update_key( + "ert_config_file", + response.ert_config_file, + response_dict, + key, ) key = "observation" @@ -494,7 +515,7 @@ def update_settings(settings_original: Settings, config_dict: dict): key = "localisation" local_dict = settings_dict[key] if key in settings_dict else None - valid_keys = ["method"] + valid_keys = ["method", "use_localisation"] if local_dict: err_msg = [] @@ -509,6 +530,9 @@ def update_settings(settings_original: Settings, config_dict: dict): localisation = settings.localisation localisation.method = update_key("method", localisation.method, local_dict, key) + localisation.use_localisation = update_key( + "use_localisation", localisation.use_localisation, local_dict, key + ) key = "optional" optional_dict = settings_dict[key] if key in settings_dict else None @@ -564,7 +588,7 @@ def generate_field_and_upscale( ): start_seed = get_seed(seed_file_name, real_number) if algorithm_method == "gstools": - print(f"Use algorithm: {algorithm_method}") + print(f"Use algorithm: {algorithm_method} with version: {gs.__version__} ") residual_field = simulate_field_using_gstools( start_seed, variogram_name, @@ -919,7 +943,7 @@ def export_field( ncol=nx, nrow=ny, nlay=nz, values=field3D, discrete=False, name=field_name ) if file_format.upper() == "GRDECL": - fullfilename = field_file_name + ".GRDECL" + fullfilename = field_file_name + ".grdecl" field_object.to_file( fullfilename, fformat="grdecl", dtype="float32", fmt="%20.6f" ) @@ -940,7 +964,7 @@ def read_field_from_file( """ if file_format.upper() == "GRDECL": grid = xtgeo.grid_from_file(grid_file_name, fformat="egrid") - fullfilename = input_file_name + ".GRDECL" + fullfilename = input_file_name + ".grdecl" field_object = xtgeo.grid3d.GridProperty( fullfilename, fformat="grdecl", grid=grid, name=name ) @@ -966,7 +990,7 @@ def read_obs_field_from_file( obs_field_object = xtgeo.gridproperty_from_file(fullfilename, fformat="roff") elif file_format.upper() == "GRDECL": grid = xtgeo.grid_from_file(grid_file_name, fformat="egrid") - fullfilename = pred_obs_file_name + ".GRDECL" + fullfilename = pred_obs_file_name + ".grdecl" obs_field_object = xtgeo.gridproperty_from_file( fullfilename, fformat="grdecl", grid=grid, name=field_name ) @@ -996,7 +1020,7 @@ def read_upscaled_field_from_file( field_object = xtgeo.gridproperty_from_file(fullfilename, fformat="roff") elif file_format.upper() == "GRDECL": grid = xtgeo.grid_from_file(grid_file_name, fformat="egrid") - fullfilename = filename + ".GRDECL" + fullfilename = filename + ".grdecl" field_object = xtgeo.gridproperty_from_file( fullfilename, fformat="grdecl", grid=grid, name=upscaled_field_name ) @@ -1030,7 +1054,7 @@ def write_obs_pred_diff_field( fullfilename = filename + ".roff" diff_object.to_file(fullfilename, fformat="roff") elif file_format.upper() == "GRDECL": - fullfilename = filename + ".GRDECL" + fullfilename = filename + ".grdecl" diff_object.to_file(fullfilename, fformat="grdecl") else: raise IOError(f"Unknown file format: {file_format} ") @@ -1448,7 +1472,9 @@ def generate_segments( grid_object, ): if polygon_file_name is None or not os.path.exists(polygon_file_name): - raise ValueError("Missing polygon file when creating region parameter") + raise ValueError( + f"Missing polygon file {polygon_file_name} when creating region parameter" + ) dimensions = grid_object.dimensions nx = dimensions[0] ny = dimensions[1] @@ -1478,3 +1504,368 @@ def generate_segments( print(f"Write region parameter: {region_file_name} ") region_object.to_file(region_file_name, fformat="grdecl") + + +def create_ert_config_file( + template_file_name: str, + case_name: str, + ensemble_seed_file_name: str, + nreal: int, + ert_start_seed: int, + response_file_name_prefix: str, + grid_file_name: str, + upscaled_grid_file_name: str, + initial_field_param_file_prefix: str, + updated_field_param_file_prefix: str, + field_file_format: str, + use_localisation: bool, + output_config_file_name: str = "sim_field.ert", +) -> None: + try: + with open(template_file_name, "r", encoding="utf-8") as file: + lines = file.readlines() + except IOError: + raise IOError(f"Cannot open and read file: {template_file_name}") + + load_workflow = "LOAD_WORKFLOW localisation.wf LOCALISATION_WORKFLOW" + hook_workflow = "HOOK_WORKFLOW LOCALISATION_WORKFLOW PRE_FIRST_UPDATE" + print(f"In create_ert_config_file: Localisation: {use_localisation} ") + local = "_local" if use_localisation else "" + + strings_to_replace_dict = { + "CASE_NAME": "sim_field_" + case_name + local, + "ENSEMBLE_SEED_FILE": ensemble_seed_file_name, + "NREAL": str(nreal), + "ERT_START_SEED": str(ert_start_seed), + "RESPONSE_FILE_PREFIX": response_file_name_prefix, + "GRID_FILE_NAME": grid_file_name, + "GRID_FILE_NAME_UPSCALED": upscaled_grid_file_name, + "INITIAL_FIELDPARAM_FILE_NAME": initial_field_param_file_prefix + + "." + + field_file_format.lower(), + "UPDATED_FIELDPARAM_FILE_NAME": updated_field_param_file_prefix + + "." + + field_file_format.lower(), + "LOAD_LOCALISATION_WORKFLOW": load_workflow + if use_localisation + else "-- " + load_workflow, + "HOOK_LOCALISATION_WORKFLOW": hook_workflow + if use_localisation + else "-- " + hook_workflow, + } + template_file_contents = Template("".join(lines)) + updated_contents = template_file_contents.safe_substitute(strings_to_replace_dict) + + if use_localisation: + print(f"Write ERT config file with localisation: {output_config_file_name}") + else: + print(f"Write ERT config file: {output_config_file_name}") + with open(output_config_file_name, "w", encoding="utf-8") as file: + file.write(updated_contents) + + +def initialize_case(settings): + # Create seed file + generate_seed_file(settings.field.seed_file) + + # Create grid for the field parameter + grid_object = create_grid( + settings.field.grid_file_name, + settings.field.grid_dimension, + settings.model_size.size, + settings.model_size.use_eclipse_grid_index_origo, + settings.model_size.polygon_file, + ) + + # Create coarse grid to be used in QC of upscaled field parameter + create_grid( + settings.response.grid_file_name, + settings.response.grid_dimension, + settings.model_size.size, + settings.model_size.use_eclipse_grid_index_origo, + settings.model_size.polygon_file, + ) + + print("Generate field parameter and upscale this.") + print( + f"The upscaled field {settings.observation.reference_param_file} " + "is used when extracting observations." + ) + + # Simulate field (with trend) + real_number = 0 + iteration = 0 + upscaled_values = generate_field_and_upscale( + real_number, + iteration, + settings.field.seed_file, + settings.field.algorithm, + settings.field.name, + settings.field.initial_file_name_prefix, + settings.field.file_format, + settings.field.grid_dimension, + settings.model_size.size, + settings.field.variogram, + settings.field.correlation_range, + settings.field.correlation_azimuth, + settings.field.correlation_dip, + settings.field.correlation_exponent, + settings.field.trend_use, + settings.field.trend_params, + settings.field.trend_relstd, + settings.response.name, + settings.response.response_function, + settings.response.upscaled_file_name, + settings.response.grid_dimension, + settings.response.write_upscaled_field, + settings.model_size.use_eclipse_grid_index_origo, + ) + + # Create observations by extracting from existing upscaled field + print( + "Selected grid cells having observations: " + f"{settings.observation.selected_grid_cells}" + ) + write_gen_obs( + upscaled_values, + settings.observation.directory, + settings.observation.file_name, + settings.observation.data_dir, + settings.observation.selected_grid_cells, + settings.observation.rel_error, + settings.observation.min_abs_error, + ) + + # Write upscaled field used as reference + # since obs are extracted from this field + write_upscaled_field_to_file( + upscaled_values, + settings.observation.reference_param_file, + upscaled_field_name=settings.observation.reference_field_name, + selected_cell_index_list=settings.observation.selected_grid_cells, + file_format=settings.field.file_format, + ) + + # Write file for non-adaptive localisation using distance based localisation + write_localisation_config( + settings.observation.obs_positions, + settings.observation.selected_grid_cells, + settings.field.name, + settings.field.correlation_range, + settings.field.correlation_azimuth, + config_file_name="local_config.yml", + write_scaling=True, + localisation_method=settings.localisation.method, + segment_file_name=settings.localisation.region_file, + scaling_param_file_name=settings.localisation.scaling_file, + ) + + if settings.localisation.method == "region": + generate_segments( + settings.localisation.region_polygons, + settings.localisation.region_file, + grid_object, + ) + + create_ert_config_file( + settings.response.ert_config_template_file, + settings.case_name, + settings.field.seed_file, + 10, + 123456, + settings.response.gen_data_file_prefix, + settings.field.grid_file_name, + settings.response.grid_file_name, + settings.field.initial_file_name_prefix, + settings.field.updated_file_name_prefix, + settings.field.file_format, + settings.localisation.use_localisation, + settings.response.ert_config_file, + ) + + +def example_cases(name): + """ + Define the different cases here. + They define how to modify default settings + for the varios cases to test. + """ + if name == "A": + params = { + "case_name": "A", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "observation": { + "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]], + }, + "localisation": { + "use_localisation": True, + }, + } + elif name == "B": + params = { + "case_name": "B", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "GRDECL", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "GRDECL", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "observation": { + "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]], + }, + "localisation": { + "use_localisation": True, + }, + } + elif name == "C": + params = { + "case_name": "C", + "model_size": { + "use_eclipse_grid_index_origo": False, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_RMS_ORIGO.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_RMS_ORIGO_UPSCALED.EGRID", + }, + "observation": { + "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]], + }, + "localisation": { + "use_localisation": True, + }, + } + elif name == "A2": + params = { + "case_name": "A2", + "model_size": { + "use_eclipse_grid_index_origo": True, + "polygon_file": "init_files/polygons.txt", + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_WITH_ACTNUM.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "UpscaleGrid.EGRID", + }, + "observation": { + "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]], + }, + "localisation": { + "use_localisation": True, + }, + } + elif name == "D": + params = { + "case_name": "D", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "localisation": { + "method": "constant", + "use_localisation": True, + }, + "observation": { + "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]], + }, + } + elif name == "E": + params = { + "case_name": "E", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "localisation": { + "method": "region", + "region_polygons": "init_files/region_polygons.txt", + "region_file": "regions.grdecl", + "use_localisation": True, + }, + "observation": { + "obs_positions": [[450.0, 1750.0, 25.0], [250.0, 250.0, 25.0]], + }, + } + elif name == "F": + params = { + "case_name": "F", + "model_size": { + "use_eclipse_grid_index_origo": True, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", + }, + "localisation": { + "method": "scaling_file", + "scaling_file": "init_files/scaling_factor.grdecl", + "use_localisation": True, + }, + "observation": { + "obs_positions": [[650.0, 850.0, 25.0]], + }, + } + elif name == "G": + params = { + "case_name": "G", + "model_size": { + "use_eclipse_grid_index_origo": False, + "polygon_file": None, + }, + "field": { + "file_format": "ROFF", + "grid_file_name": "GRID_RMS_ORIGO.EGRID", + }, + "response": { + "file_format": "ROFF", + "grid_file_name": "GRID_RMS_ORIGO_UPSCALED.EGRID", + }, + "localisation": { + "method": "scaling_file", + "scaling_file": "init_files/scaling_factor_rms_origo.grdecl", + "use_localisation": True, + }, + "observation": { + "obs_positions": [[650.0, 850.0, 25.0]], + }, + } + return params diff --git a/tests/jobs/localisation/example_case/scripts/init_test_case.py b/tests/jobs/localisation/example_case/scripts/init_test_case.py index e3eddda31..1bc2e074e 100755 --- a/tests/jobs/localisation/example_case/scripts/init_test_case.py +++ b/tests/jobs/localisation/example_case/scripts/init_test_case.py @@ -7,14 +7,8 @@ # pylint: disable=import-error from common_functions import ( - create_grid, - generate_field_and_upscale, - generate_seed_file, - generate_segments, + initialize_case, read_config_file, - write_gen_obs, - write_localisation_config, - write_upscaled_field_to_file, ) # pylint: disable=too-many-arguments,invalid-name,missing-function-docstring @@ -29,104 +23,16 @@ def main(config_file_name): settings = read_config_file(config_file_name) print(f"Run setup for case: {settings.case_name}") - # Create seed file - generate_seed_file(settings.field.seed_file) - - # Create grid for the field parameter - grid_object = create_grid( - settings.field.grid_file_name, - settings.field.grid_dimension, - settings.model_size.size, - settings.model_size.use_eclipse_grid_index_origo, - settings.model_size.polygon_file, - ) - - # Create coarse grid to be used in QC of upscaled field parameter - create_grid( - settings.response.grid_file_name, - settings.response.grid_dimension, - settings.model_size.size, - settings.model_size.use_eclipse_grid_index_origo, - settings.model_size.polygon_file, - ) - - print("Generate field parameter and upscale this.") - print( - f"The upscaled field {settings.observation.reference_param_file} " - "is used when extracting observations." - ) - - # Simulate field (with trend) - real_number = 0 - iteration = 0 - upscaled_values = generate_field_and_upscale( - real_number, - iteration, - settings.field.seed_file, - settings.field.algorithm, - settings.field.name, - settings.field.initial_file_name, - settings.field.file_format, - settings.field.grid_dimension, - settings.model_size.size, - settings.field.variogram, - settings.field.correlation_range, - settings.field.correlation_azimuth, - settings.field.correlation_dip, - settings.field.correlation_exponent, - settings.field.trend_use, - settings.field.trend_params, - settings.field.trend_relstd, - settings.response.name, - settings.response.response_function, - settings.response.upscaled_file_name, - settings.response.grid_dimension, - settings.response.write_upscaled_field, - settings.model_size.use_eclipse_grid_index_origo, - ) - - # Create observations by extracting from existing upscaled field - print(f"selected grid cells: {settings.observation.selected_grid_cells}") - write_gen_obs( - upscaled_values, - settings.observation.directory, - settings.observation.file_name, - settings.observation.data_dir, - settings.observation.selected_grid_cells, - settings.observation.rel_error, - settings.observation.min_abs_error, - ) - - # Write upscaled field used as reference - # since obs are extracted from this field - write_upscaled_field_to_file( - upscaled_values, - settings.observation.reference_param_file, - upscaled_field_name=settings.observation.reference_field_name, - selected_cell_index_list=settings.observation.selected_grid_cells, - file_format=settings.field.file_format, - ) - - # Write file for non-adaptive localisation using distance based localisation - write_localisation_config( - settings.observation.obs_positions, - settings.observation.selected_grid_cells, - settings.field.name, - settings.field.correlation_range, - settings.field.correlation_azimuth, - config_file_name="local_config.yml", - write_scaling=True, - localisation_method=settings.localisation.method, - segment_file_name=settings.localisation.region_file, - scaling_param_file_name=settings.localisation.scaling_file, - ) - - if settings.localisation.method == "region": - generate_segments( - settings.localisation.region_polygons, - settings.localisation.region_file, - grid_object, - ) + # Initialize the case: + # - create seed file, + # - create grids, + # - simulate one unconditioned realization, + # - calculate response, + # - extract synthetic observations from response, + # - create localisation config file, + # - create ert config file + # - prepare region parameter for case using regions + initialize_case(settings) if __name__ == "__main__": diff --git a/tests/jobs/localisation/example_case/scripts/make_reference_data.py b/tests/jobs/localisation/example_case/scripts/make_reference_data.py new file mode 100755 index 000000000..cfd701531 --- /dev/null +++ b/tests/jobs/localisation/example_case/scripts/make_reference_data.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python +""" +This script can be used to create reference data for the pytest test_full.py +It uses the same configurations, the same code and random seed and run ERT +for each case using localisation. Note that each time the reference data +(GRDECL files ofr one selected realization) need to be updated, they must +be quality checked that they are correct. Visualize them , compare runs +with and without localisation to check the differences. +""" +# pylint: disable=import-error,missing-function-docstring,redefined-outer-name + +import copy +import subprocess +import yaml +from common_functions import ( + Settings, + initialize_case, + example_cases, +) + + +def example_config(case_name, use_localisation): + settings = Settings() + settings.reset_to_default() + new_settings = example_cases(case_name) + settings.update(new_settings) + + updated_settings = copy.deepcopy(settings) + updated_settings.localisation.use_localisation = use_localisation + + # Write yml file for the sim_fields.py script + main_settings_dict = updated_settings.to_dict() + with open("example_config.yml", "w", encoding="utf-8") as file: + file.write( + yaml.safe_dump(main_settings_dict, indent=4, default_flow_style=False) + ) + return updated_settings + + +def run_case(settings, select_real=5, select_iter=1): + initialize_case(settings) + # Run case in ERT + print("Run ERT") + case_name = settings.case_name + use_localisation = settings.localisation.use_localisation + local = "_local" if use_localisation else "" + command = [ + "ert", + "ensemble_smoother", + "--target-case", + f"case_{case_name}{local}", + "sim_field.ert", + ] + subprocess.run(command, check=True) + + grid_file_name = settings.field.grid_file_name + file_format = settings.field.file_format.lower() + # Select one of the realizations for the initial and updated + # ensemble as a reference for each case. + # Convert the files to GRDECL format. If the cases have + # generated correct results, save the references + # to git as reference data for the test_full.py pytest script. + print("Convert reference file to GRDECL format") + command = [ + "cp", + f"simulations/sim_field_{case_name}{local}/" + f"realization-{select_real}/iter-0/init_files/FieldParam.{file_format}", + f"init_files/FieldParam_real{select_real}_iter0_{case_name}{local}." + f"{file_format}", + ] + subprocess.run(command, check=True) + + command = [ + "cp", + f"simulations/sim_field_{case_name}{local}/" + f"realization-{select_real}/iter-{select_iter}/FieldParam.{file_format}", + f"init_files/FieldParam_real{select_real}_iter{select_iter}_{case_name}{local}." + f"{file_format}", + ] + subprocess.run(command, check=True) + + command = [ + "./scripts/roff_to_grdecl.py", + f"init_files/FieldParam_real{select_real}_iter0_{case_name}{local}." + f"{file_format}", + f"init_files/FieldParam_real{select_real}_iter0_{case_name}{local}.grdecl", + f"{grid_file_name}", + ] + subprocess.run(command, check=True) + + command = [ + "./scripts/roff_to_grdecl.py", + f"init_files/FieldParam_real{select_real}_iter{select_iter}_{case_name}{local}." + f"{file_format}", + f"init_files/FieldParam_real{select_real}_iter{select_iter}_{case_name}{local}." + "grdecl", + f"{grid_file_name}", + ] + subprocess.run(command, check=True) + + +if __name__ == "__main__": + # Realisation number selected to be used as reference realisation + SELECT_REAL = 5 + # Use ensemble smoother + SELECT_ITER = 1 + for case_name in ["A", "B", "C", "D", "E", "F", "G", "A2"]: + print(f"Case: {case_name}") + # Make the file example_config.yml to be used in the ERT + # forward model sim_field.py + settings_with_localisation = example_config(case_name, use_localisation=True) + settings_without_localisation = example_config( + case_name, use_localisation=False + ) + + # Initialize the case: + # - create seed file, + # - create grids, + # - simulate one unconditioned realization, + # - calculate response, + # - extract synthetic observations from response, + # - create localisation config file, (local_config.yml) + # - create ert config file (sim_field.ert) + # - prepare region parameter for case using regions + + print("Run without localisation") + run_case( + settings_without_localisation, + select_real=SELECT_REAL, + select_iter=SELECT_ITER, + ) + + print("\nRun with localisation") + run_case( + settings_with_localisation, + select_real=SELECT_REAL, + select_iter=SELECT_ITER, + ) diff --git a/tests/jobs/localisation/example_case/scripts/sim_fields.py b/tests/jobs/localisation/example_case/scripts/sim_fields.py index 711e6fba1..dbdf2885b 100755 --- a/tests/jobs/localisation/example_case/scripts/sim_fields.py +++ b/tests/jobs/localisation/example_case/scripts/sim_fields.py @@ -22,11 +22,13 @@ def write_prediction_gen_data( - upscaled_values, cell_indx_list: list, response_file_name: str + upscaled_values, cell_indx_list: list, response_file_name_prefix: str ): """ Write GEN_DATA file with predicted values of observables (selected upscaled values) """ + print(response_file_name_prefix) + response_file_name = response_file_name_prefix + "_0.txt" print(f"Write GEN_DATA file with prediction of observations: {response_file_name}") with open(response_file_name, "w", encoding="utf8") as file: # NOTE: The sequence of values must be the same as for the observations @@ -125,7 +127,7 @@ def main(args): os.path.join(config_path, settings.field.seed_file), settings.field.algorithm, settings.field.name, - settings.field.initial_file_name, + settings.field.initial_file_name_prefix, settings.field.file_format, settings.field.grid_dimension, settings.model_size.size, @@ -148,7 +150,7 @@ def main(args): else: print(f"Import updated field parameter realization: {real_number} ") field_object = read_field_from_file( - settings.field.updated_file_name, + settings.field.updated_file_name_prefix, settings.field.name, settings.field.file_format, settings.field.grid_file_name, @@ -170,7 +172,7 @@ def main(args): write_prediction_gen_data( upscaled_values, settings.observation.selected_grid_cells, - settings.response.gen_data_file_name, + settings.response.gen_data_file_prefix, ) # Optional output calculate difference between upscaled field and diff --git a/tests/jobs/localisation/example_case/sim_field_local_case_A.ert b/tests/jobs/localisation/example_case/sim_field_local_case_A.ert deleted file mode 100644 index 5508d09cb..000000000 --- a/tests/jobs/localisation/example_case/sim_field_local_case_A.ert +++ /dev/null @@ -1,57 +0,0 @@ -DEFINE $USER -DEFINE sim_field_local_A -DEFINE randomseeds.txt -DEFINE /example_config.yml --- DEFINE /example_test_config_A.yml -INSTALL_JOB SIM_FIELD scripts/FM_SIM_FIELD ------------------------------------------------------ --- Observations ------------------------------------------------------ - -DEFINE /observations/observations.obs -OBS_CONFIG - -JOBNAME sim_fields_ - - -NUM_REALIZATIONS 10 -- Set number of realizations to run -MAX_RUNTIME 18000 -- Set the maximum allowed run time (in seconds) -MIN_REALIZATIONS 1 -- Success criteria -MAX_SUBMIT 1 -- How many times should the queue system retry a simulation. --- QUEUE_OPTION LSF MAX_RUNNING 100 -- Choke the number of simultaneous run --- QUEUE_OPTION LSF LSF_QUEUE mr -- Assign LSF cluster queue to use -QUEUE_SYSTEM LOCAL -QUEUE_OPTION LOCAL MAX_RUNNING 10 -RANDOM_SEED 123456 -- ERT seed value - -RUNPATH simulations//realization-/iter- -ENSPATH output//storage -- Storage of internal ert data -UPDATE_LOG_PATH output//update_log -- Info of active and inactive data points -RUNPATH_FILE output//runpath_file -- List of runpaths - -LOAD_WORKFLOW localisation.wf LOCALISATION_WORKFLOW -HOOK_WORKFLOW LOCALISATION_WORKFLOW PRE_FIRST_UPDATE - ---Result data from forward model-- -GEN_DATA RESULT_UPSCALED_FIELD RESULT_FILE:UpscaledField_%d.txt REPORT_STEPS:0 INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII - ------------------------------------------------------ --- Forward models ------------------------------------------------------ ---Simulate Gaussian field with trend and calculate upscaled values. Observables are upscaled values of selected grid cells. -FORWARD_MODEL MAKE_DIRECTORY(=init_files) --- Is used to identify iteration number (only relevant for old komodo versions) -FORWARD_MODEL MAKE_DIRECTORY(=) --- The common seed file -FORWARD_MODEL COPY_FILE(=/, =/) --- For QC purpose only -FORWARD_MODEL COPY_FILE(=/init_files/ObsField.roff, =/init_files/ObsField.roff) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD.EGRID, =/GRID_STANDARD.EGRID) -FORWARD_MODEL MAKE_SYMLINK(=/GRID_STANDARD_UPSCALED.EGRID, =/GRID_STANDARD_UPSCALED.EGRID) - --- The main forward model simulating gaussian field with trend, and upscale -FORWARD_MODEL SIM_FIELD(=, =, =, =) - -GRID /GRID_STANDARD.EGRID -- Necessary for AHM using field parameters - -FIELD FIELDPAR PARAMETER FieldParam.roff INIT_FILES:init_files/FieldParam.roff MIN:-5.0 MAX:5.0 FORWARD_INIT:True diff --git a/tests/jobs/localisation/example_case/test_full.py b/tests/jobs/localisation/example_case/test_full.py index 026c0a111..64980844d 100644 --- a/tests/jobs/localisation/example_case/test_full.py +++ b/tests/jobs/localisation/example_case/test_full.py @@ -37,15 +37,11 @@ from ert.cli.main import run_cli from ert.shared.plugins.plugin_manager import ErtPluginContext from ert.storage import open_storage + from scripts.common_functions import ( Settings, - create_grid, - generate_field_and_upscale, - generate_seed_file, - generate_segments, - write_gen_obs, - write_localisation_config, - write_upscaled_field_to_file, + initialize_case, + example_cases, ) # pylint: disable=invalid-name @@ -58,174 +54,14 @@ @pytest.mark.parametrize( "new_settings", [ - pytest.param( - { - "case_name": "A", - "model_size": { - "use_eclipse_grid_index_origo": True, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", - }, - "observation": { - "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "B", - "model_size": { - "use_eclipse_grid_index_origo": True, - }, - "field": { - "file_format": "GRDECL", - "grid_file_name": "GRID_STANDARD.EGRID", - }, - "response": { - "file_format": "GRDECL", - "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", - }, - "observation": { - "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "C", - "model_size": { - "use_eclipse_grid_index_origo": False, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_RMS_ORIGO.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_RMS_ORIGO_UPSCALED.EGRID", - }, - "observation": { - "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "A2", - "model_size": { - "use_eclipse_grid_index_origo": True, - "polygon_file": "Polygons.txt", - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_WITH_ACTNUM.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "UpscaleGrid.EGRID", - }, - "observation": { - "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "D", - "model_size": { - "use_eclipse_grid_index_origo": True, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", - }, - "localisation": { - "method": "constant", - }, - "observation": { - "obs_positions": [[750.0, 750.0, 25.0], [250.0, 1750.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "E", - "model_size": { - "use_eclipse_grid_index_origo": True, - "polygon_file": None, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", - }, - "localisation": { - "method": "region", - "region_polygons": "region_polygons.txt", - "region_file": "regions.grdecl", - }, - "observation": { - "obs_positions": [[450.0, 1750.0, 25.0], [250.0, 250.0, 25.0]] - }, - } - ), - pytest.param( - { - "case_name": "F", - "model_size": { - "use_eclipse_grid_index_origo": True, - "polygon_file": None, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_STANDARD_UPSCALED.EGRID", - }, - "localisation": { - "method": "scaling_file", - "scaling_file": "scaling_factor.grdecl", - }, - "observation": {"obs_positions": [[650.0, 850.0, 25.0]]}, - } - ), - pytest.param( - { - "case_name": "G", - "model_size": { - "use_eclipse_grid_index_origo": False, - "polygon_file": None, - }, - "field": { - "file_format": "ROFF", - "grid_file_name": "GRID_RMS_ORIGO.EGRID", - }, - "response": { - "file_format": "ROFF", - "grid_file_name": "GRID_RMS_ORIGO_UPSCALED.EGRID", - }, - "localisation": { - "method": "scaling_file", - "scaling_file": "scaling_factor_rms_origo.grdecl", - }, - "observation": {"obs_positions": [[650.0, 850.0, 25.0]]}, - } - ), + pytest.param(example_cases("A")), + pytest.param(example_cases("B")), + pytest.param(example_cases("C")), + pytest.param(example_cases("A2")), + pytest.param(example_cases("D")), + pytest.param(example_cases("E")), + pytest.param(example_cases("F")), + pytest.param(example_cases("G")), ], ) # pylint: disable=too-many-branches @@ -245,189 +81,94 @@ def test_that_localization_works_with_different_settings( yaml.safe_dump(main_settings_dict, indent=4, default_flow_style=False) ) - generate_seed_file(settings.field.seed_file) + (tmp_path / "init_files").mkdir() + (tmp_path / "reference_files").mkdir() - # Make available data to generate grid + # Make available data to generate grid, region parameters and scaling factor polygon_file = None if settings.case_name == "A2": - polygon_file = "Polygons.txt" + polygon_file = "init_files/polygons.txt" shutil.copy( - Path(__file__).parent / "init_files" / settings.model_size.polygon_file, + Path(__file__).parent / settings.model_size.polygon_file, polygon_file, ) if settings.case_name == "E": - region_polygon_file = "region_polygons.txt" + region_polygon_file = "init_files/region_polygons.txt" shutil.copy( - Path(__file__).parent - / "init_files" - / settings.localisation.region_polygons, + Path(__file__).parent / settings.localisation.region_polygons, region_polygon_file, ) if settings.case_name == "F": - scaling_factor_param_file = "scaling_factor.grdecl" + scaling_factor_param_file = "init_files/scaling_factor.grdecl" shutil.copy( - Path(__file__).parent / "init_files" / settings.localisation.scaling_file, + Path(__file__).parent / settings.localisation.scaling_file, scaling_factor_param_file, ) if settings.case_name == "G": - scaling_factor_param_file = "scaling_factor_rms_origo.grdecl" + scaling_factor_param_file = "init_files/scaling_factor_rms_origo.grdecl" shutil.copy( - Path(__file__).parent / "init_files" / settings.localisation.scaling_file, + Path(__file__).parent / settings.localisation.scaling_file, scaling_factor_param_file, ) - # Create grid for the field parameter - grid_object = create_grid( - settings.field.grid_file_name, - settings.field.grid_dimension, - settings.model_size.size, - settings.model_size.use_eclipse_grid_index_origo, - polygon_file, - ) - print(settings.localisation) - if settings.localisation.method == "region": - generate_segments( - region_polygon_file, - settings.localisation.region_file, - grid_object, - ) - - # Create coarse grid to be used in QC of upscaled field parameter - create_grid( - settings.response.grid_file_name, - settings.response.grid_dimension, - settings.model_size.size, - settings.model_size.use_eclipse_grid_index_origo, - polygon_file, - ) - - print("Create observations:") - print(" - Generate field parameter") - print(" - Upscale") - print(" - Extract observations") - - (tmp_path / "init_files").mkdir() - - # Simulate field (with trend) - real_number = 0 - iteration = 0 - upscaled_values = generate_field_and_upscale( - real_number, - iteration, - settings.field.seed_file, - settings.field.algorithm, - settings.field.name, - settings.field.initial_file_name, - settings.field.file_format, - settings.field.grid_dimension, - settings.model_size.size, - settings.field.variogram, - settings.field.correlation_range, - settings.field.correlation_azimuth, - settings.field.correlation_dip, - settings.field.correlation_exponent, - settings.field.trend_use, - settings.field.trend_params, - settings.field.trend_relstd, - settings.response.name, - settings.response.response_function, - settings.response.upscaled_file_name, - settings.response.grid_dimension, - settings.response.write_upscaled_field, - settings.model_size.use_eclipse_grid_index_origo, - ) - - # Create observations by extracting from existing upscaled field - write_gen_obs( - upscaled_values, - settings.observation.directory, - settings.observation.file_name, - settings.observation.data_dir, - settings.observation.selected_grid_cells, - settings.observation.rel_error, - settings.observation.min_abs_error, - ) - - # Write upscaled field used as reference - # since obs are extracted from this field - write_upscaled_field_to_file( - upscaled_values, - settings.observation.reference_param_file, - upscaled_field_name=settings.observation.reference_field_name, - selected_cell_index_list=settings.observation.selected_grid_cells, - file_format=settings.field.file_format, + # Make ERT template file available + ert_config_template_file = "init_files/sim_field_template.ert" + shutil.copy( + Path(__file__).parent / settings.response.ert_config_template_file, + ert_config_template_file, ) - # Write file for non-adaptive localisation using distance based localisation - write_localisation_config( - settings.observation.obs_positions, - settings.observation.selected_grid_cells, - settings.field.name, - settings.field.correlation_range, - settings.field.correlation_azimuth, - config_file_name="local_config.yml", - write_scaling=True, - localisation_method=settings.localisation.method, - segment_file_name=settings.localisation.region_file, - scaling_param_file_name=settings.localisation.scaling_file, - ) + initialize_case(settings) parser = ArgumentParser(prog="test_main") if settings.case_name == "A": - ert_config_file = "sim_field_local_case_A.ert" reference_file_initial = "FieldParam_real5_iter0_A_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_A_local.grdecl" grid_file_name = "GRID_STANDARD.EGRID" elif settings.case_name == "B": - ert_config_file = "sim_field_local_case_B.ert" reference_file_initial = "FieldParam_real5_iter0_A_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_A_local.grdecl" grid_file_name = "GRID_STANDARD.EGRID" elif settings.case_name == "C": - ert_config_file = "sim_field_local_case_C.ert" reference_file_initial = "FieldParam_real5_iter0_C_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_C_local.grdecl" grid_file_name = "GRID_RMS_ORIGO.EGRID" elif settings.case_name == "A2": - ert_config_file = "sim_field_local_case_A_with_actnum.ert" - reference_file_initial = "FieldParam_real5_iter0_A_with_actnum_local.grdecl" - reference_file_updated = "FieldParam_real5_iter1_A_with_actnum_local.grdecl" + reference_file_initial = "FieldParam_real5_iter0_A2_local.grdecl" + reference_file_updated = "FieldParam_real5_iter1_A2_local.grdecl" grid_file_name = "GRID_WITH_ACTNUM.EGRID" elif settings.case_name == "D": # Scaling factor =1 and one correlation group # The result should be identical to not running localisation like # case A without localisation - ert_config_file = "sim_field_local_case_D.ert" - reference_file_initial = "FieldParam_real5_iter0_A_ordinary.grdecl" - reference_file_updated = "FieldParam_real5_iter1_A_ordinary.grdecl" + reference_file_initial = "FieldParam_real5_iter0_D.grdecl" + reference_file_updated = "FieldParam_real5_iter1_D.grdecl" grid_file_name = "GRID_STANDARD.EGRID" elif settings.case_name == "E": - ert_config_file = "sim_field_local_case_E.ert" reference_file_initial = "FieldParam_real5_iter0_E_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_E_local.grdecl" grid_file_name = "GRID_STANDARD.EGRID" elif settings.case_name == "F": - ert_config_file = "sim_field_local_case_F.ert" reference_file_initial = "FieldParam_real5_iter0_F_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_F_local.grdecl" grid_file_name = "GRID_STANDARD.EGRID" elif settings.case_name == "G": - ert_config_file = "sim_field_local_case_G.ert" reference_file_initial = "FieldParam_real5_iter0_G_local.grdecl" reference_file_updated = "FieldParam_real5_iter1_G_local.grdecl" grid_file_name = "GRID_RMS_ORIGO.EGRID" - shutil.copy(Path(__file__).parent / ert_config_file, ert_config_file) + reference_path_initial = "reference_files/" + reference_file_initial + reference_path_updated = "reference_files/" + reference_file_updated shutil.copy( Path(__file__).parent / "init_files" / reference_file_initial, - reference_file_initial, + reference_path_initial, ) shutil.copy( Path(__file__).parent / "init_files" / reference_file_updated, - reference_file_updated, + reference_path_updated, ) shutil.copy(Path(__file__).parent / "localisation.wf", "localisation.wf") Path("scripts").mkdir(parents=True, exist_ok=True) @@ -441,7 +182,7 @@ def test_that_localization_works_with_different_settings( Path(__file__).parent / "scripts" / "common_functions.py", "scripts/common_functions.py", ) - + ert_config_file = settings.response.ert_config_file parsed = ert_parser( parser, [ @@ -460,14 +201,14 @@ def test_that_localization_works_with_different_settings( grid_file = xtgeo.grid_from_file(grid_file_name, fformat="egrid") es_prior_expected = xtgeo.gridproperty_from_file( - reference_file_initial, + reference_path_initial, fformat="grdecl", name="FIELDPAR", grid=grid_file, ) es_prior_expected.mask_undef() es_posterior_expected = xtgeo.gridproperty_from_file( - reference_file_updated, + reference_path_updated, fformat="grdecl", name="FIELDPAR", grid=grid_file, @@ -486,6 +227,7 @@ def test_that_localization_works_with_different_settings( realizations=realization ) + # Write to file for easier QC of differences es_prior_from_storage = xtgeo.GridProperty( ncol=dims[0], nrow=dims[1], @@ -496,6 +238,7 @@ def test_that_localization_works_with_different_settings( es_prior_from_storage.mask_undef() es_prior_from_storage.to_file("prior_storage.roff", fformat="roff") + # Write to file for easier QC of differences es_posterior_from_storage = xtgeo.GridProperty( ncol=dims[0], nrow=dims[1], @@ -506,6 +249,7 @@ def test_that_localization_works_with_different_settings( 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),