def tornado_controls_layout(uuid: str, tab: str,
                            volumemodel: InplaceVolumesModel) -> wcc.Selectors:
    mode_options = [{"label": "Custom", "value": "custom"}]
    if "BULK" in volumemodel.responses:
        mode_options.append({
            "label": "Bulk vs STOIIP/GIIP",
            "value": "locked"
        })
    return wcc.Selectors(
        label="TORNADO CONTROLS",
        children=[
            wcc.RadioItems(
                label="Mode:",
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": "mode"
                },
                options=mode_options,
                value="custom",
            ),
            tornado_selection(position="left",
                              uuid=uuid,
                              tab=tab,
                              volumemodel=volumemodel),
            tornado_selection(position="right",
                              uuid=uuid,
                              tab=tab,
                              volumemodel=volumemodel),
        ],
    )
Exemple #2
0
def selections_layout(get_uuid: Callable, ensembles: list) -> wcc.Selectors:
    """Layout for the component input options"""
    controls_uuid = get_uuid("controls")
    return wcc.Selectors(
        id=get_uuid("selections_layout"),
        label="Controls",
        children=[
            wcc.Dropdown(
                label="Ensemble",
                id={
                    "id": controls_uuid,
                    "element": "ensemble"
                },
                options=[{
                    "label": ens,
                    "value": ens
                } for ens in ensembles],
                clearable=False,
                value=ensembles[0],
            ),
            wcc.RadioItems(
                label="Mean or realization",
                id={
                    "id": controls_uuid,
                    "element": "tree_mode"
                },
            ),
        ],
    )
Exemple #3
0
def comparison_main_layout(uuid: str) -> html.Div:
    return [
        html.Div(
            style={"margin-bottom": "20px"},
            children=wcc.RadioItems(
                vertical=False,
                id={"id": uuid, "element": "display-option"},
                options=[
                    {
                        "label": "QC plots",
                        "value": "plots",
                    },
                    {
                        "label": "Difference table for selected response",
                        "value": "single-response table",
                    },
                    {
                        "label": "Difference table for multiple responses",
                        "value": "multi-response table",
                    },
                ],
                value="plots",
            ),
        ),
        html.Div(id={"id": uuid, "wrapper": "table"}),
    ]
def fipfile_qc_main_layout(uuid: str) -> wcc.Frame:
    return html.Div(children=[
        html.Div(
            style={"margin-bottom": "20px"},
            children=wcc.RadioItems(
                vertical=False,
                id={
                    "id": uuid,
                    "element": "display-option"
                },
                options=[
                    {
                        "label": "QC plots",
                        "value": "plots",
                    },
                    {
                        "label": "Table",
                        "value": "table"
                    },
                ],
                value="plots",
            ),
        ),
        html.Div(id=uuid),
    ], )
Exemple #5
0
def sortby_selector(
    get_uuid: Callable,
    value: str = None,
) -> html.Div:
    return html.Div(
        wcc.RadioItems(
            label="Sort parameters by",
            id=get_uuid("delta-sort"),
            className="block-options",
            options=[
                {
                    "label": "Name",
                    "value": "Name"
                },
                {
                    "label": "Standard deviation",
                    "value": "Stddev",
                },
                {
                    "label": "Average",
                    "value": "Avg",
                },
            ],
            value=value,
        ))
