Beispiel #1
0
def filter_layout(get_uuid: Callable, datamodel: RftPlotterDataModel,
                  tab: str) -> List[wcc.Selectors]:
    """Layout for shared filters"""
    ensembles = datamodel.ensembles
    well_names = datamodel.well_names
    zone_names = datamodel.zone_names
    dates = datamodel.dates
    return wcc.Selectors(
        label="Selectors",
        children=[
            wcc.SelectWithLabel(
                label="Ensembles",
                size=min(4, len(ensembles)),
                id=get_uuid(LayoutElements.FILTER_ENSEMBLES[tab]),
                options=[{
                    "label": name,
                    "value": name
                } for name in ensembles],
                value=ensembles,
                multi=True,
            ),
            wcc.SelectWithLabel(
                label="Wells",
                size=min(20, len(well_names)),
                id=get_uuid(LayoutElements.FILTER_WELLS[tab]),
                options=[{
                    "label": name,
                    "value": name
                } for name in well_names],
                value=well_names,
                multi=True,
            ),
            wcc.SelectWithLabel(
                label="Zones",
                size=min(10, len(zone_names)),
                id=get_uuid(LayoutElements.FILTER_ZONES[tab]),
                options=[{
                    "label": name,
                    "value": name
                } for name in zone_names],
                value=zone_names,
                multi=True,
            ),
            wcc.SelectWithLabel(
                label="Dates",
                size=min(10, len(dates)),
                id=get_uuid(LayoutElements.FILTER_DATES[tab]),
                options=[{
                    "label": name,
                    "value": name
                } for name in dates],
                value=dates,
                multi=True,
            ),
        ],
    )
    def filter_layout(self) -> List[Any]:
        """Layout to display selectors for response filters"""
        children = []
        for col_name, col_type in self.response_filters.items():
            domid = self.uuid(f"filter-{col_name}")
            values = list(self.responsedf[col_name].unique())
            if col_type == "multi":
                selector = wcc.SelectWithLabel(
                    label=f"{col_name}:",
                    id=domid,
                    options=[{
                        "label": val,
                        "value": val
                    } for val in values],
                    value=values,
                    multi=True,
                    size=min(10, len(values)),
                    collapsible=True,
                )
            elif col_type == "single":
                selector = wcc.Dropdown(
                    label=f"{col_name}:",
                    id=domid,
                    options=[{
                        "label": val,
                        "value": val
                    } for val in values],
                    value=values[-1],
                    multi=False,
                    clearable=False,
                )
            elif col_type == "range":
                selector = make_range_slider(domid, self.responsedf[col_name],
                                             col_name)
            else:
                return children
            children.append(selector)

        children.append(
            wcc.SelectWithLabel(
                label="Parameters:",
                id=self.uuid("parameter-filter"),
                options=[{
                    "label": val,
                    "value": val
                } for val in self.parameter_columns],
                value=self.parameter_columns,
                multi=True,
                size=min(10, len(self.parameter_columns)),
                collapsible=True,
            ))

        return children
Beispiel #3
0
 def filter_layout(
         self, tab: str) -> List[dash.development.base_component.Component]:
     """Layout for shared filters"""
     return wcc.Selectors(
         label="Selectors",
         children=[
             wcc.SelectWithLabel(
                 label="Ensembles",
                 size=min(4, len(self.ensembles)),
                 id=self.uuid(f"ensemble-{tab}"),
                 options=[{
                     "label": name,
                     "value": name
                 } for name in self.ensembles],
                 value=self.ensembles,
                 multi=True,
             ),
             wcc.SelectWithLabel(
                 label="Wells",
                 size=min(20, len(self.well_names)),
                 id=self.uuid(f"well-{tab}"),
                 options=[{
                     "label": name,
                     "value": name
                 } for name in self.well_names],
                 value=self.well_names,
                 multi=True,
             ),
             wcc.SelectWithLabel(
                 label="Zones",
                 size=min(10, len(self.zone_names)),
                 id=self.uuid(f"zone-{tab}"),
                 options=[{
                     "label": name,
                     "value": name
                 } for name in self.zone_names],
                 value=self.zone_names,
                 multi=True,
             ),
             wcc.SelectWithLabel(
                 label="Dates",
                 size=min(10, len(self.dates)),
                 id=self.uuid(f"date-{tab}"),
                 options=[{
                     "label": name,
                     "value": name
                 } for name in self.dates],
                 value=self.dates,
                 multi=True,
             ),
         ],
     )
