-
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.
- Loading branch information
Showing
11 changed files
with
538 additions
and
233 deletions.
There are no files selected for viewing
37 changes: 26 additions & 11 deletions
37
...iz_subsurface/_abbreviations/abbreviation_data/reservoir_simulation_unit_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,17 +1,32 @@ | ||
{ | ||
"METRIC": | ||
{ | ||
"SM3": "Sm³", | ||
"METRIC": { | ||
"M": "m", | ||
"M3": "m³", | ||
"RM3": "m³", | ||
"SECONDS": "seconds", | ||
"DAYS": "days", | ||
"YEARS": "years", | ||
"KG/M3": "kg/m³", | ||
"BARSA": "bara", | ||
"bars": "bar", | ||
"K": "K", | ||
"C": "\u00B0C", | ||
"CP": "cP", | ||
"MD": "mD", | ||
"SM3": "Sm³", | ||
"RM3": "Rm³", | ||
"SM3/DAY": "Sm³/day", | ||
"RM3/DAY": "m³/day", | ||
"RM3/DAY": "Rm³/day", | ||
"CPR3/DAY/BARS": "Rm³\u00D7cP/day/bar", | ||
"MDM": "mD\u00D7m", | ||
"KG": "kg", | ||
"KG/DAY": "kg/day", | ||
"SM3/SM3": "Sm³/Sm³", | ||
"RM3/SM3": "m³/Sm³", | ||
"BARSA": "bara", | ||
"BARS": "barg", | ||
"RM3/SM3": "Rm³/Sm³", | ||
"SM3/RM3": "Sm³/Rm³", | ||
"SM3/DAY/BARS": "Sm³/day/bar", | ||
"SM3/D/B": "Sm³/day/bar", | ||
"SECONDS": "s", | ||
"DAYS": "days" | ||
} | ||
"KJ": "kJ", | ||
"KJ/DAY": "kJ/day", | ||
"SEC/D": "seconds/day" | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import warnings | ||
from typing import Optional | ||
|
||
import pandas as pd | ||
|
||
|
||
def set_simulation_line_shape_fallback(line_shape_fallback: str) -> str: | ||
""" | ||
Defines a Plotly line_shape to use if a vector is not thought to be a rate or a total. | ||
""" | ||
line_shape_fallback = line_shape_fallback.lower() | ||
if line_shape_fallback in ("backfilled", "backfill"): | ||
return "vh" | ||
if line_shape_fallback in ["hv", "vh", "hvh", "vhv", "spline", "linear"]: | ||
return line_shape_fallback | ||
warnings.warn( | ||
f"{line_shape_fallback}, is not a valid line_shape option, will use linear." | ||
) | ||
return "linear" | ||
|
||
|
||
def get_simulation_line_shape( | ||
line_shape_fallback: str, vector: str, smry_meta: Optional[pd.DataFrame] = None | ||
) -> str: | ||
"""Get simulation time series line shape, smry_meta is a pd.DataFrame on the format given | ||
by `load_smry_meta` in `../_datainput/fmu_input.py`. | ||
""" | ||
|
||
if smry_meta is None: | ||
return line_shape_fallback | ||
try: | ||
if smry_meta.is_rate[vector]: | ||
return "vh" | ||
if smry_meta.is_total[vector]: | ||
return "linear" | ||
except (AttributeError, KeyError): | ||
pass | ||
return line_shape_fallback |
Oops, something went wrong.