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

Convert to absolute paths if neccessary #80

Merged
merged 8 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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
10 changes: 10 additions & 0 deletions src/flownet/config_parser/_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ def _to_abs_path(path: Optional[str]) -> str:
"""
if path is None:
return ""
if pathlib.Path(path).is_absolute():
return str(pathlib.Path(path).resolve())
return str((configuration_file.parent / pathlib.Path(path)).resolve())

suite = ConfigSuite(
Expand Down Expand Up @@ -543,4 +545,12 @@ def _to_abs_path(path: Optional[str]) -> str:
"GOC and gas relative permeability must both be specified (or none of them)."
)

for suffix in [".DATA", ".EGRID", ".UNRST", ".UNSMRY", ".SMSPEC"]:
if (
not pathlib.Path(config.flownet.data_source.eclipse_case)
.with_suffix(suffix)
.is_file()
):
raise ValueError(f"The ECLIPSE {suffix} file does not exist")

return config
4 changes: 4 additions & 0 deletions src/flownet/config_parser/_config_parser_pred.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def _to_abs_path(path: str) -> str:
Absolute path

"""
if path is None:
return ""
if pathlib.Path(path).is_absolute():
return str(pathlib.Path(path).resolve())
return str((configuration_file.parent / pathlib.Path(path)).resolve())

suite = ConfigSuite(
Expand Down