def labels_display(uuid: str, tab: str) -> html.Div:
    return html.Div(
        style={"margin-bottom": "10px"},
        children=[
            wcc.RadioItems(
                label="Label options:",
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": "labeloptions"
                },
                options=[
                    {
                        "label": "detailed",
                        "value": "detailed"
                    },
                    {
                        "label": "simple",
                        "value": "simple"
                    },
                    {
                        "label": "hide",
                        "value": "hide"
                    },
                ],
                vertical=False,
                value="simple",
            ),
        ],
    )
 def layout(self) -> html.Div:
     return html.Div(
         style={"marginLeft": "10px", "height": "90vh"},
         children=[
             html.Div(
                 children=[
                     html.Label(
                         "Tornado Plot",
                         style={
                             "textAlign": "center",
                             "font-weight": "bold",
                         },
                     ),
                     wcc.RadioItems(
                         vertical=False,
                         id=self.ids("plot-or-table"),
                         options=[
                             {"label": "Show bars", "value": "bars"},
                             {
                                 "label": "Show table",
                                 "value": "table",
                             },
                         ],
                         value="bars",
                     ),
                 ],
             ),
             html.Div(
                 style={"overflowY": "auto", "height": "60vh"},
                 children=[
                     html.Div(
                         id=self.ids("graph-wrapper"),
                         style={},
                         children=wcc.Graph(
                             id=self.ids("tornado-graph"),
                             config={"displayModeBar": False},
                         ),
                     ),
                     html.Div(
                         id=self.ids("table-wrapper"),
                         style={"display": "none"},
                         children=dash_table.DataTable(
                             id=self.ids("tornado-table"),
                             style_cell={
                                 "whiteSpace": "normal",
                                 "height": "auto",
                             },
                         ),
                     ),
                 ],
             ),
             html.Hr(style={"marginTop": "10px"}),
             self.settings_layout,
             dcc.Store(id=self.ids("storage"), storage_type="session"),
             dcc.Store(id=self.ids("click-store"), storage_type="session"),
             dcc.Store(id=self.ids("high-low-storage"), storage_type="session"),
             dcc.Store(id=self.ids("client-height-pixels"), storage_type="session"),
         ],
     )
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=[
                    wcc.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 property_qc_view(
    get_uuid: Callable, property_model: PropertyStatisticsModel
) -> wcc.FlexBox:
    return wcc.FlexBox(
        style={"margin": "20px"},
        children=[
            wcc.FlexColumn(
                children=wcc.Frame(
                    style={"height": "80vh", "overflowY": "auto"},
                    children=selector_view(
                        get_uuid=get_uuid, property_model=property_model
                    ),
                )
            ),
            wcc.FlexColumn(
                flex=8,
                children=wcc.Frame(
                    color="white",
                    highlight=False,
                    style={"height": "80vh"},
                    children=[
                        wcc.FlexBox(
                            children=[
                                wcc.RadioItems(
                                    vertical=False,
                                    id=get_uuid("property-qc-plot-type"),
                                    options=[
                                        {
                                            "label": "Distributions",
                                            "value": "distribution",
                                        },
                                        {
                                            "label": "Point per realization",
                                            "value": "scatter",
                                        },
                                        {
                                            "label": "Point per realization (single plot)",
                                            "value": "scatter_ensemble",
                                        },
                                        {"label": "Statistics table", "value": "table"},
                                    ],
                                    value="distribution",
                                    labelStyle={
                                        "display": "inline-block",
                                        "margin": "5px",
                                    },
                                ),
                            ]
                        ),
                        html.Div(
                            style={"height": "75vh"},
                            id=get_uuid("property-qc-wrapper"),
                        ),
                    ],
                ),
            ),
        ],
    )
Exemple #10
0
def fipnum_vs_zone_region_switch(uuid: str, tab: str) -> wcc.RadioItems:
    return wcc.RadioItems(
        id={"id": uuid, "tab": tab, "element": "region-selector"},
        options=[
            {"label": "Region∕Zone", "value": "regzone"},
            {"label": "Fipnum", "value": "fipnum"},
        ],
        value="regzone",
        vertical=False,
    )
Exemple #11
0
def realization_filters(
    uuid: str, tab: str, volumemodel: InplaceVolumesModel
) -> html.Div:
    reals = volumemodel.realizations
    return html.Div(
        style={"margin-top": "15px"},
        children=[
            html.Div(
                style={"display": "inline-flex"},
                children=[
                    html.Span(
                        "Realizations: ",
                        style={"font-weight": "bold"},
                    ),
                    html.Span(
                        id={"id": uuid, "tab": tab, "element": "real_text"},
                        style={"margin-left": "10px"},
                        children=f"{min(reals)}-{max(reals)}",
                    ),
                ],
            ),
            wcc.RadioItems(
                id={"id": uuid, "tab": tab, "element": "real-selector-option"},
                options=[
                    {"label": "Range", "value": "range"},
                    {"label": "Select", "value": "select"},
                ],
                value="range",
                vertical=False,
            ),
            wcc.RangeSlider(
                wrapper_id={"id": uuid, "tab": tab, "element": "real-slider-wrapper"},
                id={
                    "id": uuid,
                    "tab": tab,
                    "component_type": "range",
                },
                value=[min(reals), max(reals)],
                min=min(reals),
                max=max(reals),
                marks={str(i): {"label": str(i)} for i in [min(reals), max(reals)]},
            ),
            html.Div(
                style={"display": "none"},
                children=wcc.Select(
                    id={"id": uuid, "tab": tab, "selector": "REAL", "type": "REAL"},
                    options=[{"label": i, "value": i} for i in reals],
                    value=reals,
                ),
            ),
        ],
    )
Exemple #12
0
def custom_plotting_layout(uuid: str) -> html.Div:
    return wcc.Frame(
        color="white",
        highlight=False,
        style={"height": "91vh"},
        children=[
            wcc.RadioItems(
                id={
                    "id": uuid,
                    "element": "plot-table-select"
                },
                options=[
                    {
                        "label": "Plot",
                        "value": "graph"
                    },
                    {
                        "label": "Table",
                        "value": "table"
                    },
                ],
                value="graph",
                vertical=False,
            ),
            html.Div(
                id={
                    "id": uuid,
                    "wrapper": "graph",
                    "page": "custom"
                },
                style={"display": "inline"},
                children=wcc.Graph(
                    id={
                        "id": uuid,
                        "element": "graph",
                        "page": "custom"
                    },
                    config={"displayModeBar": False},
                    style={"height": "85vh"},
                ),
            ),
            html.Div(
                id={
                    "id": uuid,
                    "wrapper": "table",
                    "page": "custom"
                },
                style={"display": "none"},
            ),
        ],
    )
Exemple #13
0
    def _update_vector_items(
        shortname: str,
        previous_vtype: list,
        clickdata_vector: dict,
        previous_item: list,
    ):
        """
        Update the div container for vector type and vector item selections
        from clickdata and selected vector shortname
        """
        if clickdata_vector and shortname != clickdata_vector["shortname"]:
            clickdata_vector = {}
        vtype = clickdata_vector["vtype"] if clickdata_vector else previous_vtype[0]

        items = [
            v
            for v in vectormodel.vector_groups[vtype]["items"]
            if f"{shortname}:{v}" in vectormodel.vectors
        ]
        if items and not clickdata_vector:
            if previous_item:
                item = previous_item[0] if previous_item[0] in items else items[0]
            else:
                item = items[0]
        if items and clickdata_vector:
            item = clickdata_vector["vector"].replace(f"{shortname}:", "")

        return (
            [
                wcc.Dropdown(
                    id={"id": get_uuid("vitem-select"), "shortname": shortname},
                    options=[{"label": i, "value": i} for i in items],
                    value=item if items else None,
                    disabled=not items,
                    placeholder="No subselections...",
                    clearable=False,
                )
            ],
            [
                wcc.RadioItems(
                    id={"id": get_uuid("vtype-select"), "state": "update"},
                    options=[
                        {"label": i, "value": i} for i in vectormodel.vector_groups
                    ],
                    value=vtype,
                    labelStyle={"display": "inline-block", "margin-right": "10px"},
                )
            ]
            if clickdata_vector and clickdata_vector["vtype"] != previous_vtype[0]
            else no_update,
        )
Exemple #14
0
def diff_mode_selector(uuid: str, tab: str) -> html.Div:
    return html.Div(
        style={"margin-top": "10px"},
        children=wcc.RadioItems(
            label="Difference mode",
            id={"id": uuid, "tab": tab, "selector": "Diff mode"},
            options=[
                {"label": "Percent", "value": "diff (%)"},
                {"label": "True value", "value": "diff"},
            ],
            labelStyle={"display": "inline-flex", "margin-right": "5px"},
            value="diff (%)",
        ),
    )
Exemple #15
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,
                 ),
             ],
         ),
     ])
