Skip to content

Commit

Permalink
Add readable summary vector names (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Dec 20, 2019
1 parent 76deaa4 commit e65173a
Show file tree
Hide file tree
Showing 5 changed files with 1,730 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ disable = bad-continuation, missing-docstring, duplicate-code

max-args = 8
max-branches = 14
max-attributes = 14
max-attributes = 15
min-public-methods = 1

[BASIC]
Expand Down
25 changes: 25 additions & 0 deletions webviz_subsurface/_abbreviations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
import json
import pathlib
import warnings

_MODULE_PATH = pathlib.Path(__file__).parent.absolute()

VOLUME_TERMINOLOGY = json.loads((_MODULE_PATH / "volume_terminology.json").read_text())
SIMULATION_VECTOR_TERMINOLOGY = json.loads(
(_MODULE_PATH / "reservoir_simulation_vectors.json").read_text()
)


def simulation_vector_description(vector):
[vector_name, node] = vector.split(":") if ":" in vector else [vector, None]

if vector_name in SIMULATION_VECTOR_TERMINOLOGY:
metadata = SIMULATION_VECTOR_TERMINOLOGY[vector_name]
description = metadata["description"]
if node is not None:
description += f", {metadata['type'].replace('_', ' ')} {node}"
else:
description = vector_name
warnings.warn(
(
f"Could not find description for vector {vector_name}. Consider adding"
" it in the GitHub repo https://github.com/equinor/webviz-subsurface?"
),
UserWarning,
)

return description
Loading

0 comments on commit e65173a

Please sign in to comment.