def test_render_deckgl_map(
        dash_duo: dash.testing.composite.DashComposite) -> None:

    with open("react/src/demo/example-data/deckgl-map.json",
              encoding="utf8") as json_file:
        deckgl_data = json.load(json_file)[0]

    app = dash.Dash(__name__)
    app.layout = webviz_subsurface_components.DeckGLMap(**deckgl_data)

    dash_duo.start_server(app)
    assert dash_duo.get_logs() == []  # Console should have no errors
示例#2
0
    # the whole RGB range for increased precision.
    # The client will need to reverse this operation.
    scale_factor = (256 * 256 * 256 - 1) / (max_value - min_value)
    map_data = (map_data - min_value) * scale_factor

    map_data = array2d_to_png(map_data)
    COLOR_MAP = "https://cdn.jsdelivr.net/gh/kylebarron/deck.gl-raster/assets/colormaps/plasma.png"
    WELLS = (
        "https://raw.githubusercontent.com/equinor/webviz-subsurface-components/"
        "master/src/demo/example-data/volve_wells.json")
    left_map_spec = LeftMapSpec(min_value, max_value)
    left_map = webviz_subsurface_components.DeckGLMap(
        id="DeckGL-Map-Left",
        resources={
            "propertyMap": map_data,
            "colormap": COLOR_MAP,
            "wells": WELLS,
        },
        deckglSpecPatch=left_map_spec.create_patch(),
    )

    right_map_spec = RightMapSpec(min_value, max_value)
    right_map = webviz_subsurface_components.DeckGLMap(
        id="DeckGL-Map-Right",
        resources={
            "propertyMap": map_data,
            "colormap": COLOR_MAP,
            "wells": WELLS,
        },
        deckglSpecPatch=right_map_spec.create_patch(),
    )
示例#3
0
 deckgl_map_1 = webviz_subsurface_components.DeckGLMap(
     id="DeckGL-Map",
     deckglSpec={
         "initialViewState": {
             "target": [bounds[0] + width / 2, bounds[1] + height / 2, 0],
             "zoom": -3,
         },
         "layers": [
             {
                 "@@type": "ColormapLayer",
                 "id": "colormap-layer",
                 "bounds": bounds,
                 "image": map_data,
                 "colormap": COLORMAP,
                 "valueRange": [min_value, max_value],
                 "pickable": True,
             },
             {
                 "@@type": "Hillshading2DLayer",
                 "id": "hillshading-layer",
                 "bounds": bounds,
                 "opacity": 1.0,
                 "valueRange": [min_value, max_value],
                 "image": map_data,
             },
         ],
         "views": [
             {
                 "@@type": "OrthographicView",
                 "id": "main",
                 "controller": True,
                 "x": "0%",
                 "y": "0%",
                 "width": "100%",
                 "height": "100%",
                 "flipY": False,
             },
             {
                 "@@type": "OrthographicView",
                 "id": "minimap",
                 "controller": False,
                 "x": "80%",
                 "y": "75%",
                 "width": "20%",
                 "height": "25%",
                 "flipY": False,
                 "clear": {
                     "color": [0.9, 0.9, 0.9, 1],
                     "depth": True
                 },
                 "viewState": {
                     "id": "main",
                     "zoom": -5
                 },
             },
         ],
     },
 )
示例#4
0
 map_obj = webviz_subsurface_components.DeckGLMap(
     id="deckgl-map",
     resources={
         "propertyMap": map_data,
     },
     deckglSpecBase={
         "initialViewState": {
             "target": [bounds[0] + width / 2, bounds[1] + height / 2, 0],
             "zoom": -3,
         },
         "layers": [
             {
                 "@@type": "ColormapLayer",
                 "id": "colormap-layer",
                 "bounds": bounds,
                 "image": "@@#resources.propertyMap",
                 "colormap": COLOR_MAP,
                 "valueRange": [min_value, max_value],
                 "pickable": True,
             },
             {
                 "@@type": "Hillshading2DLayer",
                 "id": "hillshading-layer",
                 "bounds": bounds,
                 "opacity": 1.0,
                 "valueRange": [min_value, max_value],
                 "image": "@@#resources.propertyMap",
                 "pickable": True,
             },
             {
                 "@@type": "DrawingLayer",
                 "id": "drawing-layer",
                 "data": {
                     "type": "FeatureCollection",
                     "features": []
                 },
             },
             {
                 "@@type": "WellsLayer",
                 "id": "wells-layer",
                 "data": WELLS,
                 "logData": LOGS,
                 "opacity": 1.0,
                 "lineWidthScale": 5,
                 "pointRadiusScale": 8,
                 "outline": True,
                 "logRadius": 6,
                 "logrunName": "BLOCKING",
                 "logName": "ZONELOG",
                 "logCurves": True,
                 "refine": True,
             },
         ],
         "views": [{
             "@@type": "OrthographicView",
             "id": "main",
             "controller": {
                 "doubleClickZoom": False
             },
             "x": "0%",
             "y": "0%",
             "width": "100%",
             "height": "100%",
             "flipY": False,
         }],
     },
 )