Exemple #16
0
def __realization_filters(get_uuid: Callable, realizations: List[int]) -> html.Div:
    return html.Div(
        children=[
            html.Div(
                style={"display": "inline-flex"},
                children=[
                    html.Label(
                        "Realizations: ",
                        style={"font-weight": "bold"},
                    ),
                    html.Label(
                        id=get_uuid(LayoutElements.REALIZATIONS_FILTER_SPAN),
                        style={
                            "margin-left": "10px",
                            "margin-bottom": "5px",
                        },
                        children=f"{min(realizations)}-{max(realizations)}",
                    ),
                ],
            ),
            wcc.RadioItems(
                label="Statistics calculated from:",
                id=get_uuid(LayoutElements.STATISTICS_FROM_RADIO_ITEMS),
                style={"margin-bottom": "10px"},
                options=[
                    {
                        "label": "All",
                        "value": StatisticsFromOptions.ALL_REALIZATIONS.value,
                    },
                    {
                        "label": "Selected",
                        "value": StatisticsFromOptions.SELECTED_REALIZATIONS.value,
                    },
                ],
                value=StatisticsFromOptions.ALL_REALIZATIONS.value,
                vertical=False,
            ),
            html.Div(
                children=wcc.Select(
                    id=get_uuid(LayoutElements.REALIZATIONS_FILTER_SELECTOR),
                    options=[{"label": i, "value": i} for i in realizations],
                    value=realizations,
                    size=min(10, len(realizations)),
                ),
            ),
        ],
    )