def table_selections_layout(
    uuid: str, volumemodel: InplaceVolumesModel, tab: str
) -> wcc.Selectors:
    responses = volumemodel.volume_columns + volumemodel.property_columns
    return wcc.Selectors(
        label="TABLE CONTROLS",
        open_details=True,
        children=[
            wcc.Dropdown(
                label="Table type",
                id={"id": uuid, "tab": tab, "selector": "Table type"},
                options=[
                    {"label": elm, "value": elm}
                    for elm in ["Statistics table", "Mean table"]
                ],
                value="Mean table",
                clearable=False,
            ),
            wcc.Dropdown(
                label="Group by",
                id={"id": uuid, "tab": tab, "selector": "Group by"},
                options=[{"label": elm, "value": elm} for elm in volumemodel.selectors],
                value=None,
                multi=True,
                clearable=False,
            ),
            wcc.SelectWithLabel(
                label="Responses",
                id={"id": uuid, "tab": tab, "selector": "table_responses"},
                options=[{"label": i, "value": i} for i in responses],
                value=responses,
                size=min(20, len(responses)),
            ),
        ],
    )
Beispiel #5
0
def filters_layout(get_uuid: Callable) -> wcc.Selectors:
    """The filters part of the menu"""
    filters_uuid = get_uuid("filters")
    return wcc.Selectors(
        id=get_uuid("filters_layout"),
        label="Filters",
        children=[
            wcc.SelectWithLabel(
                label="Prod/Inj/Other",
                id={
                    "id": filters_uuid,
                    "element": "prod_inj_other"
                },
                options=[
                    {
                        "label": "Production",
                        "value": "prod"
                    },
                    {
                        "label": "Injection",
                        "value": "inj"
                    },
                    {
                        "label": "Other",
                        "value": "other"
                    },
                ],
                value=["prod", "inj", "other"],
                multi=True,
                size=3,
            )
        ],
    )
Beispiel #6
0
def dropdown_vs_select(
    value: Union[List[str], str],
    options: List[str],
    component_id: dict,
    dropdown: bool = False,
    multi: bool = False,
) -> Union[wcc.Dropdown, wcc.SelectWithLabel]:
    if dropdown:
        if isinstance(value, list) and not multi:
            value = value[0]
        return wcc.Dropdown(
            id=component_id,
            options=[{
                "label": opt,
                "value": opt
            } for opt in options],
            value=value,
            clearable=False,
            multi=multi,
        )
    return wcc.SelectWithLabel(
        id=component_id,
        options=[{
            "label": opt,
            "value": opt
        } for opt in options],
        size=5,
        value=value,
        multi=multi,
    )
def filter_dropdowns(uuid: str, disjoint_set_df: pd.DataFrame,
                     tab: str) -> html.Div:
    dropdowns: List[html.Div] = []
    for selector in ["REGION", "ZONE", "FIPNUM", "SET"]:
        elements = list(disjoint_set_df[selector].unique())
        if selector == "FIPNUM":
            elements = sorted(elements, key=int)
        dropdowns.append(
            html.Div(children=wcc.SelectWithLabel(
                label=selector.lower().capitalize(),
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": selector,
                    "type": "fipqc"
                },
                options=[{
                    "label": i,
                    "value": i
                } for i in elements],
                value=elements,
                multi=True,
                size=min(15, len(elements)),
            ), ))
    return html.Div(dropdowns)
Beispiel #8
0
def filter_dropdowns(
    uuid: str,
    volumemodel: InplaceVolumesModel,
    tab: str,
    filters: Optional[list] = None,
) -> html.Div:
    """Makes dropdowns for each selector"""
    dropdowns: List[html.Div] = []
    filters = filters if filters is not None else volumemodel.selectors
    for selector in filters:
        if selector == "REAL":
            continue
        elements = list(volumemodel.dataframe[selector].unique())

        dropdowns.append(
            html.Div(
                style={"display": "inline" if len(elements) > 1 else "none"},
                children=wcc.SelectWithLabel(
                    label=selector.lower().capitalize(),
                    id={
                        "id": uuid,
                        "tab": tab,
                        "selector": selector
                    },
                    options=[{
                        "label": i,
                        "value": i
                    } for i in elements],
                    value=elements,
                    multi=True,
                    size=min(15, len(elements)),
                ),
            ))
    return html.Div(dropdowns)
