diff --git a/webviz_subsurface/plugins/_map_viewer_fmu/callbacks.py b/webviz_subsurface/plugins/_map_viewer_fmu/callbacks.py index b3e887788..bf97d5ef0 100644 --- a/webviz_subsurface/plugins/_map_viewer_fmu/callbacks.py +++ b/webviz_subsurface/plugins/_map_viewer_fmu/callbacks.py @@ -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], @@ -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={ diff --git a/webviz_subsurface/plugins/_map_viewer_fmu/map_viewer_fmu.py b/webviz_subsurface/plugins/_map_viewer_fmu/map_viewer_fmu.py index 6960ec232..9cc2e5068 100644 --- a/webviz_subsurface/plugins/_map_viewer_fmu/map_viewer_fmu.py +++ b/webviz_subsurface/plugins/_map_viewer_fmu/map_viewer_fmu.py @@ -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 @@ -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 @@ -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", @@ -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 @@ -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