webviz-subsurface 0.2.37__py3-none-any.whl → 0.2.39__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 (25) hide show
  1. tests/unit_tests/plugin_tests/test_tornado_data.py +10 -1
  2. webviz_subsurface/_components/tornado/_tornado_bar_chart.py +31 -11
  3. webviz_subsurface/_components/tornado/_tornado_data.py +20 -2
  4. webviz_subsurface/_datainput/well_completions.py +2 -1
  5. webviz_subsurface/_providers/ensemble_table_provider/ensemble_table_provider_factory.py +4 -0
  6. webviz_subsurface/_utils/design_matrix.py +36 -0
  7. webviz_subsurface/plugins/_co2_leakage/_plugin.py +623 -493
  8. webviz_subsurface/plugins/_co2_leakage/_types.py +7 -0
  9. webviz_subsurface/plugins/_co2_leakage/_utilities/callbacks.py +96 -52
  10. webviz_subsurface/plugins/_co2_leakage/_utilities/co2volume.py +300 -82
  11. webviz_subsurface/plugins/_co2_leakage/_utilities/containment_info.py +31 -0
  12. webviz_subsurface/plugins/_co2_leakage/_utilities/initialization.py +16 -7
  13. webviz_subsurface/plugins/_co2_leakage/_utilities/surface_publishing.py +102 -9
  14. webviz_subsurface/plugins/_co2_leakage/views/mainview/mainview.py +14 -1
  15. webviz_subsurface/plugins/_co2_leakage/views/mainview/settings.py +181 -58
  16. webviz_subsurface/plugins/_parameter_analysis/_types.py +1 -0
  17. webviz_subsurface/plugins/_parameter_analysis/_utils/_parameters_model.py +10 -2
  18. webviz_subsurface/plugins/_parameter_analysis/_views/_parameter_distributions_view/_settings/_visualization_type.py +2 -1
  19. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/METADATA +1 -1
  20. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/RECORD +25 -22
  21. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/LICENSE +0 -0
  22. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/LICENSE.chromedriver +0 -0
  23. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/WHEEL +0 -0
  24. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/entry_points.txt +0 -0
  25. {webviz_subsurface-0.2.37.dist-info → webviz_subsurface-0.2.39.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,7 @@
1
+ from typing import List, Optional, TypedDict
2
+
3
+
4
+ class LegendData(TypedDict):
5
+ bar_legendonly: Optional[List[str]]
6
+ time_legendonly: Optional[List[str]]
7
+ stats_legendonly: Optional[List[str]]
@@ -20,8 +20,10 @@ from webviz_subsurface._providers import (
20
20
  from webviz_subsurface._providers.ensemble_surface_provider.ensemble_surface_provider import (
21
21
  SurfaceStatistic,
22
22
  )
23
+ from webviz_subsurface.plugins._co2_leakage._types import LegendData
23
24
  from webviz_subsurface.plugins._co2_leakage._utilities import plume_extent
24
25
  from webviz_subsurface.plugins._co2_leakage._utilities.co2volume import (
26
+ generate_co2_box_plot_figure,
25
27
  generate_co2_statistics_figure,
26
28
  generate_co2_time_containment_figure,
27
29
  generate_co2_time_containment_one_realization_figure,
@@ -30,6 +32,10 @@ from webviz_subsurface.plugins._co2_leakage._utilities.co2volume import (
30
32
  from webviz_subsurface.plugins._co2_leakage._utilities.containment_data_provider import (
31
33
  ContainmentDataProvider,
32
34
  )
35
+ from webviz_subsurface.plugins._co2_leakage._utilities.containment_info import (
36
+ ContainmentInfo,
37
+ StatisticsTabOption,
38
+ )
33
39
  from webviz_subsurface.plugins._co2_leakage._utilities.ensemble_well_picks import (
34
40
  EnsembleWellPicks,
35
41
  )
@@ -120,6 +126,17 @@ class SurfaceData:
120
126
  )
121
127
 
122
128
 
129
+ def extract_legendonly(figure: go.Figure) -> List[str]:
130
+ # Finds the names OR legendgroup of the traces in the figure which have their
131
+ # visibility set to "legendonly". In the figure, these traces are toggled OFF in the
132
+ # legend.
133
+ return [
134
+ d.get("legendgroup", d.get("name"))
135
+ for d in figure["data"]
136
+ if d.get("visible", "") == "legendonly"
137
+ ]
138
+
139
+
123
140
  def derive_surface_address(
124
141
  surface_name: str,
125
142
  attribute: MapAttribute,
@@ -385,18 +402,16 @@ def generate_containment_figures(
385
402
  co2_scale: Union[Co2MassScale, Co2VolumeScale],
386
403
  realizations: List[int],
387
404
  y_limits: List[Optional[float]],
388
- containment_info: Dict[str, Union[str, None, List[str], int]],
405
+ containment_info: ContainmentInfo,
406
+ legenddata: LegendData,
389
407
  ) -> Tuple[go.Figure, go.Figure, go.Figure]:
390
408
  try:
391
- fig0 = (
392
- no_update
393
- if not containment_info["update_first_figure"]
394
- else generate_co2_volume_figure(
395
- table_provider,
396
- table_provider.realizations,
397
- co2_scale,
398
- containment_info,
399
- )
409
+ fig0 = generate_co2_volume_figure(
410
+ table_provider,
411
+ table_provider.realizations,
412
+ co2_scale,
413
+ containment_info,
414
+ legenddata["bar_legendonly"],
400
415
  )
401
416
  fig1 = (
402
417
  generate_co2_time_containment_figure(
@@ -404,6 +419,7 @@ def generate_containment_figures(
404
419
  realizations,
405
420
  co2_scale,
406
421
  containment_info,
422
+ legenddata["time_legendonly"],
407
423
  )
408
424
  if len(realizations) > 1
409
425
  else generate_co2_time_containment_one_realization_figure(
@@ -414,12 +430,26 @@ def generate_containment_figures(
414
430
  containment_info,
415
431
  )
416
432
  )
417
- fig2 = generate_co2_statistics_figure(
418
- table_provider,
419
- realizations,
420
- co2_scale,
421
- containment_info,
422
- )
433
+ if (
434
+ containment_info.statistics_tab_option
435
+ == StatisticsTabOption.PROBABILITY_PLOT
436
+ ):
437
+ fig2 = generate_co2_statistics_figure(
438
+ table_provider,
439
+ realizations,
440
+ co2_scale,
441
+ containment_info,
442
+ legenddata["stats_legendonly"],
443
+ )
444
+ else: # "box_plot"
445
+ # Deliberately uses same legend as statistics
446
+ fig2 = generate_co2_box_plot_figure(
447
+ table_provider,
448
+ realizations,
449
+ co2_scale,
450
+ containment_info,
451
+ legenddata["stats_legendonly"],
452
+ )
423
453
  except KeyError as exc:
424
454
  warnings.warn(f"Could not generate CO2 figures: {exc}")
425
455
  raise exc
@@ -466,6 +496,7 @@ def process_visualization_info(
466
496
  return stored_info
467
497
 
468
498
 
499
+ # pylint: disable=too-many-locals
469
500
  def process_containment_info(
470
501
  zone: Optional[str],
471
502
  region: Optional[str],
@@ -477,8 +508,10 @@ def process_containment_info(
477
508
  sorting: str,
478
509
  lines_to_show: str,
479
510
  date_option: str,
511
+ statistics_tab_option: StatisticsTabOption,
512
+ box_show_points: str,
480
513
  menu_options: MenuOptions,
481
- ) -> Dict[str, Union[str, None, List[str], int]]:
514
+ ) -> ContainmentInfo:
482
515
  if mark_choice is None:
483
516
  mark_choice = "phase"
484
517
  zones = menu_options["zones"]
@@ -502,48 +535,57 @@ def process_containment_info(
502
535
  region = "all"
503
536
  if "region" in [mark_choice, color_choice]:
504
537
  zone = "all"
505
- return {
506
- "zone": zone,
507
- "region": region,
508
- "zones": zones,
509
- "regions": regions,
510
- "phase": phase,
511
- "containment": containment,
512
- "plume_group": plume_group,
513
- "color_choice": color_choice,
514
- "mark_choice": mark_choice,
515
- "sorting": sorting,
516
- "phases": [phase for phase in menu_options["phases"] if phase != "total"],
517
- "containments": ["hazardous", "outside", "contained"],
518
- "plume_groups": plume_groups,
519
- "use_stats": lines_to_show == "stat",
520
- "date_option": date_option,
521
- }
538
+ return ContainmentInfo(
539
+ zone=zone,
540
+ region=region,
541
+ zones=zones,
542
+ regions=regions,
543
+ phase=phase,
544
+ containment=containment,
545
+ plume_group=plume_group,
546
+ color_choice=color_choice,
547
+ mark_choice=mark_choice,
548
+ sorting=sorting,
549
+ phases=[phase for phase in menu_options["phases"] if phase != "total"],
550
+ containments=["hazardous", "outside", "contained"],
551
+ plume_groups=plume_groups,
552
+ use_stats=lines_to_show == "stat",
553
+ date_option=date_option,
554
+ statistics_tab_option=statistics_tab_option,
555
+ box_show_points=box_show_points,
556
+ )
522
557
 
523
558
 
524
559
  def make_plot_ids(
525
560
  ensemble: str,
526
561
  source: GraphSource,
527
562
  scale: Union[Co2MassScale, Co2VolumeScale],
528
- containment_info: Dict,
563
+ containment_info: ContainmentInfo,
529
564
  realizations: List[int],
530
- lines_to_show: str,
565
+ # lines_to_show: str,
531
566
  num_figs: int,
532
567
  ) -> List[str]:
533
- zone_str = (
534
- containment_info["zone"] if containment_info["zone"] is not None else "None"
535
- )
568
+ """
569
+ Removed some keywords from plot id that we don't want to trigger updates for
570
+ with respect to visible legends and potentially zoom level.
571
+
572
+ Note: Currently the legends are reset if you swap to a plot with different plot id
573
+ and back, so it works temporarily, in a sense. This might be good enough for now.
574
+ If we want to store it more extensively, we need to do something like what's been
575
+ outlined in _plugin.py.
576
+ """
577
+ zone_str = containment_info.zone if containment_info.zone is not None else "None"
536
578
  region_str = (
537
- containment_info["region"] if containment_info["region"] is not None else "None"
579
+ containment_info.region if containment_info.region is not None else "None"
538
580
  )
539
581
  plume_group_str = (
540
- containment_info["plume_group"]
541
- if containment_info["plume_group"] is not None
582
+ containment_info.plume_group
583
+ if containment_info.plume_group is not None
542
584
  else "None"
543
585
  )
544
586
  mark_choice_str = (
545
- containment_info["mark_choice"]
546
- if containment_info["mark_choice"] is not None
587
+ containment_info.mark_choice
588
+ if containment_info.mark_choice is not None
547
589
  else "None"
548
590
  )
549
591
  plot_id = "-".join(
@@ -554,17 +596,19 @@ def make_plot_ids(
554
596
  zone_str,
555
597
  region_str,
556
598
  plume_group_str,
557
- str(containment_info["phase"]),
558
- str(containment_info["containment"]),
559
- containment_info["color_choice"],
599
+ str(containment_info.phase),
600
+ str(containment_info.containment),
601
+ containment_info.color_choice,
560
602
  mark_choice_str,
561
- containment_info["sorting"],
562
- containment_info["date_option"],
603
+ containment_info.sorting,
604
+ containment_info.date_option,
563
605
  )
564
606
  )
565
- ids = [plot_id]
566
- ids += [plot_id + f"-{realizations}"] * (num_figs - 1)
567
- ids[1] += f"-{lines_to_show}"
607
+ ids = [plot_id] * num_figs
608
+ # ids += [plot_id + f"-{realizations}"] * (num_figs - 1)
609
+ # ids[1] += f"-{lines_to_show}"
610
+ ids[1] += "-single" if len(realizations) == 1 else "-multiple"
611
+ ids[2] += f"-{containment_info.statistics_tab_option}"
568
612
  return ids
569
613
 
570
614