Beispiel #9
0
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)),
                    ),
                ],
            ),
        ],
    )
Beispiel #10
0
    def _update_realization_selected_info(
        input_selectors: list,
        selections: dict,
        selected_page: str,
        selected_tab: str,
        input_ids: list,
        wrapper_ids: list,
    ) -> list:
        if selected_tab == "fipqc":
            raise PreventUpdate

        reals = volumemodel.realizations
        prev_selection = (selections[selected_page]["filters"].get("REAL", [])
                          if selections is not None
                          and selected_page in selections else None)
        selected_component = [
            value for id_value, value in zip(input_ids, input_selectors)
            if id_value["tab"] == selected_tab
        ][0]
        selected_reals = prev_selection if prev_selection is not None else reals

        component = (wcc.RangeSlider(
            id={
                "id": get_uuid("filters"),
                "tab": selected_tab,
                "component_type": selected_component,
            },
            value=[min(selected_reals),
                   max(selected_reals)],
            min=min(reals),
            max=max(reals),
            marks={
                str(i): {
                    "label": str(i)
                }
                for i in [min(reals), max(reals)]
            },
        ) if selected_component == "range" else wcc.SelectWithLabel(
            id={
                "id": get_uuid("filters"),
                "tab": selected_tab,
                "component_type": selected_component,
            },
            options=[{
                "label": i,
                "value": i
            } for i in reals],
            value=selected_reals,
            size=min(20, len(reals)),
        ))
        return update_relevant_components(
            id_list=wrapper_ids,
            update_info=[{
                "new_value": component,
                "conditions": {
                    "tab": selected_tab
                }
            }],
        )
def filters(
    get_uuid: Callable, data_models: Dict[str, EnsembleWellAnalysisData]
) -> wcc.Selectors:
    # Collecting wells and well_attributes from all ensembles.
    wells = []
    well_attr = {}
    for _, ens_data_model in data_models.items():
        wells.extend([well for well in ens_data_model.wells if well not in wells])
        for category, values in ens_data_model.well_attributes.items():
            if category not in well_attr:
                well_attr[category] = values
            else:
                well_attr[category].extend(
                    [value for value in values if value not in well_attr[category]]
                )

    return wcc.Selectors(
        label="Filters",
        children=[
            wcc.SelectWithLabel(
                label="Well",
                size=min(10, len(wells)),
                id=get_uuid(WellOverviewLayoutElements.WELL_FILTER),
                options=[{"label": well, "value": well} for well in wells],
                value=wells,
                multi=True,
            )
        ]
        # Adding well attributes selectors
        + [
            wcc.SelectWithLabel(
                label=category.capitalize(),
                size=min(5, len(values)),
                id={
                    "id": get_uuid(WellOverviewLayoutElements.WELL_ATTRIBUTES),
                    "category": category,
                },
                options=[{"label": value, "value": value} for value in values],
                value=values,
                multi=True,
            )
            for category, values in well_attr.items()
        ],
    )
    def response_layout(self):
        """Layout to display selectors for response filters"""

        if self.no_responses:
            return []
        children = [
            wcc.Dropdown(
                label="Response",
                id=self.uuid("responses"),
                options=[{
                    "label": ens,
                    "value": ens
                } for ens in self.response_columns],
                clearable=False,
                value=self.response_columns[0],
                style={"marginBottom": "20px"},
            ),
        ]

        if self.response_filters is not None:
            for col_name, col_type in self.response_filters.items():
                values = list(self.responsedf[col_name].unique())
                if col_type == "multi":
                    children.append(
                        wcc.SelectWithLabel(
                            label=col_name,
                            id=self.uuid(f"filter-{col_name}"),
                            options=[{
                                "label": val,
                                "value": val
                            } for val in values],
                            value=values,
                            multi=True,
                            size=min(20, len(values)),
                        ))
                elif col_type == "single":
                    children.append(
                        wcc.Dropdown(
                            label=col_name,
                            id=self.uuid(f"filter-{col_name}"),
                            options=[{
                                "label": val,
                                "value": val
                            } for val in values],
                            value=values[0],
                            multi=False,
                            clearable=False,
                        ))

        return [
            html.Div(
                id=self.uuid("view_response"),
                style={"display": "none"},
                children=children,
            ),
        ]