Exemple #17
0
def colorby_selector(
    uuid: str,
    tab: str,
) -> html.Div:
    return html.Div(
        style={"margin": "10px 0px"},
        children=wcc.RadioItems(
            label="Color plots on",
            id={"id": uuid, "tab": tab, "selector": "Color by"},
            options=[
                {"label": "Highlighted", "value": "highlighted"},
                {"label": "1st level of investigation", "value": "groups"},
            ],
            labelStyle={"display": "inline-flex", "margin-right": "5px"},
            value="highlighted",
        ),
    )
def parameter_qc_view(get_uuid: Callable,
                      parametermodel: ParametersModel) -> wcc.FlexBox:
    return wcc.FlexBox(children=[
        wcc.FlexColumn(
            wcc.Frame(
                style={"height": "80vh"},
                children=selector_view(get_uuid=get_uuid,
                                       parametermodel=parametermodel),
            ), ),
        wcc.FlexColumn(
            flex=4,
            children=wcc.Frame(
                color="white",
                highlight=False,
                style={"height": "80vh"},
                children=[
                    wcc.RadioItems(
                        vertical=False,
                        id=get_uuid("property-qc-plot-type"),
                        options=[
                            {
                                "label": "Distribution plots",
                                "value": "distribution",
                            },
                            {
                                "label": "Box plots",
                                "value": "box"
                            },
                            {
                                "label": "Statistics table",
                                "value": "table"
                            },
                        ],
                        value="distribution",
                    ),
                    html.Div(
                        style={
                            "height": "75vh",
                            "margin-top": "20px"
                        },
                        id=get_uuid("property-qc-wrapper"),
                    ),
                ],
            ),
        ),
    ], )
Exemple #19
0
def selections_layout(
    get_uuid: Callable[[str], str], ensembles: List[str]
) -> wcc.Selectors:
    """Layout for the component input options"""
    return wcc.Selectors(
        id=get_uuid(LayoutElements.SELECTIONS_LAYOUT),
        label="Controls",
        children=[
            wcc.Dropdown(
                label="Ensemble",
                id=get_uuid(LayoutElements.ENSEMBLE),
                options=[{"label": ens, "value": ens} for ens in ensembles],
                clearable=False,
                value=ensembles[0],
            ),
            wcc.RadioItems(
                label="Statistics or realization", id=get_uuid(LayoutElements.TREE_MODE)
            ),
        ],
    )
