webviz-subsurface 0.2.29__py3-none-any.whl → 0.2.31__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. webviz_subsurface/_components/tornado/_tornado_data.py +3 -0
  2. webviz_subsurface/_providers/ensemble_surface_provider/surface_array_server.py +0 -1
  3. webviz_subsurface/_providers/ensemble_surface_provider/surface_image_server.py +0 -1
  4. webviz_subsurface/plugins/_co2_leakage/_plugin.py +79 -37
  5. webviz_subsurface/plugins/_co2_leakage/_utilities/callbacks.py +99 -38
  6. webviz_subsurface/plugins/_co2_leakage/_utilities/co2volume.py +417 -355
  7. webviz_subsurface/plugins/_co2_leakage/_utilities/generic.py +2 -7
  8. webviz_subsurface/plugins/_co2_leakage/_utilities/initialization.py +15 -11
  9. webviz_subsurface/plugins/_co2_leakage/_utilities/surface_publishing.py +13 -4
  10. webviz_subsurface/plugins/_co2_leakage/views/mainview/mainview.py +93 -33
  11. webviz_subsurface/plugins/_co2_leakage/views/mainview/settings.py +301 -116
  12. webviz_subsurface/plugins/_seismic_misfit.py +1 -1
  13. webviz_subsurface/plugins/_volumetric_analysis/controllers/tornado_controllers.py +5 -1
  14. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/METADATA +34 -34
  15. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/RECORD +20 -20
  16. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/WHEEL +1 -1
  17. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/LICENSE +0 -0
  18. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/LICENSE.chromedriver +0 -0
  19. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/entry_points.txt +0 -0
  20. {webviz_subsurface-0.2.29.dist-info → webviz_subsurface-0.2.31.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,8 @@ from webviz_subsurface._utils.enum_shim import StrEnum
2
2
 
3
3
 
4
4
  class MapAttribute(StrEnum):
5
- MIGRATION_TIME = "Migration Time"
5
+ MIGRATION_TIME_SGAS = "Migration time (SGAS)"
6
+ MIGRATION_TIME_AMFG = "Migration time (AMFG)"
6
7
  MAX_SGAS = "Maximum SGAS"
7
8
  MAX_AMFG = "Maximum AMFG"
8
9
  SGAS_PLUME = "Plume (SGAS)"
@@ -69,9 +70,3 @@ class LayoutStyle:
69
70
  "line-height": "30px",
70
71
  "background-color": "lightgrey",
71
72
  }
72
-
73
-
74
- class ContainmentViews(StrEnum):
75
- CONTAINMENTSPLIT = "Split into containment polygons"
76
- ZONESPLIT = "Split into zones"
77
- REGIONSPLIT = "Split into regions"
@@ -15,7 +15,7 @@ from webviz_subsurface._providers import (
15
15
  )
16
16
  from webviz_subsurface._utils.webvizstore_functions import read_csv
17
17
  from webviz_subsurface.plugins._co2_leakage._utilities.co2volume import (
18
- read_zone_and_region_options,
18
+ read_menu_options,
19
19
  )