def surface_names_layout(
    uuid: str, surface_names: List[str], value: List[str]
) -> html.Div:
    return wcc.SelectWithLabel(
        label="Surface names",
        id={"id": uuid, "element": "surface_names"},
        options=[
            {"label": attribute, "value": attribute} for attribute in surface_names
        ],
        value=value,
        multi=True,
        size=min(len(surface_names), 5),
    )
def ensemble_layout(uuid: str, ensemble_names: List[str], value: List[str]) -> html.Div:
    return html.Div(
        style={
            "marginTop": "5px",
            "display": ("inline" if len(ensemble_names) > 1 else "none"),
        },
        children=wcc.SelectWithLabel(
            label="Ensembles",
            id={"id": uuid, "element": "ensembles"},
            options=[{"label": ens, "value": ens} for ens in ensemble_names],
            value=value,
            size=min(len(ensemble_names), 3),
        ),
    )
Beispiel #15
0
 def __init__(self, get_uuid: Callable, well_names: List[str]) -> None:
     super().__init__(
         style={"display": "block" if well_names else "none"},
         children=wcc.SelectWithLabel(
             label=LayoutLabels.WELL_FILTER,
             id=get_uuid(LayoutElements.WELLS),
             options=[{
                 "label": i,
                 "value": i
             } for i in well_names],
             value=well_names,
             size=min(20, len(well_names)),
         ),
     )
Beispiel #16
0
def create_filter_select(
    selector: str, elements: list, uuid: str, tab: str, filter_type: str, hide: bool
) -> html.Div:
    return html.Div(
        id={"id": uuid, "tab": tab, "wrapper": selector, "type": filter_type},
        style={"display": "inline" if len(elements) > 1 and not hide else "none"},
        children=wcc.SelectWithLabel(
            label=selector.lower().capitalize(),
            id={"id": uuid, "tab": tab, "selector": selector, "type": filter_type},
            options=[{"label": i, "value": i} for i in elements],
            value=elements,
            multi=True,
            size=min(15, len(elements)),
        ),
    )
 def filter_selectors(self) -> List[html.Div]:
     """Dropdowns for dataframe columns that can be filtered on (Zone, Region, etc)"""
     return [
         wcc.SelectWithLabel(
             label=selector,
             id=self.selectors_id[selector],
             options=[
                 {"label": i, "value": i}
                 for i in list(self.volumes[selector].unique())
             ],
             value=list(self.volumes[selector].unique()),
             multi=True,
             size=min(20, len(self.volumes[selector].unique())),
         )
         for selector in self.selectors
     ]
def make_discrete_selector(values: pd.Series, name: str,
                           uuid: str) -> html.Div:
    return wcc.SelectWithLabel(
        label=name,
        id={
            "id": uuid,
            "type": "select",
            "name": name
        },
        options=[{
            "label": val,
            "value": val
        } for val in values.unique()],
        value=sorted(list(values.unique())),
        multi=True,
    )
Beispiel #19
0
 def selections_layout(self) -> html.Div:
     return html.Div(children=[
         wcc.Selectors(
             label="Selections",
             children=[
                 html.Div(
                     wcc.RadioItems(
                         label="Split table by:",
                         id=self.get_uuid(LayoutElements.GROUPBY_EQLNUM),
                         options=[
                             {
                                 "label": "SATNUM",
                                 "value": "SATNUM"
                             },
                             {
                                 "label": "SATNUM and EQLNUM",
                                 "value": "both"
                             },
                         ],
                         value="SATNUM",
                     ),
                     style={"margin-bottom": "10px"},
                 ),
                 self.scaling_threshold,
             ],
         ),
         wcc.Selectors(
             label="Filters",
             children=[
                 wcc.SelectWithLabel(
                     label="EQLNUM",
                     id=self.get_uuid(LayoutElements.TABLE_EQLNUM_SELECTOR),
                     options=[{
                         "label": ens,
                         "value": ens
                     } for ens in self.datamodel.eqlnums],
                     value=self.datamodel.eqlnums,
                     size=min(8, len(self.datamodel.eqlnums)),
                     multi=True,
                 ),
                 range_filters(
                     self.get_uuid(LayoutElements.FILTERS_CONTINOUS_MAX_PC),
                     self.datamodel,
                 ),
             ],
         ),
     ])