def histogram_options(uuid: str, tab: str) -> html.Div:
    return html.Div(children=[
        wcc.RadioItems(
            label="Barmode:",
            id={
                "id": uuid,
                "tab": tab,
                "selector": "barmode"
            },
            options=[
                {
                    "label": "overlay",
                    "value": "overlay"
                },
                {
                    "label": "group",
                    "value": "group"
                },
                {
                    "label": "stack",
                    "value": "stack"
                },
            ],
            labelStyle={
                "display": "inline-flex",
                "margin-right": "5px"
            },
            value="overlay",
        ),
        wcc.Slider(
            label="Histogram bins:",
            id={
                "id": uuid,
                "tab": tab,
                "selector": "hist_bins"
            },
            value=15,
            min=1,
            max=30,
        ),
    ])
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 plot_selections_layout(
    uuid: str, volumemodel: InplaceVolumesModel, tab: str
) -> wcc.Selectors:
    return wcc.Selectors(
        label="PLOT CONTROLS",
        open_details=True,
        children=plot_selector_dropdowns(uuid=uuid, volumemodel=volumemodel, tab=tab)
        + [
            html.Div(
                style={"margin-top": "10px"},
                children=wcc.RadioItems(
                    label="Visualization below plot:",
                    id={"id": uuid, "tab": tab, "selector": "bottom_viz"},
                    options=[
                        {"label": "Table", "value": "table"},
                        {"label": "None", "value": "none"},
                    ],
                    vertical=False,
                    value="table",
                ),
            ),
        ],
    )
Exemple #23
0
def options_layout(get_uuid: Callable[[str], str]) -> wcc.Selectors:
    """The options part of the menu"""
    return wcc.Selectors(
        id=get_uuid(LayoutElements.OPTIONS_LAYOUT),
        label="Options",
        children=[
            html.Div(
                id=get_uuid(LayoutElements.STATISTICAL_OPTIONS),
                children=[
                    wcc.RadioItems(
                        id=get_uuid(LayoutElements.STATISTICAL_OPTION),
                        options=[
                            {"label": "Mean", "value": StatOptions.MEAN.value},
                            {"label": "P10 (high)", "value": StatOptions.P10.value},
                            {"label": "P50 (median)", "value": StatOptions.P50.value},
                            {"label": "P90 (low)", "value": StatOptions.P90.value},
                            {"label": "Maximum", "value": StatOptions.MAX.value},
                            {"label": "Minimum", "value": StatOptions.MIN.value},
                        ],
                    )
                ],
            ),
            html.Div(
                id=get_uuid(LayoutElements.SINGLE_REAL_OPTIONS),
                children=[
                    wcc.Dropdown(
                        label="Realization",
                        id=get_uuid(LayoutElements.REALIZATION),
                        options=[],
                        value=None,
                        multi=False,
                    )
                ],
            ),
        ],
    )
 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,
                 ), ),
         ],
     )
