Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed input file paths in template for rms script to be generated #747

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/subscript/field_statistics/field_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]

Expand Down
12 changes: 2 additions & 10 deletions tests/test_field_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down