示例#5
0
 deckgl_map_left = webviz_subsurface_components.DeckGLMap(
     id="DeckGL-Map-Left",
     deckglSpec={
         "initialViewState": {
             "target": [bounds[0] + width / 2, bounds[1] + height / 2, 0],
             "zoom": -3,
         },
         "layers": [
             {
                 "@@type": "ColormapLayer",
                 "id": "colormap-layer",
                 "bounds": bounds,
                 "image": map_data,
                 "colormap": COLORMAP,
                 "valueRange": [min_value, max_value],
                 "pickable": True,
             },
             {
                 "@@type": "Hillshading2DLayer",
                 "id": "hillshading-layer",
                 "bounds": bounds,
                 "opacity": 1.0,
                 "valueRange": [min_value, max_value],
                 "image": map_data,
             },
             {
                 "@@type": "DrawingLayer",
                 "id": "drawing-layer",
                 "mode": "drawLineString",
                 "data": {
                     "type": "FeatureCollection",
                     "features": []
                 },
             },
         ],
         "views": [{
             "@@type": "OrthographicView",
             "id": "main",
             "controller": True,
             "x": "0%",
             "y": "0%",
             "width": "100%",
             "height": "100%",
             "flipY": False,
         }],
     },
 )
 deckgl_map_left = webviz_subsurface_components.DeckGLMap(
     id="DeckGL-Map-Left",
     resources={
         "propertyMap": map_data,
     },
     deckglSpecPatch=[
         {
             "op": "replace",
             "path": "",
             "value": {
                 "initialViewState": {
                     "target":
                     [bounds[0] + width / 2, bounds[1] + height / 2, 0],
                     "zoom":
                     -3,
                 },
                 "layers": [
                     {
                         "@@type": "ColormapLayer",
                         "id": "colormap-layer",
                         "bounds": bounds,
                         "image": "@@#resources.propertyMap",
                         "colormap": COLORMAP,
                         "valueRange": [min_value, max_value],
                         "pickable": True,
                     },
                     {
                         "@@type": "Hillshading2DLayer",
                         "id": "hillshading-layer",
                         "bounds": bounds,
                         "opacity": 1.0,
                         "valueRange": [min_value, max_value],
                         "image": "@@#resources.propertyMap",
                         "pickable": True,
                     },
                     {
                         "@@type": "DrawingLayer",
                         "id": "drawing-layer",
                         "mode": "drawLineString",
                         "data": {
                             "type": "FeatureCollection",
                             "features": []
                         },
                     },
                 ],
                 "views": [{
                     "@@type": "OrthographicView",
                     "id": "main",
                     "controller": True,
                     "x": "0%",
                     "y": "0%",
                     "width": "100%",
                     "height": "100%",
                     "flipY": False,
                 }],
             },
         },
     ],
 )
 map_obj = wsc.DeckGLMap(
     id="deckgl-map",
     resources={
         "propertyMap": map_data,
     },
     coords={
         "visible": True,
         "multiPicking": True,
         "pickDepth": 10
     },
     scale={"visible": True},
     coordinateUnit="m",
     bounds=bounds,
     layers=[
         {
             "@@type": "ColormapLayer",
             "image": "@@#resources.propertyMap",
             "bounds": bounds,
             "colormap": COLOR_MAP,
             "valueRange": [min_value, max_value],
         },
         {
             "@@type": "Hillshading2DLayer",
             "bounds": bounds,
             "valueRange": [min_value, max_value],
             "image": "@@#resources.propertyMap",
         },
         {
             "@@type": "DrawingLayer",
             "data": "@@#editedData.data",
             "selectedDrawingFeature":
             "@@#editedData.selectedDrawingFeature",
         },
         {
             "@@type": "WellsLayer",
             "data": WELLS,
             "logData": LOGS,
             "logrunName": "BLOCKING",
             "logName": "ZONELOG",
             "selectedWell": "@@#editedData.selectedWell",
         },
     ],
     editedData={
         "selectedWell": "",
         "selectedDrawingFeature": [],
         "data": {
             "type": "FeatureCollection",
             "features": []
         },
     },
 )