示例#1
0
 def control_div(self) -> list:
     return [
         wcc.Selectors(
             label="Distribution plot horizontal axis",
             children=[
                 wcc.Dropdown(
                     id=self.ids("parameter1"),
                     label="Parameter",
                     options=[{
                         "label": p,
                         "value": p
                     } for p in self.p_cols],
                     value=self.p_cols[0],
                     clearable=False,
                 ),
                 wcc.Dropdown(
                     label="Ensemble",
                     id=self.ids("ensemble-1"),
                     options=[{
                         "label": k,
                         "value": v
                     } for k, v in self.ensembles.items()],
                     value=list(self.ensembles.values())[0],
                     clearable=False,
                 ),
             ],
         ),
         wcc.Selectors(
             label="Distribution plot vertical axis",
             children=[
                 wcc.Dropdown(
                     id=self.ids("parameter2"),
                     label="Parameter",
                     options=[{
                         "label": p,
                         "value": p
                     } for p in self.p_cols],
                     value=self.p_cols[0],
                     clearable=False,
                 ),
                 wcc.Dropdown(
                     label="Ensemble",
                     id=self.ids("ensemble-2"),
                     options=[{
                         "label": k,
                         "value": v
                     } for k, v in self.ensembles.items()],
                     value=list(self.ensembles.values())[0],
                     clearable=False,
                 ),
             ],
         ),
         wcc.Selectors(
             label="Distribution plot options",
             children=[
                 wcc.Dropdown(
                     label="Color by",
                     id=self.ids("scatter-color"),
                     options=[{
                         "label": p,
                         "value": p
                     } for p in self.p_cols],
                 ),
                 wcc.Checklist(
                     id=self.ids("density"),
                     style={"padding": "5px"},
                     options=[{
                         "label": "Show scatterplot density",
                         "value": "density",
                     }],
                 ),
             ],
         ),
     ]
