diff --git a/src/subscript/field_statistics/field_statistics.py b/src/subscript/field_statistics/field_statistics.py index 1d4952517..5b6bfa324 100644 --- a/src/subscript/field_statistics/field_statistics.py +++ b/src/subscript/field_statistics/field_statistics.py @@ -952,11 +952,11 @@ def generate_script( ERT_CONFIG_PATH = "{ert_config_path}" GLOBAL_VARIABLES_FILE = \ - ERT_CONFIG_PATH / Path("../../fmuconfig/output/global_variables.yml") + Path(ERT_CONFIG_PATH) / Path("../../fmuconfig/output/global_variables.yml") -FIELD_STAT_CONFIG_FILE = "{field_stat_config_file}" +FIELD_STAT_CONFIG_FILE = Path(ERT_CONFIG_PATH) / Path("{field_stat_config_file}") -RESULT_PATH = "{result_path}" +RESULT_PATH = Path("{result_path}") LABEL = "drogon" @@ -981,7 +981,10 @@ def main(): zone_code_names = field_stat["zone_code_names"] facies_per_zone = get_facies_per_zone(GLOBAL_VARIABLES_FILE) result_path = RESULT_PATH - zone_list= list(zone_code_names.values()) + if "use_zones" in field_stat: + zone_list= field_stat["use_zones"] + else: + zone_list= list(zone_code_names.values()) stat_list= ["mean", "stdev"] iter_list = field_stat["iterations"] diff --git a/tests/test_field_statistics.py b/tests/test_field_statistics.py index d073b2fae..91a14d181 100644 --- a/tests/test_field_statistics.py +++ b/tests/test_field_statistics.py @@ -881,7 +881,6 @@ def test_get_specification( ) def test_main(tmp_path, config_file, config_dict, print_info=True): import subprocess - import sys # First make an ensemble to be used as testdata. This is based on the config_dict _, ens_path, result_path, ert_config_path, _ = make_test_case(tmp_path, config_dict) @@ -892,18 +891,11 @@ def test_main(tmp_path, config_file, config_dict, print_info=True): result_path = ens_path / RESULT_PATH rms_load_script = result_path / RMS_LOAD_SCRIPT_NAME + # Run the main script as a subprocess - script_name = Path(__file__).absolute().parent.parent / Path( - "src/subscript/field_statistics/field_statistics.py" - ) - if print_info: - print(f"\nRun script: {script_name}") - remove_file_path = result_path / Path("ertbox--*.roff") - subprocess.run(["rm", "-f", remove_file_path]) subprocess.run( [ - sys.executable, - script_name.as_posix(), + "field_statistics", "-c", config_path.as_posix(), "-p",