Skip to content

Commit

Permalink
Fix Pvt sorting issue (#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
asnyv committed May 23, 2023
1 parent 7358fb3 commit 1b1bb17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions webviz_subsurface/_datainput/pvt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ def filter_pvt_data_frame(
"The dataframe must contain a column for the ratio (OGR, GOR, R, RV, RS)."
)
if not "VOLUMEFACTOR_UNIT" in data_frame.columns:
data_frame["VOLUMEFACTOR_UNIT"] = "rm³/sm³"
data_frame["VOLUMEFACTOR_UNIT"] = "Rm³/Sm³"
if not "PRESSURE_UNIT" in data_frame.columns:
data_frame["PRESSURE_UNIT"] = "bar"
if not "VISCOSITY_UNIT" in data_frame.columns:
data_frame["VISCOSITY_UNIT"] = "cP"
if not "DENSITY_UNIT" in data_frame.columns:
data_frame["DENSITY_UNIT"] = "kg/m³"
if not "RATIO_UNIT" in data_frame.columns:
data_frame["RATIO_UNIT"] = "Scm³/Scm³"
data_frame["RATIO_UNIT"] = "Sm³/Sm³"

if not "DENSITY" in data_frame.columns:
data_frame = calculate_densities(data_frame)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def plot_visibility_options(phase: str = "") -> Dict[str, str]:
"fvf": "Formation Volume Factor",
"viscosity": "Viscosity",
"density": "Density",
"ratio": "Gas/Oil Ratio (Rs)",
"ratio": "Fluid Ratio",
}
if phase == "OIL":
options["ratio"] = "Gas/Oil Ratio (Rs)"
options["ratio"] = "Gas/Oil Ratio (Rs) at Psat"
if phase == "GAS":
options["ratio"] = "Vaporized Oil Ratio (Rv)"
options["ratio"] = "Vaporized Oil Ratio (Rv) at Psat"
if phase == "WATER":
options.pop("ratio")
return options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def create_traces(
data_frame = data_frame.loc[data_frame["KEYWORD"] == "PVTW"]
dim_column_name = "PRESSURE"

data_frame = data_frame.sort_values(
["PRESSURE", "VOLUMEFACTOR", "VISCOSITY"],
ascending=[True, True, True],
)
# data_frame = data_frame.sort_values(
# ["PRESSURE", "VOLUMEFACTOR", "VISCOSITY"],
# ascending=[True, True, True],
# )

constant_group = (
data_frame["PVTNUM"].iloc[0]
Expand Down Expand Up @@ -180,7 +180,6 @@ def create_traces(
realization,
set_value,
)

traces.extend(
[
{
Expand Down Expand Up @@ -217,6 +216,7 @@ def create_traces(
"xaxis": "x",
"yaxis": "y",
"legendgroup": group,
"name": group,
"line": {
"width": 1,
"color": colors.get(group, colors[list(colors.keys())[-1]]),
Expand Down Expand Up @@ -267,7 +267,7 @@ def create_graph(
"ratio": {
"x_axis_title": rf"Pressure [{data_frame['PRESSURE_UNIT'].iloc[0]}]",
"y_axis_title": rf"[{data_frame['RATIO_UNIT'].iloc[0]}]",
"df_column": "DENSITY",
"df_column": "RATIO",
"show_scatter_values": False,
"show_border_values": True,
"show_border_markers": True,
Expand Down
4 changes: 1 addition & 3 deletions webviz_subsurface/plugins/_pvt_plot/_views/_pvt/_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def _update_plots(
plot_id["plot"]: plot_id["plot"] in visibility
for plot_id, visibility in zip(plots_visibility_ids, plots_visibility)
}

graph_height = max(
40.0,
80.0
Expand All @@ -210,7 +209,6 @@ def _update_plots(
for plot in ViewSettings.plot_visibility_options(phase):
if not visible_plots[plot]:
continue

current_element = wcc.WebvizViewElement(
id=self.unique_id(plot),
children=create_graph(
Expand All @@ -219,7 +217,7 @@ def _update_plots(
colors,
phase,
plot,
ViewSettings.plot_visibility_options(self.phases[phase])[plot],
ViewSettings.plot_visibility_options(phase)[plot],
self.plotly_theme,
graph_height,
),
Expand Down

0 comments on commit 1b1bb17

Please sign in to comment.