Beispiel #20
0
def filters_layout(get_uuid: Callable[[str], str]) -> wcc.Selectors:
    """The filters part of the menu"""
    return wcc.Selectors(
        id=get_uuid(LayoutElements.FILTERS_LAYOUT),
        label="Filters",
        children=[
            wcc.SelectWithLabel(
                label="Prod/Inj/Other",
                id=get_uuid(LayoutElements.NODETYPE_FILTER),
                options=[
                    {"label": "Production", "value": NodeType.PROD.value},
                    {"label": "Injection", "value": NodeType.INJ.value},
                    {"label": "Other", "value": NodeType.OTHER.value},
                ],
                value=[NodeType.PROD.value, NodeType.INJ.value, NodeType.OTHER.value],
                multi=True,
                size=3,
            )
        ],
    )
Beispiel #21
0
 def multi_filter_layout(self) -> html.Div:
     """Creates wcc.Selects for any data columns added as multi value filters"""
     elements = []
     for selector in self._multi_filters:
         values = (self._tableproviderset.ensemble_provider(
             self._ensemble_name).get_column_data([selector
                                                   ])[selector].unique())
         elements.append(
             wcc.SelectWithLabel(
                 label=selector,
                 id={
                     "id": self.uuid("selectors"),
                     "name": selector,
                     "type": "multi_filter",
                 },
                 options=[{
                     "label": val,
                     "value": val
                 } for val in values],
                 value=values,
                 size=min(5, len(values)),
             ))
     return html.Div(children=elements)
def filters(get_uuid: Callable,
            data_models: Dict[str, EnsembleWellAnalysisData]) -> wcc.Selectors:
    wells = [
        well for _, ens_data_model in data_models.items()
        for well in ens_data_model.wells
    ]

    return wcc.Selectors(
        label="Filters",
        children=[
            wcc.SelectWithLabel(
                label="Well",
                size=min(10, len(wells)),
                id=get_uuid(WellOverviewLayoutElements.WELL_FILTER),
                options=[{
                    "label": well,
                    "value": well
                } for well in wells],
                value=wells,
                multi=True,
            )
        ],
    )
Beispiel #23
0
def make_filter(
    get_uuid: Callable,
    tab: str,
    df_column: str,
    column_values: list,
    multi: bool = True,
    value: Union[str, float] = None,
) -> html.Div:
    return wcc.SelectWithLabel(
        label=df_column.lower().capitalize(),
        id={
            "id": get_uuid("filter-selector"),
            "tab": tab,
            "selector": df_column,
        },
        options=[{
            "label": i,
            "value": i
        } for i in column_values],
        value=[value] if value is not None else column_values,
        multi=multi,
        size=min(20, len(column_values)),
    )
    def _update_realization_selected_info(
        input_selectors: list,
        selections: dict,
        selected_page: str,
        selected_tab: str,
        input_ids: list,
        wrapper_ids: list,
    ) -> list:
        reals = volumemodel.realizations
        prev_selection = (selections[selected_page]["filters"].get("REAL", [])
                          if selections is not None
                          and selected_page in selections else None)

        page_value = [
            value for id_value, value in zip(input_ids, input_selectors)
            if id_value["tab"] == selected_tab
        ]

        if page_value[0] == "range":
            min_value = (min(prev_selection)
                         if prev_selection is not None else min(reals))
            max_value = (max(prev_selection)
                         if prev_selection is not None else max(reals))
            return update_relevant_components(
                id_list=wrapper_ids,
                update_info=[{
                    "new_value":
                    wcc.RangeSlider(
                        id={
                            "id": get_uuid("filters"),
                            "tab": selected_tab,
                            "component_type": page_value[0],
                        },
                        value=[min_value, max_value],
                        min=min(reals),
                        max=max(reals),
                        marks={
                            str(i): {
                                "label": str(i)
                            }
                            for i in [min(reals), max(reals)]
                        },
                    ),
                    "conditions": {
                        "tab": selected_tab
                    },
                }],
            )

        # if input_selector == "select"
        return update_relevant_components(
            id_list=wrapper_ids,
            update_info=[{
                "new_value":
                wcc.SelectWithLabel(
                    id={
                        "id": get_uuid("filters"),
                        "tab": selected_tab,
                        "component_type": page_value[0],
                    },
                    options=[{
                        "label": i,
                        "value": i
                    } for i in reals],
                    value=prev_selection
                    if prev_selection is not None else reals,
                    size=min(20, len(reals)),
                ),
                "conditions": {
                    "tab": selected_tab
                },
            }],
        )
