def highlight_controls(uuid: str, tab: str) -> html.Div: return html.Div( style={"margin-top": "10px"}, children=[ html.Label("Data highlight criterias", className="webviz-underlined-label"), html.Div( children=[ wcc.Label("Absolute diff (%) above:"), dcc.Input( id={"id": uuid, "tab": tab, "selector": "Accept value"}, type="number", required=True, value=5, persistence=True, persistence_type="session", ), ], ), html.Div( children=[ wcc.Label("Ignore response values below:"), dcc.Input( id={"id": uuid, "tab": tab, "selector": "Ignore <"}, type="number", required=True, value=0, persistence=True, persistence_type="session", debounce=True, ), ] ), ], )
def vector_selector(get_uuid: Callable, vectormodel: SimulationTimeSeriesModel) -> html.Div: first_vector_group: str = ("Field" if "Field" in list( vectormodel.vector_groups.keys()) else list( vectormodel.vector_groups.keys())[0]) return html.Div( style={"margin": "10px 0px"}, children=[ html.Span(wcc.Label("Vector type")), html.Div( id=get_uuid("vtype-container"), children=[ dcc.RadioItems( id={ "id": get_uuid("vtype-select"), "state": "initial" }, options=[{ "label": i, "value": i } for i in vectormodel.vector_groups], value=first_vector_group, labelStyle={ "display": "inline-block", "margin-right": "10px" }, ) ], ), html.Div( style={"margin-top": "5px"}, children=[ html.Span(wcc.Label("Vector")), html.Div( id=get_uuid("vshort-container"), children=[ wcc.Dropdown( id=get_uuid("vshort-select"), options=[{ "label": i, "value": i } for i in vectormodel. vector_groups[first_vector_group] ["shortnames"]], value=vectormodel.vector_groups[ first_vector_group]["shortnames"][0], placeholder="Select a vector...", clearable=False, ), ], ), ], ), html.Div(id=get_uuid("vitems-container"), children=[]), html.Div(id=get_uuid("vector-select"), style={"display": "none"}), html.Div(id=get_uuid("clickdata-store"), style={"display": "none"}), ], )
def filter_parameter( get_uuid: Callable, parametermodel: ParametersModel, tab: str, multi: bool = True, value: Union[str, float] = None, ) -> html.Div: return html.Div( style={"margin-top": "10px"}, children=[ wcc.Label("Select parameters"), html.Div( id=get_uuid("filter-parameter-container"), children=[ wcc.SelectWithLabel( id={ "id": get_uuid("filter-parameter"), "tab": tab, }, options=[ {"label": i, "value": i} for i in parametermodel.parameters ], value=value, multi=multi, size=min(40, len(parametermodel.parameters)), ), ], ), ], )
def surface_view(get_uuid: Callable, tab: str) -> html.Div: return html.Div( style={"height": "35vh"}, children=[ wcc.Label( id={ "id": get_uuid("surface-name"), "tab": tab }, children= "Select vector, then click on a correlation to visualize surface", ), wsc.LeafletMap( id={ "id": get_uuid("surface-view"), "tab": tab }, layers=[], unitScale={}, autoScaleMap=True, minZoom=-19, updateMode="update", mouseCoords={"position": "bottomright"}, colorBar={"position": "bottomleft"}, ), ], )
def color_selector( get_uuid: Callable, tab: str, colors: Optional[list] = None, bargap: Optional[float] = None, height: Optional[float] = None, ): return html.Div( style={"margin-top": "5px"}, children=[ wcc.Label("Colors"), wcc.Graph( id={ "id": get_uuid("color-selector"), "tab": tab }, config={"displayModeBar": False}, figure=color_figure( colors=colors, bargap=bargap, height=height, ), ), ], )
def surface_views( get_uuid: Callable, ensemble: str, delta_ensemble: str, ens_layer: dict, delta_ens_layer: dict, diff_layer: dict, prop: str, zone: str, statistic: str = "Mean", ) -> html.Div: return html.Div( style={"height": "76vh"}, children=[ wcc.Label( children=f"{statistic} for {prop}, {zone} in {ensemble}", ), surface_view( get_uuid=get_uuid, ensemble=ensemble, synced_ids=[delta_ensemble, "diff"], layers=[ens_layer], ), wcc.Label( children=f"{statistic} for {prop}, {zone} in {delta_ensemble}", ), surface_view( get_uuid=get_uuid, ensemble=delta_ensemble, synced_ids=[ensemble, "diff"], layers=[delta_ens_layer], ), wcc.Label( children= f"{statistic} for {prop}, {zone} in {ensemble} - {delta_ensemble}", ), surface_view( get_uuid=get_uuid, ensemble="diff", synced_ids=[delta_ensemble, ensemble], layers=[diff_layer], ), ], )
def date_selector( get_uuid: Callable, vectormodel: SimulationTimeSeriesModel ) -> html.Div: dates = vectormodel.dates return html.Div( style={"margin": "10px 0px"}, children=[ html.Div( style={"display": "inline-flex"}, children=[ wcc.Label("Date:"), wcc.Label( to_str(dates[-1]), id=get_uuid("date-selected-text"), style={"margin-left": "10px"}, ), dcc.Store( id=get_uuid("date-selected"), storage_type="session", data=to_str(dates[-1]), ), ], ), wcc.Slider( id=get_uuid("date-slider"), value=len(dates) - 1, min=0, max=len(dates) - 1, step=1, included=False, marks={ idx: { "label": to_str(dates[idx]), "style": {"white-space": "nowrap"}, } for idx in [0, len(dates) - 1] }, ), ], )
def scaling_threshold(self) -> html.Div: return html.Div( style={"margin-top": "10px"}, children=[ wcc.Label("Maximum PC_SCALING threshold"), html.Div( dcc.Input( id=self.get_uuid(LayoutElements.HIGHLIGHT_ABOVE), type="number", persistence=True, persistence_type="session", )), ], )
def settings_layout(self) -> wcc.FlexBox: """Layout for color and other settings""" return wcc.Frame( style={"width": "40%"}, children=[ html.Div( style={"width": "100%"}, children=wcc.Dropdown( label="Seismic cube", id=self.uuid("cube"), options=[{ "label": Path(cube).stem, "value": cube } for cube in self.segyfiles], value=self.segyfiles[0], clearable=False, ), ), html.Div(children=[ wcc.Label(children="Set colorscale", ), wcc.ColorScales( id=self.uuid("color-scale"), colorscale=self.initial_colors, nSwatches=12, ), ], ), html.Div(children=[ wcc.RangeSlider( label="Color range", id=self.uuid("color-values"), min=self.init_state["min_value"], max=self.init_state["max_value"], value=[ self.init_state["min_value"], self.init_state["max_value"], ], tooltip={"placement": "bottom"}, step=calculate_slider_step( min_value=self.init_state["min_value"], max_value=self.init_state["max_value"], steps=100, ), ), ], ), html.Button(id=self.uuid("color-reset"), children="Reset Range"), html.Button(id=self.uuid("zoom"), children="Reset zoom"), ], )
def from_cumulatives_layout(self) -> html.Div: return html.Div( style=({} if len(self.time_interval_options) > 0 and self.smry_meta is not None else { "display": "none" }), children=[ wcc.Label("Calculated from cumulatives:"), wcc.Label( "Average (AVG_) and interval (INTVL_) time series", style={"font-style": "italic"}, ), html.Div( wcc.RadioItems( id=self.uuid("cum_interval"), options=[{ "label": (f"{i.lower().capitalize()}"), "value": i, "disabled": False, } for i in self.time_interval_options], value=self.time_index, ), ), ], )
def color_range_layout(uuid: str, map_id: str) -> wcc.FlexBox: return wcc.FlexBox( style={ "display": "flex", "align-items": "center" }, children=[ wcc.Label( "Surface A" if map_id == "map1" else "Surface B", style={ "flex": 1, "minWidth": "40px" }, ), dbc.Input( id={ "id": uuid, "colors": f"{map_id}_clip_min", }, style={ "flex": 1, "minWidth": "40px" }, type="number", value=None, debounce=True, placeholder="Min", persistence=True, persistence_type="session", ), dbc.Input( id={ "id": uuid, "colors": f"{map_id}_clip_max", }, style={ "flex": 1, "minWidth": "40px" }, type="number", value=None, debounce=True, placeholder="Max", persistence=True, persistence_type="session", ), ], )
def yline_layout(uuid: str, surface_geometry: Dict) -> html.Div: return html.Div( style={ "display": "none", }, id={"id": uuid, "element": "yline-wrapper"}, children=[ html.Label("Y-Line:"), wcc.FlexBox( style={"fontSize": "0.8em"}, children=[ dcc.Input( id={"id": uuid, "cross-section": "yline", "element": "value"}, style={"flex": 3, "minWidth": "100px"}, type="number", value=round(surface_geometry["ymin"]), min=round(surface_geometry["ymin"]), max=round(surface_geometry["ymax"]), step=50, persistence=True, persistence_type="session", ), wcc.Label( style={"flex": 1, "marginLeft": "10px", "minWidth": "20px"}, children="Step:", ), dcc.Input( id={"id": uuid, "cross-section": "yline", "element": "step"}, style={"flex": 2, "minWidth": "20px"}, value=50, type="number", min=1, max=round(surface_geometry["ymax"]) - round(surface_geometry["ymin"]), persistence=True, persistence_type="session", ), ], ), ], )
def line_traces_view(get_uuid: Callable, ) -> html.Div: return wcc.Selectors( label="Plot data", children=[ wcc.RadioItems( id=get_uuid("mode"), options=[ { "value": "lines", "label": "Lines" }, { "value": "markers", "label": "Points" }, ], value="lines", ), wcc.Checklist( id=get_uuid("traces"), options=[{ "label": val, "value": val } for val in ["Realizations", "Mean", "P10/P90", "Low/High"]], value=["Realizations"], labelStyle={"display": "block"}, ), wcc.Checklist( id=get_uuid("observations"), options=[{ "label": val, "value": val } for val in ["Observations"]], value=["Observations"], labelStyle={"display": "block"}, ), wcc.Label(id=get_uuid("statistics_warning"), children=""), ], )
def settings_layout(uuid: str) -> html.Details: return wcc.Selectors( open_details=False, label="⚙️ Settings", children=[ wcc.Checklist( id={ "id": uuid, "settings": "compute_diff" }, options=[{ "label": "Auto compute difference map", "value": "compute_diffmap", }], value=["compute_diffmap"], ), html.Div(children=[ wcc.Label( "Color ranges:", style={"font-weight": "bold"}, ), color_range_layout(uuid=uuid, map_id="map1"), color_range_layout(uuid=uuid, map_id="map2"), wcc.Checklist( id={ "id": uuid, "colors": "sync_range" }, options=[{ "label": "Sync range on maps", "value": "sync_range", }], value=[], ), ], ), ], )
def date_selector(get_uuid: Callable, vectormodel: SimulationTimeSeriesModel) -> html.Div: dates = vectormodel.dates return html.Div( style={"margin": "10px 0px"}, children=[ html.Div( style={"display": "inline-flex"}, children=[ html.Span(wcc.Label("Date:")), html.Span( html.Label( "date", id=get_uuid("date-selected"), style={"margin-left": "10px"}, ), ), ], ), wcc.Slider( id=get_uuid("date-slider"), value=len(dates) - 1, min=0, max=len(dates) - 1, included=False, marks={ idx: { "label": dates[idx], "style": { "white-space": "nowrap", }, } for idx in [0, len(dates) - 1] }, ), ], )
def layout(self): return html.Div( id=self.uuid("main-div"), children=[ wcc.FlexBox(children=[ wcc.Frame( style={ "flex": 1, "style": "45vh" }, children=[ wcc.Selectors( label="Filters", children=[ wcc.Label( children="Filter observations:", style={"display": "block"}, ), dcc.Input( id=self.uuid("filter1_id"), value="", type="text", debounce=True, ), wcc.Label( children="Filter parameters:", style={"display": "block"}, ), dcc.Input( id=self.uuid("filter2_id"), value="", type="text", debounce=True, ), ], ), wcc.Selectors( label="Selected output:", children=wcc.RadioItems( id=self.uuid("choice_id"), options=[ { "label": "One by one observation", "value": "ONE", }, { "label": "All minus one observation", "value": "ALL", }, ], value="ONE", ), ), wcc.Selectors( label="Parameter distribution:", children=dcc.Checklist( id=self.uuid("choice_hist_id"), options=[ { "label": "Transformed dist. (if available)", "value": "TRANS", }, ], value=[], ), ), ], ), wcc.Frame( color="white", highlight=False, style={"flex": 3}, children=[ html.Div(id=self.uuid("output_graph"), ), ], ), wcc.Frame( color="white", highlight=False, style={"flex": 3}, children=[ html.Div(id=self.uuid("click_data"), ), ], ), ]), html.Div(children=[ html.H4(children= "Table of ten highest parameters change/update Ks", ), html.Div(id=self.uuid("generate_table"), ), ]), ], )
def __settings_layout( get_uuid: Callable, ensembles: List[str], vector_selector_data: list, vector_calculator_data: list, predefined_expressions: List[ExpressionInfo], custom_vector_definitions: dict, realizations: List[int], disable_resampling_dropdown: bool, selected_resampling_frequency: Frequency, selected_visualization: VisualizationOptions, ensembles_dates: List[datetime.datetime], selected_vectors: Optional[List[str]] = None, ) -> html.Div: return html.Div( children=[ wcc.Selectors( label="Group By", id=get_uuid(LayoutElements.TOUR_STEP_GROUP_BY), children=[ wcc.RadioItems( id=get_uuid(LayoutElements.SUBPLOT_OWNER_OPTIONS_RADIO_ITEMS), options=[ { "label": "Time Series", "value": SubplotGroupByOptions.VECTOR.value, }, { "label": "Ensemble", "value": SubplotGroupByOptions.ENSEMBLE.value, }, ], value=SubplotGroupByOptions.VECTOR.value, ), ], ), wcc.Selectors( label="Resampling frequency", children=[ wcc.Dropdown( id=get_uuid(LayoutElements.RESAMPLING_FREQUENCY_DROPDOWN), clearable=False, disabled=disable_resampling_dropdown, options=[ { "label": frequency.value, "value": frequency.value, } for frequency in Frequency ], value=selected_resampling_frequency, style={ "margin-bottom": "10px", }, ), wcc.Label( "Data relative to date:", style={ "font-style": "italic", }, ), wcc.Dropdown( clearable=True, disabled=disable_resampling_dropdown, id=get_uuid(LayoutElements.RELATIVE_DATE_DROPDOWN), options=[ { "label": datetime_utils.to_str(_date), "value": datetime_utils.to_str(_date), } for _date in sorted(ensembles_dates) ], ), wcc.Label( "NB: Disabled for presampled data", style={"font-style": "italic"} if disable_resampling_dropdown else {"display": "none"}, ), ], ), wcc.Selectors( label="Ensembles", children=[ wcc.Dropdown( label="Selected ensembles", id=get_uuid(LayoutElements.ENSEMBLES_DROPDOWN), clearable=False, multi=True, options=[ {"label": ensemble, "value": ensemble} for ensemble in ensembles ], value=None if len(ensembles) <= 0 else [ensembles[0]], ), wcc.Selectors( label="Delta Ensembles", id=get_uuid(LayoutElements.TOUR_STEP_DELTA_ENSEMBLE), open_details=False, children=[ __delta_ensemble_creator_layout( get_uuid=get_uuid, ensembles=ensembles, ) ], ), ], ), wcc.Selectors( label="Time Series", children=[ wsc.VectorSelector( id=get_uuid(LayoutElements.VECTOR_SELECTOR), maxNumSelectedNodes=3, data=vector_selector_data, persistence=True, persistence_type="session", selectedTags=[] if selected_vectors is None else selected_vectors, numSecondsUntilSuggestionsAreShown=0.5, lineBreakAfterTag=True, customVectorDefinitions=custom_vector_definitions, ), html.Button( "Vector Calculator", id=get_uuid(LayoutElements.VECTOR_CALCULATOR_OPEN_BUTTON), style={ "margin-top": "5px", "margin-bottom": "5px", }, ), ], ), wcc.Selectors( label="Visualization", children=[ wcc.RadioItems( id=get_uuid(LayoutElements.VISUALIZATION_RADIO_ITEMS), options=[ { "label": "Individual realizations", "value": VisualizationOptions.REALIZATIONS.value, }, { "label": "Statistical lines", "value": VisualizationOptions.STATISTICS.value, }, { "label": "Statistical fanchart", "value": VisualizationOptions.FANCHART.value, }, { "label": "Statistics + Realizations", "value": VisualizationOptions.STATISTICS_AND_REALIZATIONS, }, ], value=selected_visualization.value, ), wcc.Selectors( label="Options", id=get_uuid(LayoutElements.TOUR_STEP_OPTIONS), children=__plot_options_layout( get_uuid=get_uuid, selected_visualization=selected_visualization, ), ), ], ), wcc.Selectors( label="Filter Realizations", children=__realization_filters(get_uuid, realizations), ), __vector_calculator_modal_layout( get_uuid=get_uuid, vector_data=vector_calculator_data, predefined_expressions=predefined_expressions, ), dcc.Store( id=get_uuid(LayoutElements.VECTOR_CALCULATOR_EXPRESSIONS), data=predefined_expressions, ), dcc.Store( id=get_uuid(LayoutElements.VECTOR_CALCULATOR_EXPRESSIONS_OPEN_MODAL), data=predefined_expressions, ), ] )
def layout(self): return wcc.FlexBox( id=self.ids("layout"), children=[ wcc.Frame( style={"flex": 1}, children=[ wcc.Selectors( label="Map settings", children=[ wcc.Dropdown( id=self.ids("surface"), label="Select surface", options=[{ "label": name, "value": path } for name, path in zip( self.surfacenames, self.surfacefiles)], value=self.surfacefiles[0], clearable=False, ), wcc.RadioItems( id=self.ids("surface-type"), options=[ { "label": "Display surface z-value", "value": "surface", }, { "label": "Display seismic attribute as z-value", "value": "attribute", }, ], value="surface", ), ], ), wcc.Selectors( label="Intersection settings", children=[ wcc.Dropdown( label="Select seismic cube", id=self.ids("cube"), options=[{ "label": Path(cube).stem, "value": cube } for cube in self.segyfiles], value=self.segyfiles[0], clearable=False, ), wcc.Label(children="Set colorscale", ), wcc.ColorScales( id=self.ids("color-scale"), colorscale=self.initial_colors, nSwatches=12, ), wcc.RangeSlider( label="Set color range", id=self.ids("color-values"), tooltip={ "placement": "bottom", "always_visible": True, }, marks=None, ), html.Button( id=self.ids("color-range-btn"), children="Reset Range", ), ], ), ], ), wcc.Frame( highlight=False, style={ "height": "800px", "flex": 3, }, children=[ LeafletMap( id=self.ids("map-view"), autoScaleMap=True, minZoom=-19, updateMode="update", layers=[], drawTools={ "drawMarker": False, "drawPolygon": False, "drawPolyline": True, "position": "topright", }, mouseCoords={"position": "bottomright"}, colorBar={"position": "bottomleft"}, switch={ "value": False, "disabled": False, "label": "Hillshading", }, ), ], ), html.Div( style={ "flex": 3, "height": "800px" }, children=[ wcc.Graph(config={"displayModeBar": False}, id=self.ids("fence-view")), ], ), ], )
def selections_layout(self) -> html.Div: return html.Div(children=[ html.Div( wcc.Dropdown( label="Select QC-visualization:", id=self.get_uuid(LayoutElements.PLOT_SELECTOR), options=[ { "label": "Waterfall plot for water vol changes", "value": self.MainPlots.WATERFALL, }, { "label": "Reservoir properties vs Depth", "value": self.MainPlots.PROP_VS_DEPTH, }, ], value=self.MainPlots.PROP_VS_DEPTH, clearable=False, ), style={"margin-bottom": "15px"}, ), wcc.Selectors( label="Selections", children=[ wcc.SelectWithLabel( label="EQLNUM", id=self.get_uuid(LayoutElements.PLOT_EQLNUM_SELECTOR), options=[{ "label": ens, "value": ens } for ens in self.datamodel.eqlnums], value=self.datamodel.eqlnums[:1], size=min(8, len(self.datamodel.eqlnums)), multi=True, ), wcc.Dropdown( label="Color by", id=self.get_uuid(LayoutElements.COLOR_BY), options=[{ "label": ens, "value": ens } for ens in self.datamodel.color_by_selectors], value="QC_FLAG", clearable=False, ), wcc.Label("Max number of points:"), dcc.Input( id=self.get_uuid(LayoutElements.MAX_POINTS), type="number", value=5000, ), ], ), wcc.Selectors( label="Filters", children=[ wcc.SelectWithLabel( label="QC_FLAG", id={ "id": self.get_uuid(LayoutElements.FILTERS_DISCRETE), "col": "QC_FLAG", }, options=[{ "label": ens, "value": ens } for ens in self.datamodel.qc_flag], value=self.datamodel.qc_flag, size=min(8, len(self.datamodel.qc_flag)), ), wcc.SelectWithLabel( label="SATNUM", id={ "id": self.get_uuid(LayoutElements.FILTERS_DISCRETE), "col": "SATNUM", }, options=[{ "label": ens, "value": ens } for ens in self.datamodel.satnums], value=self.datamodel.satnums, size=min(8, len(self.datamodel.satnums)), ), range_filters( self.get_uuid(LayoutElements.FILTERS_CONTINOUS), self.datamodel, ), ], ), ], )
def options_layout( uuid: str, depth_truncations: Dict, resolution: float, extension: int, initial_layout: Dict, ) -> html.Div: return html.Div( children=[ html.Div( children=[ wcc.Label( "Resolution (m) ", ), dcc.Input( className="webviz-structunc-range-input", id={"id": uuid, "element": "resolution"}, type="number", required=True, value=resolution, persistence=True, persistence_type="session", ), ], ), html.Div( children=[ wcc.Label( "Extension (m) ", ), dcc.Input( className="webviz-structunc-range-input", id={"id": uuid, "element": "extension"}, type="number", step=25, required=True, value=extension, persistence=True, persistence_type="session", ), ], ), html.Div( style={"margin-top": "10px"}, children=[ wcc.Label("Depth range settings:"), wcc.FlexBox( style={"display": "flex"}, children=[ dcc.Input( id={ "id": uuid, "settings": "zrange_min", }, style={"flex": 1, "minWidth": "70px"}, type="number", value=depth_truncations.get("min", None), debounce=True, placeholder="Min", persistence=True, persistence_type="session", ), dcc.Input( id={ "id": uuid, "settings": "zrange_max", }, style={"flex": 1, "minWidth": "70px"}, type="number", value=depth_truncations.get("max", None), debounce=True, placeholder="Max", persistence=True, persistence_type="session", ), ], ), wcc.RadioItems( id={ "id": uuid, "settings": "zrange_locks", }, options=[ { "label": "Truncate range", "value": "truncate", }, { "label": "Lock range", "value": "lock", }, ], value="truncate", ), wcc.Checklist( id={ "id": uuid, "settings": "ui_options", }, options=[ {"label": "Keep zoom state", "value": "uirevision"}, ], value=["uirevision"] if "uirevision" in initial_layout else [], ), ], ), ], )
def delta_layout(self) -> html.Div: show_delta = "block" if self.allow_delta else "none" return html.Div(children=[ html.Div( style={"display": show_delta}, children=wcc.RadioItems( label="Mode", id=self.uuid("mode"), style={"marginBottom": "0.5vh"}, options=[ { "label": "Individual ensembles", "value": "ensembles", }, { "label": "Delta between ensembles", "value": "delta_ensembles", }, ], value="ensembles", ), ), wcc.Dropdown( wrapper_id=self.uuid("show_ensembles"), label="Selected ensembles", id=self.uuid("ensemble"), clearable=False, multi=True, options=[{ "label": i, "value": i } for i in self.ensembles], value=[self.ensembles[0]], ), html.Div( id=self.uuid("calc_delta"), style={"display": "none"}, children=[ wcc.Label("Selected ensemble delta (A-B):"), wcc.FlexBox(children=[ wcc.FlexColumn( min_width="100px", children=wcc.Dropdown( label="Ensemble A", id=self.uuid("base_ens"), clearable=False, options=[{ "label": i, "value": i } for i in self.ensembles], value=self.ensembles[0], ), ), wcc.FlexColumn( min_width="100px", children=wcc.Dropdown( label="Ensemble B", id=self.uuid("delta_ens"), clearable=False, options=[{ "label": i, "value": i } for i in self.ensembles], value=self.ensembles[-1], ), ), ], ), ], ), ], )