Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv committed Dec 4, 2024
1 parent 6ab07e1 commit ea67d6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion webviz_subsurface/plugins/_map_viewer_fmu/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def plugin_callbacks(
ensemble_fault_polygons_providers: Dict[str, EnsembleFaultPolygonsProvider],
fault_polygons_server: FaultPolygonsServer,
field_outline_polygons: xtgeo.Polygons,
field_outline_color: List[int],
field_outline_color:str,
map_surface_names_to_fault_polygons: Dict[str, str],
well_picks_provider: Optional[WellPickProvider],
fault_polygon_attribute: Optional[str],
Expand Down Expand Up @@ -530,6 +530,7 @@ def _update_map(
LayoutLabels.SHOW_FIELD_OUTLINE in options
and field_outline_polygons is not None
):

layer_model.update_layer_by_id(
layer_id=f"{LayoutElements.FIELD_OUTLINE_LAYER}-{idx}",
layer_data={
Expand Down
20 changes: 11 additions & 9 deletions webviz_subsurface/plugins/_map_viewer_fmu/map_viewer_fmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from webviz_subsurface._providers.ensemble_surface_provider.surface_image_server import (
SurfaceImageServer,
)
from webviz_subsurface._utils.webvizstore_functions import read_csv

from webviz_subsurface._utils.webvizstore_functions import read_csv, get_path
from webviz_subsurface._utils.colors import hex_to_rgb
from ._tmp_well_pick_provider import WellPickProvider
from .callbacks import plugin_callbacks
from .color_tables import default_color_tables
Expand All @@ -41,7 +41,7 @@ class MapViewerFMU(WebvizPluginABC):
* **`well_pick_file`:** A csv file with well picks. See data input.
* **`fault_polygon_attribute`:** Which set of fault polygons to use.
* **`field_outline_polygons_file_path`:** Full filepath to a field outline polygons file.
* **`field_outline_color:** Color of the field outline polygons (rgb).
* **`field_outline_color:** Color of the field outline polygons (hex).
* **`map_surface_names_to_well_pick_names`:** Allows mapping of file surface names
to the relevant well pick name
* **`map_surface_names_to_fault_polygons`:** Allows mapping of file surface names
Expand Down Expand Up @@ -97,7 +97,7 @@ def __init__(
well_pick_file: Path = None,
fault_polygon_attribute: Optional[str] = None,
field_outline_polygons_file_path: Path = None,
field_outline_color: List[int] = [200, 200, 200],
field_outline_color_hex:str = "#8b008b",
map_surface_names_to_fault_polygons: Dict[str, str] = None,
map_surface_names_to_well_pick_names: Dict[str, str] = None,
rel_surface_folder: str = "share/results/maps",
Expand Down Expand Up @@ -163,14 +163,16 @@ def __init__(
for fault_polygons_provider in self._ensemble_fault_polygons_providers.values():
self._fault_polygons_server.add_provider(fault_polygons_provider)
self.field_outline_polygons = None
if field_outline_polygons_file_path is not None:
self.field_outline_polygons_file_path = field_outline_polygons_file_path
if self.field_outline_polygons_file_path is not None:
try:
self.field_outline_polygons = xtgeo.Polygons(
read_csv(field_outline_polygons_file_path)
self.field_outline_polygons = xtgeo.polygons_from_file(
get_path(self.field_outline_polygons_file_path)
)
except:
print("Error reading field outline polygons file")
self.field_outline_color = field_outline_color
self.field_outline_color = hex_to_rgb(field_outline_color_hex)

self.map_surface_names_to_fault_polygons = (
map_surface_names_to_fault_polygons
if map_surface_names_to_fault_polygons is not None
Expand Down Expand Up @@ -224,6 +226,6 @@ def add_webvizstore(self) -> List[Tuple[Callable, list]]:
store_functions.append((read_csv, [{"csv_file": self.well_pick_file}]))
if self.field_outline_polygons_file_path is not None:
store_functions.append(
(read_csv, [{"csv_file": self.field_outline_polygons_file_path}])
(get_path, [{"path": self.field_outline_polygons_file_path}])
)
return store_functions

0 comments on commit ea67d6f

Please sign in to comment.