Beispiel #25
0
def map_plot_selectors(get_uuid: Callable,
                       datamodel: RftPlotterDataModel) -> List[html.Div]:
    ensembles = datamodel.ensembles
    zone_names = datamodel.zone_names
    return wcc.Selectors(
        label="Map plot settings",
        children=[
            wcc.Dropdown(
                label="Ensemble",
                id=get_uuid(LayoutElements.MAP_ENSEMBLE),
                options=[{
                    "label": ens,
                    "value": ens
                } for ens in ensembles],
                value=ensembles[0],
                clearable=False,
            ),
            wcc.Dropdown(
                label="Size points by",
                id=get_uuid(LayoutElements.MAP_SIZE_BY),
                options=[
                    {
                        "label": "Standard Deviation",
                        "value": "STDDEV",
                    },
                    {
                        "label": "Misfit",
                        "value": "ABSDIFF",
                    },
                ],
                value="ABSDIFF",
                clearable=False,
            ),
            wcc.Dropdown(
                label="Color points by",
                id=get_uuid(LayoutElements.MAP_COLOR_BY),
                options=[
                    {
                        "label": "Misfit",
                        "value": "ABSDIFF",
                    },
                    {
                        "label": "Standard Deviation",
                        "value": "STDDEV",
                    },
                    {
                        "label": "Year",
                        "value": "YEAR",
                    },
                ],
                value="STDDEV",
                clearable=False,
            ),
            wcc.RangeSlider(
                label="Filter date range",
                id=get_uuid(LayoutElements.MAP_DATE_RANGE),
                min=datamodel.ertdatadf["DATE_IDX"].min(),
                max=datamodel.ertdatadf["DATE_IDX"].max(),
                value=[
                    datamodel.ertdatadf["DATE_IDX"].min(),
                    datamodel.ertdatadf["DATE_IDX"].max(),
                ],
                marks=datamodel.date_marks,
            ),
            wcc.Selectors(
                label="Zone filter",
                open_details=False,
                children=[
                    wcc.SelectWithLabel(
                        size=min(10, len(zone_names)),
                        id=get_uuid(LayoutElements.MAP_ZONES),
                        options=[{
                            "label": name,
                            "value": name
                        } for name in zone_names],
                        value=zone_names,
                        multi=True,
                    ),
                ],
            ),
        ],
    )
 def settings_layout(self) -> html.Div:
     return html.Div(
         children=[
             html.Div(
                 children=[
                     wcc.FlexBox(
                         style={"fontSize": "15px"},
                         children=[
                             html.Div(
                                 style={
                                     "minWidth": "100px",
                                     "flex": 2,
                                     "marginRight": "10px",
                                 },
                                 children=[
                                     wcc.Dropdown(
                                         label="Reference",
                                         id=self.ids("reference"),
                                         options=[
                                             {
                                                 "label": r,
                                                 "value": r,
                                             }
                                             for r in self.sensnames
                                         ],
                                         value=self.initial_reference,
                                         clearable=False,
                                     ),
                                     wcc.Dropdown(
                                         label="Scale",
                                         id=self.ids("scale"),
                                         options=[
                                             {
                                                 "label": r,
                                                 "value": r,
                                             }
                                             for r in [
                                                 "Relative value (%)",
                                                 "Relative value",
                                                 "True value",
                                             ]
                                         ],
                                         value="Relative value (%)",
                                         clearable=False,
                                     ),
                                     html.Button(
                                         style={
                                             "fontSize": "10px",
                                             "marginTop": "10px",
                                         }
                                         if self.allow_click
                                         else {"display": "none"},
                                         id=self.ids("reset"),
                                         children="Clear selected",
                                     ),
                                 ],
                             ),
                             html.Div(
                                 style={
                                     "minWidth": "100px",
                                     "flex": 2,
                                     "marginRight": "10px",
                                 },
                                 children=[
                                     wcc.SelectWithLabel(
                                         label="Select sensitivities",
                                         id=self.ids("sens_filter"),
                                         options=[
                                             {
                                                 "label": i,
                                                 "value": i,
                                             }
                                             for i in self.sensnames
                                         ],
                                         value=self.sensnames,
                                         multi=True,
                                         size=min(
                                             8,
                                             len(self.sensnames),
                                         ),
                                     ),
                                 ],
                             ),
                             html.Div(
                                 style={
                                     "minWidth": "100px",
                                     "flex": 3,
                                 },
                                 children=[
                                     wcc.Checklist(
                                         label="Plot options",
                                         id=self.ids("plot-options"),
                                         options=[
                                             {
                                                 "label": "Fit all bars in figure",
                                                 "value": "Fit all bars in figure",
                                             },
                                             {
                                                 "label": "Remove sensitivites with no impact",
                                                 "value": "Remove sensitivites with no impact",
                                             },
                                             {
                                                 "label": "Show realization points",
                                                 "value": "Show realization points",
                                             },
                                             {
                                                 "label": "Color bars by sensitivity",
                                                 "value": "Color bars by sensitivity",
                                             },
                                         ],
                                         value=[],
                                         labelStyle={"display": "block"},
                                     ),
                                     wcc.Dropdown(
                                         label="Label",
                                         id=self.ids("label"),
                                         options=[
                                             {"label": "No label", "value": "hide"},
                                             {
                                                 "label": "Simple label",
                                                 "value": "simple",
                                             },
                                             {
                                                 "label": "Detailed label",
                                                 "value": "detailed",
                                             },
                                         ],
                                         value="detailed",
                                         clearable=False,
                                     ),
                                 ],
                             ),
                         ],
                     ),
                 ]
             ),
         ],
     )