Exemple #25
0
def formation_plot_selectors(get_uuid: Callable,
                             datamodel: RftPlotterDataModel) -> List[html.Div]:
    ensembles = datamodel.ensembles
    well_names = datamodel.well_names
    date_in_well = datamodel.date_in_well
    return wcc.Selectors(
        label="Formation plot settings",
        children=[
            wcc.Dropdown(
                label="Ensemble",
                id=get_uuid(LayoutElements.FORMATIONS_ENSEMBLE),
                options=[{
                    "label": ens,
                    "value": ens
                } for ens in ensembles],
                value=ensembles[0],
                multi=True,
                clearable=False,
            ),
            wcc.Dropdown(
                label="Well",
                id=get_uuid(LayoutElements.FORMATIONS_WELL),
                options=[{
                    "label": well,
                    "value": well
                } for well in well_names],
                value=well_names[0],
                clearable=False,
            ),
            wcc.Dropdown(
                label="Date",
                id=get_uuid(LayoutElements.FORMATIONS_DATE),
                options=[{
                    "label": date,
                    "value": date
                } for date in date_in_well(well_names[0])],
                clearable=False,
                value=date_in_well(well_names[0])[0],
            ),
            wcc.RadioItems(
                label="Plot simulations as",
                id=get_uuid(LayoutElements.FORMATIONS_LINETYPE),
                options=[
                    {
                        "label": "Realization lines",
                        "value": "realization",
                    },
                    {
                        "label": "Statistical fanchart",
                        "value": "fanchart",
                    },
                ],
                value="realization",
            ),
            wcc.RadioItems(
                label="Depth option",
                id=get_uuid(LayoutElements.FORMATIONS_DEPTHOPTION),
                options=[
                    {
                        "label": "TVD",
                        "value": "TVD",
                    },
                    {
                        "label": "MD",
                        "value": "MD",
                    },
                ],
                value="TVD",
            ),
        ],
    )
Exemple #26
0
def parameter_response_selector_layout(
        get_uuid: Callable, datamodel: RftPlotterDataModel) -> wcc.Frame:
    ensembles = datamodel.ensembles
    well_names = datamodel.well_names
    params = datamodel.parameters if not datamodel.parameters is None else []
    return wcc.Frame(
        style={
            "height": "87vh",
            "overflowY": "auto",
            "font-size": "15px",
        },
        children=[
            wcc.Selectors(
                label="Selections",
                children=[
                    wcc.Dropdown(
                        label="Ensemble",
                        id=get_uuid(LayoutElements.PARAMRESP_ENSEMBLE),
                        options=[{
                            "label": ens,
                            "value": ens
                        } for ens in ensembles],
                        value=ensembles[0],
                        clearable=False,
                    ),
                    wcc.Dropdown(
                        label="Well",
                        id=get_uuid(LayoutElements.PARAMRESP_WELL),
                        options=[{
                            "label": well,
                            "value": well
                        } for well in well_names],
                        value=well_names[0] if well_names else "",
                        clearable=False,
                    ),
                    html.Div(
                        id=get_uuid(LayoutElements.PARAMRESP_DATE_DROPDOWN),
                        children=wcc.Dropdown(
                            label="Date",
                            id=get_uuid(LayoutElements.PARAMRESP_DATE),
                            options=None,
                            value=None,
                            clearable=False,
                        ),
                    ),
                    html.Div(
                        id=get_uuid(LayoutElements.PARAMRESP_ZONE_DROPDOWN),
                        children=wcc.Dropdown(
                            label="Zone",
                            id=get_uuid(LayoutElements.PARAMRESP_ZONE),
                            options=None,
                            clearable=False,
                            value=None,
                        ),
                    ),
                    wcc.Dropdown(
                        label="Parameter",
                        id=get_uuid(LayoutElements.PARAMRESP_PARAM),
                        options=[{
                            "label": param,
                            "value": param
                        } for param in params],
                        clearable=False,
                        value=None,
                    ),
                ],
            ),
            wcc.Selectors(
                label="Options",
                children=[
                    wcc.Checklist(
                        id=get_uuid(LayoutElements.DISPLAY_PARAM_FILTER),
                        options=[{
                            "label": "Show parameter filter",
                            "value": "Show"
                        }],
                        value=[],
                    ),
                    wcc.RadioItems(
                        label="Correlation options",
                        id=get_uuid(LayoutElements.PARAMRESP_CORRTYPE),
                        options=[
                            {
                                "label": "Simulated vs parameters",
                                "value": "sim_vs_param",
                            },
                            {
                                "label": "Parameter vs simulated",
                                "value": "param_vs_sim",
                            },
                        ],
                        value="sim_vs_param",
                    ),
                    wcc.RadioItems(
                        label="Depth option",
                        id=get_uuid(LayoutElements.PARAMRESP_DEPTHOPTION),
                        options=[
                            {
                                "label": "TVD",
                                "value": "TVD",
                            },
                            {
                                "label": "MD",
                                "value": "MD",
                            },
                        ],
                        value="TVD",
                    ),
                ],
            ),
        ],
    )
 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 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",
            ),
        ),
    ]
