Skip to content

Commit

Permalink
Update docs and error message (#116)
Browse files Browse the repository at this point in the history
* Print all missing ERT env vars at once when missing

* Remove unused options argument from docs

* Properly check if missing env var list is empty

* Fix typo
  • Loading branch information
equinor-ruaj authored Nov 27, 2024
1 parent 5b3c716 commit fd86eeb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/sim2sumo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Custom configuration
=====================

The sim2sumo section in the config file gives you full flexibility for extracting anything that ``res2df`` can extract.
You can also change where you extract results from, and even use all the extra custumization options that ``res2df`` has available.
You can also change where you extract results from, and use some of the extra customization options that ``res2df`` has available.
The three relevant sections are:

datafile
Expand Down
14 changes: 7 additions & 7 deletions src/fmu/sumo/sim2sumo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ def main():
"""Main function to be called"""
logger = logging.getLogger(__file__ + ".main")

missing = 0
missing = []
for envVar in REQUIRED_ENV_VARS:
if environ.get(envVar) is None:
print(f"Required environment variable {envVar} is not set.")
missing += 1
if envVar not in environ:
missing.append(envVar)

if missing > 0:
if missing:
print(
"Required ERT environment variables not found. "
"This can happen if sim2sumo was called outside the ERT context. "
"Required ERT environment variables not found:"
f"{', '.join(missing)}.\n"
"This can happen if sim2sumo was called outside the ERT context.\n"
"Stopping."
)
exit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,4 @@ sim2sumo:
- summary
- grid
- rft
options:
arrow: false
time_index: daily,
start_date: 2002-01-02
end_date: 2003-01-02
grid3d: false
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ sim2sumo:
- summary
- grid
- rft
options:
arrow: false
time_index: daily,
start_date: 2002-01-02
end_date: 2003-01-02

0 comments on commit fd86eeb

Please sign in to comment.