Beispiel #27
0
 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 control_layout(self):
        """Layout to select ensembles and parameters"""
        mode_select = ([] if self.no_responses else [
            wcc.Selectors(
                label="Mode",
                children=[
                    wcc.RadioItems(
                        id=self.uuid("mode"),
                        options=[
                            {
                                "label": "Ensemble",
                                "value": "ensemble"
                            },
                            {
                                "label": "Response",
                                "value": "response"
                            },
                        ],
                        value="ensemble",
                    ),
                ],
            )
        ])

        return mode_select + [
            wcc.Selectors(
                label="Ensembles",
                children=wcc.SelectWithLabel(
                    id=self.uuid("ensembles"),
                    options=[{
                        "label": ens,
                        "value": ens
                    } for ens in self.ensembles],
                    multi=True,
                    value=self.ensembles,
                    size=min(len(self.ensembles), 10),
                ),
            ),
            wcc.Selectors(
                label="Parameter filter",
                children=[
                    wcc.RadioItems(
                        id=self.uuid("exclude_include"),
                        options=[
                            {
                                "label": "Exclude",
                                "value": "exc"
                            },
                            {
                                "label": "Include",
                                "value": "inc"
                            },
                        ],
                        value="exc",
                    ),
                    wcc.SelectWithLabel(
                        label="Parameters",
                        id=self.uuid("parameter-list"),
                        options=[{
                            "label": ens,
                            "value": ens
                        } for ens in self.parameter_columns],
                        multi=True,
                        size=min(len(self.parameter_columns), 15),
                        value=[],
                    ),
                ],
            ),
        ]
 def layout(self) -> wcc.FlexBox:
     return wcc.FlexBox(
         id=self.uuid("layout"),
         children=[
             wcc.Frame(
                 style={
                     "flex": 1,
                     "height": "45vh"
                 },
                 children=[
                     wcc.Dropdown(
                         label="Ensemble",
                         id=self.uuid("ensemble"),
                         options=[{
                             "label": i,
                             "value": i
                         } for i in self.ensembles],
                         value=self.ensembles[0],
                         clearable=False,
                         multi=False,
                     ),
                     wcc.Dropdown(
                         label="Plot type",
                         id=self.uuid("plot_type"),
                         options=[{
                             "label": i,
                             "value": i
                         } for i in [
                             "Fan chart",
                             "Bar chart",
                             "Line chart",
                         ]],
                         clearable=False,
                         value="Fan chart",
                     ),
                     html.Div(
                         id=self.uuid("select_stat"),
                         style={"display": "none"},
                         children=[
                             wcc.SelectWithLabel(
                                 label="Select statistics",
                                 id=self.uuid("stat_bars"),
                                 options=[{
                                     "label": key,
                                     "value": value
                                 } for key, value in self.label_map.items()
                                          ],
                                 size=8,
                                 value=["count", "low_p90", "p50"],
                             ),
                         ],
                     ),
                     wcc.Dropdown(
                         label="Sort by",
                         id=self.uuid("sort_by"),
                         options=[{
                             "label": key,
                             "value": value
                         } for key, value in self.label_map.items()],
                         clearable=False,
                         value="low_p90",
                     ),
                     wcc.RadioItems(
                         vertical=False,
                         id=self.uuid("ascending"),
                         options=[
                             {
                                 "label": "Ascending",
                                 "value": True
                             },
                             {
                                 "label": "Descending",
                                 "value": False
                             },
                         ],
                         value=True,
                         labelStyle={"display": "inline-block"},
                     ),
                     wcc.Slider(
                         label="Max number of wells in plot",
                         id=self.uuid("n_wells"),
                         min=1,
                         max=len(self.wells),
                         step=1,
                         value=min(10, len(self.wells)),
                         marks={
                             1: 1,
                             len(self.wells): len(self.wells)
                         },
                     ),
                     wcc.SelectWithLabel(
                         label="Wells",
                         id=self.uuid("wells"),
                         options=[{
                             "label": i,
                             "value": i
                         } for i in self.wells],
                         size=min([len(self.wells), 20]),
                         value=self.wells,
                     ),
                 ],
             ),
             wcc.Frame(
                 color="white",
                 highlight=False,
                 style={
                     "flex": 6,
                     "height": "45vh"
                 },
                 children=[
                     wcc.Graph(id=self.uuid("graph")),
                 ],
             ),
         ],
     )