示例#2
0
def selector_view(
    get_uuid: Callable,
    vectormodel: SimulationTimeSeriesModel,
    parametermodel: ParametersModel,
    theme: WebvizConfigTheme,
) -> wcc.Frame:

    theme_colors = theme.plotly_theme.get("layout", {}).get("colorway", [])
    return wcc.Frame(
        style={
            "height": "80vh",
            "overflowY": "auto",
            "font-size": "15px",
        },
        children=[
            wcc.Selectors(
                label="Selections",
                children=[
                    ensemble_selector(
                        get_uuid=get_uuid,
                        ensembles=parametermodel.mc_ensembles,
                        tab="response",
                        id_string="ensemble-selector",
                        heading="Ensemble:",
                    ),
                    vector_selector(get_uuid=get_uuid, vectormodel=vectormodel),
                    date_selector(get_uuid=get_uuid, vectormodel=vectormodel),
                    parameter_selector(
                        get_uuid=get_uuid, parametermodel=parametermodel, tab="response"
                    ),
                ],
            ),
            wcc.Selectors(
                label="Visualization",
                children=[
                    wcc.RadioItems(
                        id=get_uuid("visualization"),
                        options=[
                            {
                                "label": "Individual realizations",
                                "value": VisualizationOptions.REALIZATIONS.value,
                            },
                            {
                                "label": "Statistical lines",
                                "value": VisualizationOptions.STATISTICS.value,
                            },
                            {
                                "label": "Statistics + Realizations",
                                "value": VisualizationOptions.STATISTICS_AND_REALIZATIONS,
                            },
                        ],
                        value=VisualizationOptions.REALIZATIONS.value,
                    )
                ],
            ),
            wcc.Selectors(
                label="Vectors for parameter correlation",
                children=filter_vector_selector(get_uuid=get_uuid),
            ),
            wcc.Selectors(
                label="Options",
                children=[
                    parameter_filter_button(get_uuid),
                    options_layout(get_uuid, theme_colors),
                ],
            ),
        ],
    )
 def layout(self) -> html.Div:
     return wcc.FlexBox(
         id=self.ids("layout"),
         children=[
             wcc.FlexColumn(
                 flex=1,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     children=[
                         wcc.Selectors(
                             label="Selectors",
                             children=[
                                 self.ensemble_selector, self.smry_selector
                             ],
                         ),
                         dcc.Store(
                             id=self.ids("date-store"),
                             storage_type="session",
                         ),
                     ],
                 ),
             ),
             wcc.FlexColumn(
                 flex=3,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     color="white",
                     highlight=False,
                     children=[
                         html.Div(
                             id=self.ids("graph-wrapper"),
                             style={"height": "450px"},
                             children=wcc.Graph(
                                 id=self.ids("graph"),
                                 clickData={
                                     "points": [{
                                         "x": self.initial_date
                                     }]
                                 },
                             ),
                         ),
                         html.Div(children=[
                             html.Div(
                                 id=self.ids("table_title"),
                                 style={"textAlign": "center"},
                                 children="",
                             ),
                             html.Div(
                                 style={"fontSize": "15px"},
                                 children=dash_table.DataTable(
                                     id=self.ids("table"),
                                     sort_action="native",
                                     filter_action="native",
                                     page_action="native",
                                     page_size=10,
                                 ),
                             ),
                         ], ),
                     ],
                 ),
             ),
             wcc.FlexColumn(
                 flex=3,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     color="white",
                     highlight=False,
                     id=self.ids("tornado-wrapper"),
                     children=self.tornadoplot.layout,
                 ),
             ),
         ],
     )
 def layout(self) -> wcc.FlexBox:
     return wcc.FlexBox(
         id=self.uuid("layout"),
         children=[
             wcc.FlexColumn(children=wcc.Frame(
                 style={"height": "90vh"},
                 children=[
                     wcc.Selectors(label="Ensembles",
                                   children=[self.delta_layout]),
                     wcc.Selectors(
                         label="Time series",
                         children=wsc.VectorSelector(
                             id=self.uuid("vectors"),
                             maxNumSelectedNodes=3,
                             data=self.vector_data,
                             persistence=True,
                             persistence_type="session",
                             selectedTags=self.plot_options.get(
                                 "vectors", [self.smry_cols[0]]),
                             numSecondsUntilSuggestionsAreShown=0.5,
                             lineBreakAfterTag=True,
                         ),
                     ),
                     wcc.Selectors(
                         label="Visualization",
                         id=self.uuid("visualization"),
                         children=[
                             wcc.RadioItems(
                                 id=self.uuid("statistics"),
                                 options=[
                                     {
                                         "label": "Individual realizations",
                                         "value": "realizations",
                                     },
                                     {
                                         "label": "Statistical lines",
                                         "value": "statistics",
                                     },
                                     {
                                         "label": "Statistical fanchart",
                                         "value": "fanchart",
                                     },
                                 ],
                                 value=self.plot_options.get(
                                     "visualization", "statistics"),
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         label="Options",
                         id=self.uuid("options"),
                         children=[
                             wcc.Checklist(
                                 id=self.uuid("trace_options"),
                                 options=[{
                                     "label": val,
                                     "value": val
                                 } for val in ["History", "Histogram"]],
                                 value=["History"],
                             ),
                             html.Div(
                                 id=self.uuid("view_stat_options"),
                                 style={"display": "block"}
                                 if "statistics" in self.plot_options.
                                 get("visualization", ""
                                     ) else {"display": "none"},
                                 children=[
                                     wcc.Checklist(
                                         id=self.uuid("stat_options"),
                                         options=[{
                                             "label": val,
                                             "value": val
                                         } for val in [
                                             "Mean",
                                             "P10 (high)",
                                             "P50 (median)",
                                             "P90 (low)",
                                             "Maximum",
                                             "Minimum",
                                         ]],
                                         value=[
                                             "Mean",
                                             "P10 (high)",
                                             "P90 (low)",
                                         ],
                                     ),
                                 ],
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         label="Calculations",
                         children=[self.from_cumulatives_layout],
                     ),
                 ],
             )),
             wcc.FlexColumn(
                 flex=4,
                 children=[
                     wcc.Frame(
                         style={"height": "90vh"},
                         highlight=False,
                         color="white",
                         children=wcc.Graph(
                             style={"height": "85vh"},
                             id=self.uuid("graph"),
                         ),
                     ),
                     dcc.Store(
                         id=self.uuid("date"),
                         storage_type="session",
                         data=json.dumps(self.plot_options.get(
                             "date", None)),
                     ),
                 ],
             ),
         ],
     )
示例#5
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")),
             ),
         ],
     )
示例#6
0
def selector_view(
    get_uuid: Callable,
    vectormodel: SimulationTimeSeriesModel,
    parametermodel: ParametersModel,
    theme: WebvizConfigTheme,
) -> html.Div:

    theme_colors = theme.plotly_theme.get("layout", {}).get("colorway", [])
    theme_colors = (theme_colors[1:12] if theme_colors
                    and len(theme_colors) >= 12 else theme_colors)

    return wcc.Frame(
        style={
            "height": "80vh",
            "overflowY": "auto",
            "font-size": "15px",
        },
        children=[
            wcc.Selectors(
                label="Selections",
                children=[
                    ensemble_selector(
                        get_uuid=get_uuid,
                        parametermodel=parametermodel,
                        tab="response",
                        id_string="ensemble-selector",
                        heading="Ensemble:",
                        value=parametermodel.ensembles[0],
                    ),
                    vector_selector(get_uuid=get_uuid,
                                    vectormodel=vectormodel),
                    date_selector(get_uuid=get_uuid, vectormodel=vectormodel),
                    parameter_selector(get_uuid=get_uuid,
                                       parametermodel=parametermodel,
                                       tab="response"),
                ],
            ),
            wcc.Selectors(
                label="Filters",
                children=[
                    wcc.Checklist(
                        id=get_uuid("display-paramfilter"),
                        options=[{
                            "label": "Show parameter filter",
                            "value": "Show"
                        }],
                        value=[],
                    ),
                    filter_vector_selector(get_uuid=get_uuid,
                                           vectormodel=vectormodel,
                                           tab="response"),
                ],
            ),
            wcc.Selectors(
                label="Options",
                open_details=False,
                children=[
                    plot_options(get_uuid=get_uuid, tab="response"),
                    color_selector(
                        get_uuid=get_uuid,
                        tab="response",
                        colors=[theme_colors, "Greys", "BrBG"],
                        bargap=0.2,
                        height=50,
                    ),
                    color_opacity_selector(get_uuid=get_uuid,
                                           tab="response",
                                           value=0.5),
                ],
            ),
        ],
    )
示例#7
0
def _well_prod_coverage_layout(
    get_uuid: Callable,
    ensemble_names: List[str],
    dates: List[datetime],
    phases: List[str],
    wells: List[str],
    all_well_collection_names: List[str],
    realizations: List[int],
) -> list:
    children = [
        wcc.FlexBox(
            id=get_uuid(LayoutElements.WELL_COVERAGE_LAYOUT),
            children=[
                wcc.Frame(
                    style={
                        "flex": 1,
                        "height": "85vh",
                        "maxWidth": "200px",
                    },
                    children=[
                        wcc.Selectors(
                            label="Case settings",
                            children=[
                                wcc.Dropdown(
                                    label="Ensemble selector",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_ENSEMBLE_NAMES),
                                    options=[{
                                        "label": ens,
                                        "value": ens
                                    } for ens in ensemble_names],
                                    value=ensemble_names[0:1],
                                    multi=True,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - dates and phases",
                            children=[
                                wcc.SelectWithLabel(
                                    label="Date selector",
                                    id=get_uuid(
                                        LayoutElements.WELL_COVERAGE_DATES),
                                    options=[{
                                        "label":
                                        _date.strftime("%Y-%m-%d"),
                                        "value":
                                        str(_date),
                                    } for _date in dates],
                                    value=[str(dates[-1])],
                                    size=min([len(dates), 5]),
                                ),
                                wcc.SelectWithLabel(
                                    label="Phase selector",
                                    id=get_uuid(
                                        LayoutElements.WELL_COVERAGE_PHASES),
                                    options=[{
                                        "label": phase,
                                        "value": phase
                                    } for phase in phases],
                                    value=phases,
                                    size=min([len(phases), 3]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - wells",
                            children=[
                                wcc.SelectWithLabel(
                                    label="Well selector",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_WELL_NAMES),
                                    options=[{
                                        "label": well,
                                        "value": well
                                    } for well in wells],
                                    value=wells,
                                    size=min([len(wells), 9]),
                                ),
                                wcc.RadioItems(
                                    label="Combine wells and collections as",
                                    id=get_uuid(
                                        LayoutElements.
                                        WELL_COVERAGE_WELL_COMBINE_TYPE),
                                    options=[
                                        {
                                            "label": "Intersection",
                                            "value": "intersection",
                                        },
                                        {
                                            "label": "Union",
                                            "value": "union"
                                        },
                                    ],
                                    value="intersection",
                                ),
                                wcc.SelectWithLabel(
                                    label="Well collection selector",
                                    id=get_uuid(
                                        LayoutElements.
                                        WELL_COVERAGE_WELL_COLLECTIONS),
                                    options=[{
                                        "label": collection,
                                        "value": collection
                                    } for collection in
                                             all_well_collection_names],
                                    value=all_well_collection_names,
                                    size=min([len(wells), 5]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - realizations",
                            open_details=False,
                            children=[
                                wcc.SelectWithLabel(
                                    label="Realization selector",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_REALIZATIONS),
                                    options=[{
                                        "label": real,
                                        "value": real
                                    } for real in realizations],
                                    value=realizations,
                                    size=min([len(wells), 5]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Plot settings and layout",
                            open_details=True,
                            children=[
                                wcc.Dropdown(
                                    label="Colorby",
                                    id=get_uuid(
                                        LayoutElements.WELL_COVERAGE_COLORBY),
                                    options=[
                                        {
                                            "label": "Ensemble",
                                            "value": "ENSEMBLE",
                                        },
                                        # {"label": "Well", "value": "WELL"},
                                        {
                                            "label": "Date",
                                            "value": "DATE"
                                        },
                                    ],
                                    value="ENSEMBLE",
                                    multi=False,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Plot type",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_PLOT_TYPE),
                                    options=[
                                        {
                                            "label": "Diff plot",
                                            "value": "diffplot"
                                        },
                                        {
                                            "label": "Diff plot relative (%)",
                                            "value": "rel_diffplot",
                                        },
                                        {
                                            "label": "Cross plot",
                                            "value": "crossplot"
                                        },
                                    ],
                                    value="diffplot",
                                    multi=False,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Fig layout - height",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_FIGHEIGHT),
                                    options=[
                                        {
                                            "label": "Very small",
                                            "value": 250,
                                        },
                                        {
                                            "label": "Small",
                                            "value": 350,
                                        },
                                        {
                                            "label": "Medium",
                                            "value": 450,
                                        },
                                        {
                                            "label": "Large",
                                            "value": 700,
                                        },
                                        {
                                            "label": "Very large",
                                            "value": 1000,
                                        },
                                    ],
                                    value=450,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.RadioItems(
                                    label="Colorby grouping",
                                    id=get_uuid(
                                        LayoutElements.WELL_COVERAGE_BOXMODE),
                                    options=[
                                        {
                                            "label": "Side by side",
                                            "value": "group"
                                        },
                                        {
                                            "label": "Overlay",
                                            "value": "overlay"
                                        },
                                    ],
                                    value="group",
                                ),
                                wcc.RadioItems(
                                    label="Show points",
                                    id=get_uuid(LayoutElements.
                                                WELL_COVERAGE_BOXPLOT_POINTS),
                                    options=[
                                        {
                                            "label": "Outliers only",
                                            "value": "outliers"
                                        },
                                        {
                                            "label": "All points",
                                            "value": "all"
                                        },
                                        {
                                            "label": "All points, no box",
                                            "value": "strip",
                                        },
                                    ],
                                    value="outliers",
                                ),
                            ],
                        ),
                    ],
                ),
                wcc.Frame(
                    style={
                        "flex": 4,
                        "minWidth": "500px"
                    },
                    children=[
                        html.Div(
                            id=get_uuid(LayoutElements.WELL_COVERAGE_GRAPH))
                    ],
                ),
            ],
        ),
    ]
    return children
示例#8
0
 def layout(self) -> wcc.FlexBox:
     return wcc.FlexBox(
         id=self.uuid("layout"),
         children=[
             wcc.Frame(
                 style={
                     "flex": "1",
                     "height": "90vh"
                 },
                 children=[
                     wcc.Selectors(
                         label="Selectors",
                         children=[
                             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],
                             ),
                             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,
                             ),
                             wcc.Dropdown(
                                 label="Phase",
                                 id=self.uuid("phase"),
                                 clearable=False,
                                 options=[{
                                     "label":
                                     f"{value.lower().capitalize()} ({info})",
                                     "value": value,
                                 } for value, info in self.phases.items()],
                                 multi=False,
                                 value=list(self.phases.keys())[0],
                             ),
                             wcc.Dropdown(
                                 label="Pvtnum",
                                 id=self.uuid("pvtnum"),
                                 clearable=False,
                                 multi=False,
                                 options=[{
                                     "label": i,
                                     "value": i
                                 } for i in self.pvtnums],
                                 value=self.pvtnums[0],
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         label="Show plots",
                         children=[
                             wcc.Checklist(
                                 id=self.uuid("plots_visibility"),
                                 options=[{
                                     "label": l,
                                     "value": v
                                 } for v, l in self.plot_visibility_options(
                                 ).items()],
                                 value=[
                                     "fvf",
                                     "viscosity",
                                     "density",
                                     "ratio",
                                 ],
                                 labelStyle={"display": "block"},
                             ),
                         ],
                     ),
                 ],
             ),
             wcc.Frame(
                 color="white",
                 highlight=False,
                 id=self.uuid("graphs"),
                 style={
                     "flex": "6",
                     "height": "90vh"
                 },
                 children=[],
             ),
             dcc.Store(id=self.uuid("init_callback"),
                       storage_type="session",
                       data=True),
         ],
     )
示例#9
0
    def map_plot_selectors(self) -> List[html.Div]:

        return wcc.Selectors(
            label="Map plot settings",
            children=[
                wcc.Dropdown(
                    label="Ensemble",
                    id=self.uuid("map_ensemble"),
                    options=[{
                        "label": ens,
                        "value": ens
                    } for ens in list(self.ertdatadf["ENSEMBLE"].unique())],
                    value=list(self.ertdatadf["ENSEMBLE"].unique())[0],
                    clearable=False,
                ),
                wcc.Dropdown(
                    label="Size points by",
                    id=self.uuid("map_size"),
                    options=[
                        {
                            "label": "Standard Deviation",
                            "value": "STDDEV",
                        },
                        {
                            "label": "Misfit",
                            "value": "ABSDIFF",
                        },
                    ],
                    value="ABSDIFF",
                    clearable=False,
                ),
                wcc.Dropdown(
                    label="Color points by",
                    id=self.uuid("map_color"),
                    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=self.uuid("map_date"),
                    min=self.ertdatadf["DATE_IDX"].min(),
                    max=self.ertdatadf["DATE_IDX"].max(),
                    value=[
                        self.ertdatadf["DATE_IDX"].min(),
                        self.ertdatadf["DATE_IDX"].max(),
                    ],
                    marks=self.date_marks,
                ),
            ],
        )
示例#10
0
def _misfit_per_real_layout(
    get_uuid: Callable,
    ensemble_names: List[str],
    dates: List[datetime],
    phases: List[str],
    wells: List[str],
    all_well_collection_names: List[str],
    realizations: List[int],
) -> list:
    children = [
        wcc.FlexBox(
            id=get_uuid(LayoutElements.PROD_MISFIT_LAYOUT),
            children=[
                wcc.Frame(
                    style={
                        "flex": 1,
                        "height": "85vh",
                        "maxWidth": "200px",
                    },
                    children=[
                        wcc.Selectors(
                            label="Case settings",
                            children=[
                                wcc.Dropdown(
                                    label="Ensemble selector",
                                    id=get_uuid(LayoutElements.
                                                PROD_MISFIT_ENSEMBLE_NAMES),
                                    options=[{
                                        "label": ens,
                                        "value": ens
                                    } for ens in ensemble_names],
                                    value=ensemble_names[:2],
                                    multi=True,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings",
                            children=[
                                wcc.SelectWithLabel(
                                    label="Date selector",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_DATES),
                                    options=[{
                                        "label":
                                        _date.strftime("%Y-%m-%d"),
                                        "value":
                                        str(_date),
                                    } for _date in dates],
                                    value=[str(dates[-1])],
                                    size=min([len(dates), 5]),
                                ),
                                wcc.SelectWithLabel(
                                    label="Phase selector",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_PHASES),
                                    options=[{
                                        "label": phase,
                                        "value": phase
                                    } for phase in phases],
                                    value=phases,
                                    size=min([len(phases), 3]),
                                ),
                                wcc.SelectWithLabel(
                                    label="Well selector",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_WELL_NAMES),
                                    options=[{
                                        "label": well,
                                        "value": well
                                    } for well in wells],
                                    value=wells,
                                    size=min([len(wells), 9]),
                                ),
                                wcc.RadioItems(
                                    label="Combine wells and collections as",
                                    id=get_uuid(LayoutElements.
                                                PROD_MISFIT_WELL_COMBINE_TYPE),
                                    options=[
                                        {
                                            "label": "Intersection",
                                            "value": "intersection",
                                        },
                                        {
                                            "label": "Union",
                                            "value": "union"
                                        },
                                    ],
                                    value="intersection",
                                ),
                                wcc.SelectWithLabel(
                                    label="Well collection selector",
                                    id=get_uuid(LayoutElements.
                                                PROD_MISFIT_WELL_COLLECTIONS),
                                    options=[{
                                        "label": collection,
                                        "value": collection
                                    } for collection in
                                             all_well_collection_names],
                                    value=all_well_collection_names,
                                    size=min([len(wells), 5]),
                                ),
                                wcc.SelectWithLabel(
                                    label="Realization selector",
                                    id=get_uuid(LayoutElements.
                                                PROD_MISFIT_REALIZATIONS),
                                    options=[{
                                        "label": real,
                                        "value": real
                                    } for real in realizations],
                                    value=realizations,
                                    size=min([len(wells), 5]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Plot settings and layout",
                            open_details=True,
                            children=[
                                wcc.Dropdown(
                                    label="Colorby",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_COLORBY),
                                    options=[
                                        {
                                            "label": "Total misfit",
                                            "value": "misfit",
                                        },
                                        {
                                            "label": "Phases",
                                            "value": "phases"
                                        },
                                        {
                                            "label": "Date",
                                            "value": "date"
                                        },
                                        {
                                            "label": "None",
                                            "value": None
                                        },
                                    ],
                                    value="phases",
                                    multi=False,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Sorting/ranking",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_SORTING),
                                    options=[
                                        {
                                            "label": "None",
                                            "value": None,
                                        },
                                        {
                                            "label": "Ascending",
                                            "value": "total ascending",
                                        },
                                        {
                                            "label": "Descending",
                                            "value": "total descending",
                                        },
                                    ],
                                    value="total ascending",
                                    multi=False,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Fig layout - height",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_FIGHEIGHT),
                                    options=[
                                        {
                                            "label": "Very small",
                                            "value": 250,
                                        },
                                        {
                                            "label": "Small",
                                            "value": 350,
                                        },
                                        {
                                            "label": "Medium",
                                            "value": 450,
                                        },
                                        {
                                            "label": "Large",
                                            "value": 700,
                                        },
                                        {
                                            "label": "Very large",
                                            "value": 1000,
                                        },
                                    ],
                                    value=450,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Misfit options",
                            open_details=True,  # False,
                            children=[
                                wcc.Dropdown(
                                    label="Misfit weight",
                                    id=get_uuid(LayoutElements.
                                                PROD_MISFIT_OBS_ERROR_WEIGHT),
                                    options=[
                                        {
                                            "label": "Phase weights",
                                            "value": -1.0,
                                        },
                                        {
                                            "label": "None",
                                            "value": 0.0
                                        },
                                        {
                                            "label":
                                            "10% obs error (min=1000)",
                                            "value": 0.10,
                                        },
                                        {
                                            "label":
                                            "20% obs error (min=1000)",
                                            "value": 0.20,
                                        },
                                    ],
                                    value=-1.0,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Misfit exponent",
                                    id=get_uuid(
                                        LayoutElements.PROD_MISFIT_EXPONENT),
                                    options=[
                                        {
                                            "label": "Linear sum",
                                            "value": 1.0,
                                        },
                                        {
                                            "label": "Squared sum",
                                            "value": 2.0,
                                        },
                                    ],
                                    value=1.0,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                # wcc.Dropdown(
                                #     label="Misfit normalization",
                                #     id=get_uuid(
                                #         LayoutElements.PROD_MISFIT_NORMALIZATION
                                #     ),
                                #     options=[
                                #         {
                                #             "label": "Yes",
                                #             "value": True,
                                #         },
                                #         {
                                #             "label": "No",
                                #             "value": False,
                                #         },
                                #     ],
                                #     value=False,
                                #     clearable=False,
                                #     persistence=True,
                                #     persistence_type="memory",
                                # ),
                            ],
                        ),
                    ],
                ),
                wcc.Frame(
                    style={
                        "flex": 4,
                        "minWidth": "500px"
                    },
                    children=[
                        html.Div(id=get_uuid(LayoutElements.PROD_MISFIT_GRAPH))
                    ],
                ),
            ],
        ),
    ]
    return children
示例#11
0
 def formation_plot_selectors(self) -> List[html.Div]:
     return wcc.Selectors(
         label="Formation plot settings",
         children=[
             wcc.Dropdown(
                 label="Ensemble",
                 id=self.uuid("ensemble"),
                 options=[{
                     "label": ens,
                     "value": ens
                 } for ens in self.ensembles],
                 value=self.ensembles[0],
                 multi=True,
                 clearable=False,
             ),
             wcc.Dropdown(
                 label="Well",
                 id=self.uuid("well"),
                 options=[{
                     "label": well,
                     "value": well
                 } for well in self.well_names],
                 value=self.well_names[0],
                 clearable=False,
             ),
             wcc.Dropdown(
                 label="Date",
                 id=self.uuid("date"),
                 options=[{
                     "label": date,
                     "value": date
                 } for date in self.date_in_well(self.well_names[0])],
                 clearable=False,
                 value=self.date_in_well(self.well_names[0])[0],
             ),
             wcc.RadioItems(
                 label="Plot simulations as",
                 id=self.uuid("linetype"),
                 options=[
                     {
                         "label": "Realization lines",
                         "value": "realization",
                     },
                     {
                         "label": "Statistical fanchart",
                         "value": "fanchart",
                     },
                 ],
                 value="realization",
             ),
             wcc.RadioItems(
                 label="Depth option",
                 id=self.uuid("depth_option"),
                 options=[
                     {
                         "label": "TVD",
                         "value": "TVD",
                     },
                     {
                         "label": "MD",
                         "value": "MD",
                     },
                 ],
                 value="TVD",
             ),
         ],
     )
def controls(
    get_uuid: Callable, data_models: Dict[str, EnsembleWellAnalysisData]
) -> wcc.Frame:
    ensembles = list(data_models.keys())
    return wcc.Frame(
        style={"flex": 1, "height": "87vh"},
        children=[
            wcc.Selectors(
                label="Selections",
                children=[
                    wcc.Dropdown(
                        label="Ensemble",
                        id=get_uuid(WellControlLayoutElements.ENSEMBLE),
                        options=[{"label": col, "value": col} for col in ensembles],
                        value=ensembles[0],
                        multi=False,
                    ),
                    wcc.Dropdown(
                        label="Well",
                        id=get_uuid(WellControlLayoutElements.WELL),
                        options=[],
                        value=None,
                        multi=False,
                    ),
                ],
            ),
            wcc.Selectors(
                label="Pressure Plot Options",
                children=[
                    wcc.Checklist(
                        id=get_uuid(WellControlLayoutElements.INCLUDE_BHP),
                        options=[{"label": "Include BHP", "value": "include_bhp"}],
                        value=["include_bhp"],
                    ),
                    wcc.RadioItems(
                        label="Mean or realization",
                        id=get_uuid(WellControlLayoutElements.MEAN_OR_REAL),
                        options=[
                            {
                                "label": "Mean of producing real.",
                                "value": "plot_mean",
                            },
                            {
                                "label": "Single realization",
                                "value": "single_real",
                            },
                        ],
                        value="plot_mean",
                    ),
                    html.Div(
                        id=get_uuid(WellControlLayoutElements.SINGLE_REAL_OPTIONS),
                        children=[
                            wcc.Dropdown(
                                id=get_uuid(WellControlLayoutElements.REAL),
                                options=[],
                                value=None,
                                multi=False,
                            ),
                            wcc.Checklist(
                                id=get_uuid(WellControlLayoutElements.CTRLMODE_BAR),
                                options=[
                                    {
                                        "label": "Display ctrl mode bar",
                                        "value": "ctrlmode_bar",
                                    }
                                ],
                                value=["ctrlmode_bar"],
                            ),
                        ],
                    ),
                ],
            ),
            wcc.Selectors(
                label="⚙️ Settings",
                children=[
                    wcc.Checklist(
                        id=get_uuid(WellControlLayoutElements.SHARED_XAXES),
                        options=[{"label": "Shared x-axis", "value": "shared_xaxes"}],
                        value=["shared_xaxes"],
                    ),
                ],
            ),
        ],
    )
示例#13
0
def options_layout(get_uuid: Callable) -> wcc.Selectors:
    """The options part of the menu"""
    options_uuid = get_uuid("options")
    return wcc.Selectors(
        id=get_uuid("options_layout"),
        label="Options",
        children=[
            html.Div(
                id={
                    "id": options_uuid,
                    "element": "statistical_options"
                },
                children=[
                    wcc.RadioItems(
                        id={
                            "id": options_uuid,
                            "element": "statistical_option"
                        },
                        options=[
                            {
                                "label": "Mean",
                                "value": "mean"
                            },
                            {
                                "label": "P10 (high)",
                                "value": "p10"
                            },
                            {
                                "label": "P50 (median)",
                                "value": "p50"
                            },
                            {
                                "label": "P90 (low)",
                                "value": "p90"
                            },
                            {
                                "label": "Maximum",
                                "value": "max"
                            },
                            {
                                "label": "Minimum",
                                "value": "min"
                            },
                        ],
                    )
                ],
            ),
            html.Div(
                id={
                    "id": options_uuid,
                    "element": "single_real_options"
                },
                children=[
                    wcc.Dropdown(
                        label="Realization",
                        id={
                            "id": options_uuid,
                            "element": "realization"
                        },
                        options=[],
                        value=None,
                        multi=False,
                    )
                ],
            ),
        ],
    )
def plot_settings(get_uuid: Callable) -> wcc.Frame:
    settings_uuid = get_uuid(WellOverviewLayoutElements.CHARTTYPE_SETTINGS)
    checklist_uuid = get_uuid(WellOverviewLayoutElements.CHARTTYPE_CHECKLIST)
    return wcc.Selectors(
        label="Plot Settings",
        children=[
            html.Div(
                id={
                    "id": settings_uuid,
                    "charttype": "bar"
                },
                children=wcc.Checklist(
                    id={
                        "id": checklist_uuid,
                        "charttype": "bar"
                    },
                    options=[
                        {
                            "label": "Show legend",
                            "value": "legend"
                        },
                        {
                            "label": "Overlay bars",
                            "value": "overlay_bars"
                        },
                        {
                            "label": "Show prod as text",
                            "value": "show_prod_text"
                        },
                        {
                            "label": "White background",
                            "value": "white_background"
                        },
                    ],
                    value=["legend"],
                ),
            ),
            html.Div(
                id={
                    "id": settings_uuid,
                    "charttype": "pie"
                },
                children=wcc.Checklist(
                    id={
                        "id": checklist_uuid,
                        "charttype": "pie"
                    },
                    options=[
                        {
                            "label": "Show legend",
                            "value": "legend"
                        },
                        {
                            "label": "Show prod as text",
                            "value": "show_prod_text"
                        },
                    ],
                    value=[],
                ),
            ),
            html.Div(
                id={
                    "id": settings_uuid,
                    "charttype": "area"
                },
                children=wcc.Checklist(
                    id={
                        "id": checklist_uuid,
                        "charttype": "area"
                    },
                    options=[
                        {
                            "label": "Show legend",
                            "value": "legend"
                        },
                        {
                            "label": "White background",
                            "value": "white_background"
                        },
                    ],
                    value=["legend"],
                ),
            ),
        ],
    )
示例#15
0
def _heatmap_layout(
    get_uuid: Callable,
    ensemble_names: List[str],
    dates: List[datetime],
    phases: List[str],
    wells: List[str],
    all_well_collection_names: List[str],
    realizations: List[int],
) -> list:
    children = [
        wcc.FlexBox(
            id=get_uuid(LayoutElements.HEATMAP_LAYOUT),
            children=[
                wcc.Frame(
                    style={
                        "flex": 1,
                        "height": "80vh",
                        "maxWidth": "200px",
                    },
                    children=[
                        wcc.Selectors(
                            label="Case settings",
                            children=[
                                wcc.Dropdown(
                                    label="Ensemble selector",
                                    id=get_uuid(
                                        LayoutElements.HEATMAP_ENSEMBLE_NAMES),
                                    options=[{
                                        "label": ens,
                                        "value": ens
                                    } for ens in ensemble_names],
                                    value=ensemble_names[0:1],
                                    multi=True,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - dates and phases",
                            children=[
                                wcc.SelectWithLabel(
                                    label="Date selector",
                                    id=get_uuid(LayoutElements.HEATMAP_DATES),
                                    options=[{
                                        "label":
                                        _date.strftime("%Y-%m-%d"),
                                        "value":
                                        str(_date),
                                    } for _date in dates],
                                    value=[str(_date) for _date in dates],
                                    size=min([len(dates), 5]),
                                ),
                                wcc.SelectWithLabel(
                                    label="Phase selector",
                                    id=get_uuid(LayoutElements.HEATMAP_PHASES),
                                    options=[{
                                        "label": phase,
                                        "value": phase
                                    } for phase in phases],
                                    value=phases,
                                    size=min([len(phases), 3]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - wells",
                            children=[
                                wcc.SelectWithLabel(
                                    label="Well selector",
                                    id=get_uuid(
                                        LayoutElements.HEATMAP_WELL_NAMES),
                                    options=[{
                                        "label": well,
                                        "value": well
                                    } for well in wells],
                                    value=wells,
                                    size=min([len(wells), 9]),
                                ),
                                wcc.RadioItems(
                                    label="Combine wells and collections as",
                                    id=get_uuid(LayoutElements.
                                                HEATMAP_WELL_COMBINE_TYPE),
                                    options=[
                                        {
                                            "label": "Intersection",
                                            "value": "intersection",
                                        },
                                        {
                                            "label": "Union",
                                            "value": "union"
                                        },
                                    ],
                                    value="intersection",
                                ),
                                wcc.SelectWithLabel(
                                    label="Well collection selector",
                                    id=get_uuid(LayoutElements.
                                                HEATMAP_WELL_COLLECTIONS),
                                    options=[{
                                        "label": collection,
                                        "value": collection,
                                    } for collection in
                                             all_well_collection_names],
                                    value=all_well_collection_names,
                                    size=min([len(wells), 5]),
                                ),
                            ],
                        ),
                        wcc.Selectors(
                            label="Filter settings - realizations",
                            open_details=False,
                            children=[
                                wcc.SelectWithLabel(
                                    label="Realization selector",
                                    id=get_uuid(
                                        LayoutElements.HEATMAP_REALIZATIONS),
                                    options=[{
                                        "label": real,
                                        "value": real
                                    } for real in realizations],
                                    value=realizations,
                                    size=min([len(wells), 5]),
                                ),
                            ],
                        ),
                        wcc.Dropdown(
                            label="Show wells with largest misfit",
                            id=get_uuid(LayoutElements.HEATMAP_FILTER_LARGEST),
                            options=[
                                {
                                    "label": "Show all",
                                    "value": 0
                                },
                                {
                                    "label": "2",
                                    "value": 2
                                },
                                {
                                    "label": "4",
                                    "value": 4
                                },
                                {
                                    "label": "6",
                                    "value": 6
                                },
                                {
                                    "label": "8",
                                    "value": 8
                                },
                                {
                                    "label": "10",
                                    "value": 10
                                },
                                {
                                    "label": "12",
                                    "value": 12
                                },
                                {
                                    "label": "15",
                                    "value": 15
                                },
                                {
                                    "label": "20",
                                    "value": 20
                                },
                                {
                                    "label": "25",
                                    "value": 25
                                },
                            ],
                            value=0,
                            multi=False,
                            clearable=False,
                            persistence=True,
                            persistence_type="memory",
                        ),
                        wcc.Selectors(
                            label="Plot settings and layout",
                            open_details=True,
                            children=[
                                wcc.Dropdown(
                                    label="Plot type",
                                    id=get_uuid(
                                        LayoutElements.HEATMAP_PLOT_TYPE),
                                    options=[
                                        {
                                            "label": "Mean misfit",
                                            "value": "diffplot"
                                        },
                                        {
                                            "label":
                                            "Mean misfit relative (%)",
                                            "value": "rel_diffplot",
                                        },
                                    ],
                                    value="diffplot",
                                    multi=False,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label="Fig layout - height",
                                    id=get_uuid(
                                        LayoutElements.HEATMAP_FIGHEIGHT),
                                    options=[
                                        {
                                            "label": "Very small",
                                            "value": 250,
                                        },
                                        {
                                            "label": "Small",
                                            "value": 350,
                                        },
                                        {
                                            "label": "Medium",
                                            "value": 450,
                                        },
                                        {
                                            "label": "Large",
                                            "value": 700,
                                        },
                                        {
                                            "label": "Very large",
                                            "value": 1000,
                                        },
                                    ],
                                    value=450,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                                wcc.Dropdown(
                                    label=
                                    "Color range scaling (relative to max)",
                                    id=get_uuid(LayoutElements.
                                                HEATMAP_SCALE_COL_RANGE),
                                    options=[{
                                        "label": f"{x:.0%}",
                                        "value": x
                                    } for x in [
                                        0.1,
                                        0.2,
                                        0.3,
                                        0.4,
                                        0.5,
                                        0.6,
                                        0.7,
                                        0.8,
                                        0.9,
                                        1.0,
                                        1.5,
                                        2.0,
                                    ]],
                                    style={"display": "block"},
                                    value=1.0,
                                    clearable=False,
                                    persistence=True,
                                    persistence_type="memory",
                                ),
                            ],
                        ),
                    ],
                ),
                wcc.Frame(
                    style={
                        "flex": 4,
                        "minWidth": "500px"
                    },
                    children=[
                        html.Div(id=get_uuid(LayoutElements.HEATMAP_GRAPH))
                    ],
                ),
            ],
        ),
    ]
    return children
    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 settings_layout(uuid: str, tab: str,
                    volumemodel: InplaceVolumesModel) -> wcc.Selectors:
    return wcc.Selectors(
        label="⚙️ SETTINGS",
        open_details=True,
        children=[
            wcc.Dropdown(
                label="Scale:",
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": "Scale"
                },
                options=[
                    {
                        "label": "Relative value (%)",
                        "value": "Percentage"
                    },
                    {
                        "label": "Relative value",
                        "value": "Absolute"
                    },
                    {
                        "label": "True value",
                        "value": "True"
                    },
                ],
                value="Percentage",
                clearable=False,
            ),
            html.Div(
                style={"margin-top": "10px"},
                children=wcc.Checklist(
                    id={
                        "id": uuid,
                        "tab": tab,
                        "selector": "real_scatter"
                    },
                    options=[{
                        "label": "Show realization points",
                        "value": "Show"
                    }],
                    value=[],
                ),
            ),
            cut_by_ref(uuid, tab),
            labels_display(uuid, tab),
            wcc.Dropdown(
                label="Reference:",
                id={
                    "id": uuid,
                    "tab": tab,
                    "selector": "Reference"
                },
                options=[{
                    "label": elm,
                    "value": elm
                } for elm in volumemodel.sensitivities],
                value="rms_seed" if "rms_seed" in volumemodel.sensitivities
                else volumemodel.sensitivities[0],
                clearable=False,
            ),
        ],
    )
 def layout(self) -> html.Div:
     """Main layout"""
     return wcc.FlexBox(
         id=self.uuid("layout"),
         children=[
             wcc.FlexColumn(
                 flex=1,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     children=[
                         wcc.Selectors(
                             label="Selectors",
                             children=[
                                 self.selector(
                                     "Ensemble",
                                     "ensemble",
                                     "ENSEMBLE",
                                 ),
                                 self.selector(
                                     "Grid source",
                                     "source",
                                     "SOURCE",
                                 ),
                                 self.response_selector,
                                 self.plot_selector,
                             ],
                         ),
                         wcc.Selectors(
                             label="Filters",
                             id=self.uuid("filters"),
                             children=self.filter_selectors,
                         ),
                     ],
                 ),
             ),
             wcc.FlexColumn(
                 flex=3,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     color="white",
                     highlight=False,
                     children=[
                         html.Div(
                             style={"height": "600px"},
                             id=self.uuid("graph-wrapper"),
                         ),
                         html.Div(
                             children=[
                                 html.Div(
                                     id=self.uuid("volume_title"),
                                     style={"textAlign": "center"},
                                     children="",
                                 ),
                                 html.Div(
                                     style={"fontSize": "15px"},
                                     children=DataTable(
                                         id=self.uuid("table"),
                                         sort_action="native",
                                         filter_action="native",
                                         page_action="native",
                                         page_size=10,
                                     ),
                                 ),
                             ],
                         ),
                     ],
                 ),
             ),
             wcc.FlexColumn(
                 flex=3,
                 children=wcc.Frame(
                     style={"height": "90vh"},
                     id=self.uuid("tornado-wrapper"),
                     color="white",
                     highlight=False,
                     children=[self.tornadoplot.layout],
                 ),
             ),
         ],
     )
 def layout(self):
     return html.Div(
         id=self.uuid("main-div"),
         children=[
             wcc.FlexBox(children=[
                 wcc.Frame(
                     style={
                         "flex": 1,
                         "style": "45vh"
                     },
                     children=[
                         wcc.Selectors(
                             label="Filters",
                             children=[
                                 wcc.Label(
                                     children="Filter observations:",
                                     style={"display": "block"},
                                 ),
                                 dcc.Input(
                                     id=self.uuid("filter1_id"),
                                     value="",
                                     type="text",
                                     debounce=True,
                                 ),
                                 wcc.Label(
                                     children="Filter parameters:",
                                     style={"display": "block"},
                                 ),
                                 dcc.Input(
                                     id=self.uuid("filter2_id"),
                                     value="",
                                     type="text",
                                     debounce=True,
                                 ),
                             ],
                         ),
                         wcc.Selectors(
                             label="Selected output:",
                             children=wcc.RadioItems(
                                 id=self.uuid("choice_id"),
                                 options=[
                                     {
                                         "label": "One by one observation",
                                         "value": "ONE",
                                     },
                                     {
                                         "label":
                                         "All minus one observation",
                                         "value": "ALL",
                                     },
                                 ],
                                 value="ONE",
                             ),
                         ),
                         wcc.Selectors(
                             label="Parameter distribution:",
                             children=dcc.Checklist(
                                 id=self.uuid("choice_hist_id"),
                                 options=[
                                     {
                                         "label":
                                         "Transformed dist. (if available)",
                                         "value": "TRANS",
                                     },
                                 ],
                                 value=[],
                             ),
                         ),
                     ],
                 ),
                 wcc.Frame(
                     color="white",
                     highlight=False,
                     style={"flex": 3},
                     children=[
                         html.Div(id=self.uuid("output_graph"), ),
                     ],
                 ),
                 wcc.Frame(
                     color="white",
                     highlight=False,
                     style={"flex": 3},
                     children=[
                         html.Div(id=self.uuid("click_data"), ),
                     ],
                 ),
             ]),
             html.Div(children=[
                 html.H4(children=
                         "Table of ten highest parameters change/update Ks",
                         ),
                 html.Div(id=self.uuid("generate_table"), ),
             ]),
         ],
     )
示例#20
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,
            ),
        ]
    )
示例#21
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 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 layout(self) -> wcc.FlexBox:
     return html.Div(
         id=self.uuid("layout"),
         children=[
             clientside_stores(
                 get_uuid=self.uuid,
                 realizations=self._realizations,
                 initial_settings=self._initial_settings,
             ),
             wcc.FlexBox(children=[
                 wcc.FlexColumn(
                     wcc.Frame(
                         style={
                             "height": "91vh",
                         },
                         children=[
                             html.Div(children=[
                                 wcc.Selectors(
                                     label="Intersection controls",
                                     children=intersection_data_layout(
                                         get_uuid=self.uuid,
                                         surface_attributes=self.
                                         _surf_attrs,
                                         surface_names=self._surfacenames,
                                         ensembles=self.ensembles,
                                         use_wells=self._use_wells,
                                         well_names=self._well_set_model.
                                         well_names if self.
                                         _well_set_model else [],
                                         surface_geometry=self.
                                         first_surface_geometry,
                                         initial_settings=self.
                                         _initial_settings.get(
                                             "intersection_data", {}),
                                     ),
                                 ),
                                 html.Div(
                                     id=self.uuid(
                                         "surface-settings-wrapper"),
                                     children=wcc.Selectors(
                                         label="Map controls",
                                         children=[
                                             map_data_layout(
                                                 uuid=self.uuid(
                                                     "map-settings"),
                                                 surface_attributes=self.
                                                 _surf_attrs,
                                                 surface_names=self.
                                                 _surfacenames,
                                                 ensembles=self.ensembles,
                                                 realizations=self.
                                                 _realizations,
                                                 use_wells=self._use_wells,
                                             )
                                         ],
                                     ),
                                 ),
                                 wcc.Selectors(
                                     label="Filters",
                                     children=[
                                         dialog.open_dialog_layout(
                                             uuid=self.uuid("dialog"),
                                             dialog_id="realization-filter",
                                             title="Realization filter",
                                         ),
                                     ],
                                 ),
                             ], ),
                         ],
                     )),
                 wcc.FlexColumn(
                     flex=6,
                     children=intersection_and_map_layout(
                         get_uuid=self.uuid),
                 ),
             ]),
             dialog.dialog_layout(
                 uuid=self.uuid("dialog"),
                 dialog_id="color",
                 title="Color settings",
                 size="lg",
                 children=[
                     html.Div(children=[self._color_picker.layout], ),
                 ],
             ),
             dialog.dialog_layout(
                 uuid=self.uuid("dialog"),
                 dialog_id="realization-filter",
                 title="Filter realizations",
                 children=[
                     realization_layout(
                         uuid=self.uuid("intersection-data"),
                         realizations=self._realizations,
                         value=self._initial_settings.get(
                             "intersection_data",
                             {}).get("realizations", self._realizations),
                     ),
                     dialog.clear_all_apply_dialog_buttons(
                         uuid=self.uuid("dialog"),
                         dialog_id="realization-filter"),
                 ],
             ),
             dialog.dialog_layout(
                 uuid=self.uuid("dialog"),
                 dialog_id="uncertainty-table",
                 title="Uncertainty table",
                 children=[
                     uncertainty_table_layout(
                         uuid=self.uuid("uncertainty-table"), )
                 ],
             ),
         ],
     )
示例#24
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.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",
                    ),
                ],
            ),
        ],
    )
 def control_div(self) -> html.Div:
     return html.Div(children=[
         wcc.Selectors(
             label="Mode",
             children=[
                 wcc.RadioItems(
                     id=self.uuid("mode"),
                     options=[
                         {
                             "label": "Running time matrix",
                             "value": "running_time_matrix",
                         },
                         {
                             "label": "Parameter parallel coordinates",
                             "value": "parallel_coordinates",
                         },
                     ],
                     value="running_time_matrix",
                 ),
             ],
         ),
         wcc.Selectors(
             label="Ensemble",
             children=[
                 wcc.Dropdown(
                     id=self.uuid("ensemble"),
                     options=[{
                         "label": ens,
                         "value": ens
                     } for ens in self.ensembles],
                     value=self.ensembles[0],
                     clearable=False,
                 ),
             ],
         ),
         wcc.Selectors(
             label="Coloring",
             children=[
                 html.Div(
                     id=self.uuid("matrix_color"),
                     children=[
                         wcc.Dropdown(
                             label="Color jobs relative to running time of:",
                             id=self.uuid("relative_runtime"),
                             options=[{
                                 "label": rel,
                                 "value": rel
                             } for rel in RunningTimeAnalysisFMU.
                                      COLOR_MATRIX_BY_LABELS],
                             value=RunningTimeAnalysisFMU.
                             COLOR_MATRIX_BY_LABELS[0],
                             clearable=False,
                         ),
                     ],
                 ),
                 html.Div(
                     id=self.uuid("parcoords_color"),
                     style={"display": "none"},
                     children=[
                         wcc.Dropdown(
                             label="Color realizations relative to:",
                             id=self.uuid("relative_real"),
                             options=[{
                                 "label": rel,
                                 "value": rel
                             } for rel in RunningTimeAnalysisFMU.
                                      COLOR_PARCOORD_BY_LABELS],
                             value=RunningTimeAnalysisFMU.
                             COLOR_PARCOORD_BY_LABELS[0],
                             clearable=False,
                         ),
                     ],
                 ),
             ],
         ),
         wcc.Selectors(
             label="Filtering",
             children=[
                 html.Div(
                     id=self.uuid("parameter_dropdown"),
                     style={"display": "none"},
                     children=[
                         wcc.SelectWithLabel(
                             id=self.uuid("parameters"),
                             style={
                                 "overflowX": "auto",
                                 "fontSize": "0.97rem"
                             },
                             options=[{
                                 "label": param,
                                 "value": param
                             } for param in self.parameters],
                             multi=True,
                             value=self.visual_parameters,
                             size=min(50, len(self.visual_parameters)),
                         ),
                     ],
                 ),
                 html.Div(
                     id=self.uuid("filter_short_checkbox"),
                     children=[
                         wcc.Checklist(
                             label="Filter jobs",
                             id=self.uuid("filter_short"),
                             options=[
                                 {
                                     "label":
                                     "Slowest in ensemble less than "
                                     f"{self.filter_shorter}s",
                                     "value": "filter_short",
                                 },
                             ],
                             value=["filter_short"],
                         ),
                     ],
                 ),
             ],
         ),
     ])