20
20
  from webviz_subsurface.plugins._co2_leakage._utilities.generic import (
21
21
  GraphSource,
@@ -35,7 +35,8 @@ def init_map_attribute_names(
35
35
  if mapping is None:
36
36
  # Based on name convention of xtgeoapp_grd3dmaps:
37
37
  return {
38
- MapAttribute.MIGRATION_TIME: "migrationtime",
38
+ MapAttribute.MIGRATION_TIME_SGAS: "migrationtime_sgas",
39
+ MapAttribute.MIGRATION_TIME_AMFG: "migrationtime_amfg",
39
40
  MapAttribute.MAX_SGAS: "max_sgas",
40
41
  MapAttribute.MAX_AMFG: "max_amfg",
41
42
  MapAttribute.MASS: "co2-mass-total",
@@ -118,25 +119,28 @@ def _find_max_file_size_mb(ens_path: str, table_rel_path: str) -> float:
118
119
  return max_size
119
120
 
120
121
 
121
- def init_zone_and_region_options(
122
+ def init_menu_options(
122
123
  ensemble_roots: Dict[str, str],
123
124
  mass_table: Dict[str, EnsembleTableProvider],
124
125
  actual_volume_table: Dict[str, EnsembleTableProvider],
125
- ensemble_provider: Dict[str, EnsembleSurfaceProvider],
126
+ mass_relpath: str,
127
+ volume_relpath: str,
126
128
  ) -> Dict[str, Dict[str, Dict[str, List[str]]]]:
127
129
  options: Dict[str, Dict[str, Dict[str, List[str]]]] = {}
128
130
  for ens in ensemble_roots.keys():
129
131
  options[ens] = {}
130
- real = ensemble_provider[ens].realizations()[0]
131
- for source, table in zip(
132
+ for source, table, relpath in zip(
132
133
  [GraphSource.CONTAINMENT_MASS, GraphSource.CONTAINMENT_ACTUAL_VOLUME],
133
134
  [mass_table, actual_volume_table],
135
+ [mass_relpath, volume_relpath],
134
136
  ):
135
- try:
136
- options[ens][source] = read_zone_and_region_options(table[ens], real)
137
- except KeyError:
138
- options[ens][source] = {"zones": [], "regions": []}
139
- options[ens][GraphSource.UNSMRY] = {"zones": [], "regions": []}
137
+ real = table[ens].realizations()[0]
138
+ options[ens][source] = read_menu_options(table[ens], real, relpath)
139
+ options[ens][GraphSource.UNSMRY] = {
140
+ "zones": [],
141
+ "regions": [],
142
+ "phases": ["total", "gas", "aqueous"],
143
+ }
140
144
  return options
141
145
 
142
146
 
@@ -1,3 +1,4 @@
1
+ import warnings
1
2
  from dataclasses import dataclass
2
3
  from typing import Any, Dict, List, Optional, Tuple, Union
3
4
 
@@ -44,7 +45,7 @@ def publish_and_get_surface_metadata(
44
45
  address: Union[SurfaceAddress, TruncatedSurfaceAddress],
45
46
  visualization_info: Dict[str, Any],
46
47
  map_attribute_names: Dict[MapAttribute, str],
47
- ) -> Tuple[Optional[SurfaceImageMeta], str, Optional[Any]]:
48
+ ) -> Tuple[Optional[SurfaceImageMeta], Optional[str], Optional[Any]]:
48
49
  if isinstance(address, TruncatedSurfaceAddress):
49
50
  return _publish_and_get_truncated_surface_metadata(server, provider, address)
50
51
  provider_id: str = provider.provider_id()
@@ -53,9 +54,13 @@ def publish_and_get_surface_metadata(
53
54
  summed_mass = None
54
55
  if not surf_meta:
55
56
  # This means we need to compute the surface
56
- surface = provider.get_surface(address)
57
+ try:
58
+ surface = provider.get_surface(address)
59
+ except ValueError:
60
+ surface = None
57
61
  if not surface:
58
- raise ValueError(f"Could not get surface for address: {address}")
62
+ warnings.warn(f"Could not find surface file with properties: {address}")
63
+ return None, None, None
59
64
  if address.attribute in [
60
65
  map_attribute_names[MapAttribute.MASS],
61
66
  map_attribute_names[MapAttribute.FREE],
@@ -64,7 +69,11 @@ def publish_and_get_surface_metadata(
64
69
  surface.values = surface.values / SCALE_DICT[visualization_info["unit"]]
65
70
  summed_mass = np.ma.sum(surface.values)
66
71
  if (
67
- address.attribute != map_attribute_names[MapAttribute.MIGRATION_TIME]
72
+ address.attribute
73
+ not in [
74
+ map_attribute_names[MapAttribute.MIGRATION_TIME_SGAS],
75
+ map_attribute_names[MapAttribute.MIGRATION_TIME_AMFG],
76
+ ]
68
77
  and visualization_info["threshold"] >= 0
69
78
  ):
70
79
  surface.operation("elile", visualization_info["threshold"])
@@ -27,6 +27,11 @@ class MapViewElement(ViewElementABC):
27
27
  BAR_PLOT = "bar-plot"
28
28
  TIME_PLOT = "time-plot"
29
29
  TIME_PLOT_ONE_REAL = "time-plot-one-realization"
30
+ BAR_PLOT_ORDER = "bar-plot-order"
31
+ CONTAINMENT_COLORS = "containment-order"
32
+ SIZE_SLIDER = "size-slider"
33
+ TOP_ELEMENT = "top-element"
34
+ BOTTOM_ELEMENT = "bottom-element"
30
35
 
31
36
  def __init__(self, color_scales: List[Dict[str, Any]]) -> None:
32
37
  super().__init__()
@@ -37,6 +42,7 @@ class MapViewElement(ViewElementABC):
37
42
  [
38
43
  wcc.Frame(
39
44
  # id=self.register_component_unique_id(LayoutElements.MAP_VIEW),
45
+ id=self.register_component_unique_id(self.Ids.TOP_ELEMENT),
40
46
  color="white",
41
47
  highlight=False,
42
48
  children=[
@@ -54,8 +60,8 @@ class MapViewElement(ViewElementABC):
54
60
  ),
55
61
  ],
56
62
  style={
57
- "padding": "1vh",
58
- "height": "37vh",
63
+ "padding": "1%",
64
+ "height": "80%",
59
65
  "position": "relative",
60
66
  },
61
67
  ),
@@ -72,28 +78,52 @@ class MapViewElement(ViewElementABC):
72
78
  ),
73
79
  ],
74
80
  style={
75
- "height": "47vh",
81
+ "height": "43vh",
76
82
  },
77
83
  ),
78
84
  wcc.Frame(
79
85
  # id=get_uuid(LayoutElements.PLOT_VIEW),
86
+ id=self.register_component_unique_id(self.Ids.BOTTOM_ELEMENT),
80
87
  style={
81
- "height": "33vh",
82
- "display": "flex",
83
- "flexDirection": "row",
84
- "justifyContent": "space-evenly",
88
+ "height": "37vh",
89
+ },
90
+ children=[
91
+ html.Div(
92
+ _summary_graph_layout(
93
+ self.register_component_unique_id(self.Ids.BAR_PLOT),
94
+ self.register_component_unique_id(self.Ids.TIME_PLOT),
95
+ self.register_component_unique_id(
96
+ self.Ids.TIME_PLOT_ONE_REAL
97
+ ),
98
+ )
99
+ ),
100
+ ],
101
+ ),
102
+ html.Div(
103
+ [
104
+ wcc.Slider(
105
+ id=self.register_component_unique_id(self.Ids.SIZE_SLIDER),
106
+ min=1,
107
+ max=79,
108
+ step=2,
109
+ value=37,
110
+ vertical=False,
111
+ marks={
112
+ # 1: "Top",
113
+ 37: "Drag to scale the size of the containment plots",
114
+ # 79: "Bottom",
115
+ },
116
+ ),
117
+ ],
118
+ style={
119
+ "width": "100%",
85
120
  },
86
- children=_summary_graph_layout(
87
- self.register_component_unique_id(self.Ids.BAR_PLOT),
88
- self.register_component_unique_id(self.Ids.TIME_PLOT),
89
- self.register_component_unique_id(self.Ids.TIME_PLOT_ONE_REAL),
90
- ),
91
121
  ),
92
122
  ],
93
123
  style={
94
- "flex": 3,
95
124
  "display": "flex",
96
125
  "flexDirection": "column",
126
+ "height": "90vh",
97
127
  },
98
128
  )
99
129
 
@@ -104,25 +134,55 @@ def _summary_graph_layout(
104
134
  time_plot_one_realization_id: str,
105
135
  ) -> List:
106
136
  return [
107
- wcc.Graph(
108
- id=bar_plot_id,
109
- figure=go.Figure(),
110
- config={
111
- "displayModeBar": False,
112
- },
113
- ),
114
- wcc.Graph(
115
- id=time_plot_id,
116
- figure=go.Figure(),
117
- config={
118
- "displayModeBar": False,
119
- },
120
- ),
121
- wcc.Graph(
122
- id=time_plot_one_realization_id,
123
- figure=go.Figure(),
124
- config={
125
- "displayModeBar": False,
126
- },
137
+ wcc.Tabs(
138
+ id="TAB",
139
+ value="tab-1",
140
+ children=[
141
+ wcc.Tab(
142
+ label="End-state containment (all realizations)",
143
+ value="tab-1",
144
+ children=[
145
+ html.Div(
146
+ wcc.Graph(
147
+ id=bar_plot_id,
148
+ figure=go.Figure(),
149
+ config={
150
+ "displayModeBar": False,
151
+ },
152
+ ),
153
+ ),
154
+ ],
155
+ ),
156
+ wcc.Tab(
157
+ label="Containment over time (all realizations)",
158
+ value="tab-2",
159
+ children=[
160
+ html.Div(
161
+ wcc.Graph(
162
+ id=time_plot_id,
163
+ figure=go.Figure(),
164
+ config={
165
+ "displayModeBar": False,
166
+ },
167
+ ),
168
+ ),
169
+ ],
170
+ ),
171
+ wcc.Tab(
172
+ label="Containment over time (one realization)",
173
+ value="tab-3",
174
+ children=[
175
+ html.Div(
176
+ wcc.Graph(
177
+ id=time_plot_one_realization_id,
178
+ figure=go.Figure(),
179
+ config={
180
+ "displayModeBar": False,
181
+ },
182
+ ),
183
+ ),
184
+ ],
185
+ ),
186
+ ],
127
187
  ),
128
188
  ]