Beispiel #30
0
def tornado_controls_layout(uuid: str, tab: str,
                            volumemodel: InplaceVolumesModel) -> wcc.Selectors:
    sens_columns = [
        "REAL", "SENSNAME", "SENSCASE", "SENSTYPE", "SENSNAME_CASE"
    ]
    return [
        wcc.Dropdown(
            label="Response",
            id={
                "id": uuid,
                "tab": tab,
                "selector": "Response"
            },
            clearable=False,
            options=[{
                "label": i,
                "value": i
            } for i in volumemodel.responses],
            value=volumemodel.responses[0],
        ),
        wcc.SelectWithLabel(
            label="Sensitivity filter",
            collapsible=True,
            open_details=False,
            id={
                "id": uuid,
                "tab": tab,
                "selector": "Sensitivities"
            },
            options=[{
                "label": i,
                "value": i
            } for i in volumemodel.sensitivities],
            value=volumemodel.sensitivities,
            size=min(15, len(volumemodel.sensitivities)),
        ),
        wcc.Dropdown(
            label="Subplots",
            id={
                "id": uuid,
                "tab": tab,
                "selector": "Subplots"
            },
            clearable=True,
            options=[{
                "label": i,
                "value": i
            } for i in [
                x for x in volumemodel.selectors if x not in sens_columns
                and volumemodel.dataframe[x].nunique() > 1
            ]],
        ),
        html.Div(
            style={"margin-top": "10px"},
            children=wcc.RadioItems(
                label="Visualization below tornado:",
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": "bottom_viz"
                },
                options=[
                    {
                        "label": "Table",
                        "value": "table"
                    },
                    {
                        "label": "Realization plot",
                        "value": "realplot"
                    },
                    {
                        "label": "None",
                        "value": "none"
                    },
                ],
                vertical=False,
                value="table",
            ),
        ),
    ]