-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid assuming inplace units + support descriptions of any column.
- Loading branch information
Showing
5 changed files
with
199 additions
and
111 deletions.
There are no files selected for viewing
97 changes: 72 additions & 25 deletions
97
webviz_subsurface/_abbreviations/abbreviation_data/volume_terminology.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,74 @@ | ||
{ | ||
"BULK_OIL": {"label": "Bulk volume (oil zone)", "unit": "m³"}, | ||
"BULK_GAS": {"label": "Bulk volume (gas zone)", "unit": "m³"}, | ||
"BULK_TOTAL": {"label": "Bulk volume (total)", "unit": "m³"}, | ||
"NET_OIL": {"label": "Net volume (oil zone)", "unit": "m³"}, | ||
"NET_GAS": {"label": "Net volume (gas zone)", "unit": "m³"}, | ||
"NET_TOTAL": {"label": "Net volume (total)", "unit": "m³"}, | ||
"PORV_OIL": {"label": "Pore volume (oil zone)", "unit": "m³"}, | ||
"PORV_GAS": {"label": "Pore volume (gas zone)", "unit": "m³"}, | ||
"PORV_TOTAL": {"label": "Pore volume (total)", "unit": "m³"}, | ||
"PORE_OIL": {"label": "Pore volume (oil zone)", "unit": "m³"}, | ||
"PORE_GAS": {"label": "Pore volume (gas zone)", "unit": "m³"}, | ||
"PORE_TOTAL": {"label": "Pore volume (total)", "unit": "m³"}, | ||
"HCPV_OIL": {"label": "Hydro carbon pore volume (oil zone)", "unit": "m³"}, | ||
"HCPV_GAS": {"label": "Hydro carbon pore volume (gas zone)", "unit": "m³"}, | ||
"HCPV_TOTAL": {"label": "Hydro carbon pore volume (total zone)", "unit": "m³"}, | ||
"STOIIP_OIL": {"label": "Stock tank oil initially in place (oil zone)", "unit": "Sm³", "eclsum": ["FOIPL", "ROIPL"]}, | ||
"STOIIP_GAS": {"label": "Stock tank oil initially in place (gas zone)", "unit": "Sm³", "eclsum": ["FOIPG", "ROIPG"]}, | ||
"STOIIP_TOTAL": {"label": "Stock tank oil initially in place (total)", "unit": "Sm³", "eclsum": ["FOIP", "ROIP"]}, | ||
"GIIP_OIL": {"label": "Gas initially in place (oil zone)", "unit": "Sm³", "eclsum": ["FGIPL", "RGIPL"]}, | ||
"GIIP_GAS": {"label": "Gas initially in place (gas zone)", "unit": "Sm³", "eclsum": ["FGIPG", "RGIPG"]}, | ||
"GIIP_TOTAL": {"label": "Gas initially in place (total)", "unit": "Sm³", "eclsum": ["FGIP", "RGIP"]}, | ||
"RECOVERABLE_OIL": {"label": "Recoverable volume (oil zone)", "unit": "Sm³"}, | ||
"RECOVERABLE_GAS": {"label": "Recoverable volume (gas zone)", "unit": "Sm³"}, | ||
"RECOVERABLE_TOTAL": {"label": "Recoverable volume (total)", "unit": "Sm³"} | ||
"BULK_OIL": { | ||
"description": "Bulk volume (oil zone)" | ||
}, | ||
"BULK_GAS": { | ||
"description": "Bulk volume (gas zone)" | ||
}, | ||
"BULK_TOTAL": { | ||
"description": "Bulk volume (total)" | ||
}, | ||
"NET_OIL": { | ||
"description": "Net volume (oil zone)" | ||
}, | ||
"NET_GAS": { | ||
"description": "Net volume (gas zone)" | ||
}, | ||
"NET_TOTAL": { | ||
"description": "Net volume (total)" | ||
}, | ||
"PORV_OIL": { | ||
"description": "Pore volume (oil zone)" | ||
}, | ||
"PORV_GAS": { | ||
"description": "Pore volume (gas zone)" | ||
}, | ||
"PORV_TOTAL": { | ||
"description": "Pore volume (total)" | ||
}, | ||
"PORE_OIL": { | ||
"description": "Pore volume (oil zone)" | ||
}, | ||
"PORE_GAS": { | ||
"description": "Pore volume (gas zone)" | ||
}, | ||
"PORE_TOTAL": { | ||
"description": "Pore volume (total)" | ||
}, | ||
"HCPV_OIL": { | ||
"description": "Hydro carbon pore volume (oil zone)" | ||
}, | ||
"HCPV_GAS": { | ||
"description": "Hydro carbon pore volume (gas zone)" | ||
}, | ||
"HCPV_TOTAL": { | ||
"description": "Hydro carbon pore volume (total zone)" | ||
}, | ||
"STOIIP_OIL": { | ||
"description": "Stock tank oil initially in place (oil zone)" | ||
}, | ||
"STOIIP_GAS": { | ||
"description": "Stock tank oil initially in place (gas zone)" | ||
}, | ||
"STOIIP_TOTAL": { | ||
"description": "Stock tank oil initially in place (total)" | ||
}, | ||
"GIIP_OIL": { | ||
"description": "Gas initially in place (oil zone)" | ||
}, | ||
"GIIP_GAS": { | ||
"description": "Gas initially in place (gas zone)" | ||
}, | ||
"GIIP_TOTAL": { | ||
"description": "Gas initially in place (total)" | ||
}, | ||
"RECOVERABLE_OIL": { | ||
"description": "Recoverable volume (oil zone)" | ||
}, | ||
"RECOVERABLE_GAS": { | ||
"description": "Recoverable volume (gas zone)" | ||
}, | ||
"RECOVERABLE_TOTAL": { | ||
"description": "Recoverable volume (total)" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import json | ||
import pathlib | ||
|
||
from typing import Optional | ||
|
||
_DATA_PATH = pathlib.Path(__file__).parent.absolute() / "abbreviation_data" | ||
|
||
VOLUME_TERMINOLOGY = json.loads((_DATA_PATH / "volume_terminology.json").read_text()) | ||
|
||
|
||
def volume_description(column: str): | ||
def volume_description(column: str, metadata: Optional[dict] = None): | ||
"""Return description for the column if defined""" | ||
if metadata is not None: | ||
try: | ||
return metadata[column]["description"] | ||
except KeyError: | ||
pass | ||
try: | ||
label = VOLUME_TERMINOLOGY[column]["label"] | ||
description = VOLUME_TERMINOLOGY[column]["description"] | ||
except KeyError: | ||
label = column | ||
return label | ||
description = column | ||
return description | ||
|
||
|
||
def volume_unit(column: str): | ||
def volume_unit(column: str, metadata: Optional[dict] = None): | ||
"""Return unit for the column if defined""" | ||
try: | ||
unit = VOLUME_TERMINOLOGY[column]["unit"] | ||
except KeyError: | ||
unit = "" | ||
return unit | ||
if metadata is not None: | ||
try: | ||
return metadata[column]["unit"] | ||
except KeyError: | ||
pass | ||
return "" | ||
|
||
|
||
def volume_simulation_vector_match(column: str): | ||
"""Return a list of simulation vectors that match the column | ||
Useful to verify/propose data to compare. | ||
""" | ||
try: | ||
vectors = VOLUME_TERMINOLOGY[column]["eclsum"] | ||
except KeyError: | ||
vectors = [] | ||
return vectors if isinstance(vectors, list) else [vectors] | ||
def column_title(response: str, metadata: dict): | ||
unit = volume_unit(response, metadata) | ||
return f"{volume_description(response, metadata)}" + (f" [{unit}]" if unit else "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.