Exemple #29
0
 def layout(self):
     return wcc.FlexBox(
         id=self.uuid("layout"),
         children=[
             wcc.Frame(
                 id=self.uuid("filters"),
                 style={
                     "flex": "1",
                     "height": "90vh"
                 },
                 children=[
                     wcc.Selectors(
                         label="Selectors",
                         children=[
                             wcc.Dropdown(
                                 label="Saturation axis",
                                 id=self.uuid("sataxis"),
                                 clearable=False,
                                 options=[{
                                     "label": i.lower().capitalize(),
                                     "value": i,
                                 } for i in self.sat_axes],
                                 value=self.sat_axes[0],
                             ),
                             wcc.Dropdown(
                                 label="Color by",
                                 id=self.uuid("color_by"),
                                 clearable=False,
                                 options=[{
                                     "label": i.lower().capitalize(),
                                     "value": i,
                                 } for i in self.color_options],
                                 value=self.color_options[0],
                             ),
                             dcc.Store(
                                 id=self.uuid("stored_ensemble"),
                                 storage_type="session",
                                 data={},
                             ),
                             wcc.Dropdown(
                                 label="Ensembles",
                                 id=self.uuid("ensemble"),
                                 clearable=False,
                                 multi=True,
                                 options=[{
                                     "label": i,
                                     "value": i
                                 } for i in self.ensembles],
                                 value=self.ensembles[0],
                             ),
                             wcc.Dropdown(
                                 label="Curves",
                                 id=self.uuid("curve"),
                                 clearable=False,
                                 multi=True,
                             ),
                             dcc.Store(
                                 id=self.uuid("stored_satnum"),
                                 storage_type="session",
                                 data={},
                             ),
                             wcc.Dropdown(
                                 label="Satnum",
                                 id=self.uuid("satnum"),
                                 clearable=False,
                                 multi=True,
                                 options=[{
                                     "label": i,
                                     "value": i
                                 } for i in self.satnums],
                                 value=self.satnums[0],
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         label="Visualization",
                         children=[
                             wcc.RadioItems(
                                 label="Line traces",
                                 id=self.uuid("visualization"),
                                 className="block-options",
                                 options=[
                                     {
                                         "label": "Individual realizations",
                                         "value": "realizations",
                                     },
                                     {
                                         "label": "Statistical fanchart",
                                         "value": "statistics",
                                     },
                                 ],
                                 value="statistics",
                             ),
                             wcc.RadioItems(
                                 label="Y-axis",
                                 id=self.uuid("linlog"),
                                 className="block-options",
                                 options=[
                                     {
                                         "label": "Linear",
                                         "value": "linear",
                                     },
                                     {
                                         "label": "Log",
                                         "value": "log",
                                     },
                                 ],
                                 value="linear",
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         style={"display": "block"}
                         if self.scal is not None else {"display": "none"},
                         id=self.uuid("scal_selector"),
                         label="SCAL recommendation",
                         children=[
                             wcc.Checklist(
                                 id=self.uuid("scal"),
                                 options=[
                                     {
                                         "label": "Show SCAL",
                                         "value": "show_scal",
                                     },
                                 ],
                                 value=["show_scal"]
                                 if self.scal is not None else [],
                             ),
                         ],
                     ),
                 ],
             ),
             wcc.Frame(
                 color="white",
                 highlight=False,
                 style={
                     "flex": "4",
                     "height": "90vh"
                 },
                 children=wcc.Graph(style={"height": "88vh"},
                                    id=self.uuid("graph")),
             ),
         ],
     )
Exemple #30
0
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,
            ),
        ]
    )