equinor / webviz-subsurface-components

Custom subsurface visualizations for use in Webviz and/or Dash.
https://github.com/orgs/equinor/projects/24
Mozilla Public License 2.0
40 stars 41 forks source link

Pointer location "depth" information in 3D shows relative location of Y to the middle instead of z-value #1828

Closed eirik-morken closed 11 months ago

eirik-morken commented 11 months ago

Python, package version 1.0.1

We are experiencing an issue where the pointer information shows the wrong information as "Depth". The "Property" value is the correct depth, but the "Depth" value seems to say how far along the Y-axis relative to the center of the grid the pointer currently is. If you are in the middle of the grid the depth is 0. You move up along Y-axis it increases, and you move down it decreases.

image

Map layer code

{
"@@type": "MapLayer",
"id":'MAP_LAYER',
# "meshData": depth_surface.get_values1d(order="F", asmasked=True).astype(np.float32).filled(np.NaN),
"meshUrl":"/map/map_identifier",
"ZIncreasingDownwards" : yflip_left_handed,

"frame": {
    "origin": [depth_surface.xori, depth_surface.yori],
    "count": [depth_surface.ncol, depth_surface.nrow],
    "increment": [depth_surface.xinc, depth_surface.yinc],
    "rotDeg": depth_surface.rotation,
    },

"contours": [0, grid_settings["contour-gap-size"]],
"isContoursDepth": True,
"gridLines": False,
"material": {"shininess":4},
"smoothShading": True,
"colorMapName": grid_settings["color"],
"colorMapRange": [grid_settings["min_color"],grid_settings["max_color"]],
"name": "mesh",
}

Complete element code

DashSubsurfaceViewer(
                coords={"visible": True, "style":{"color":"black"}},
                scale={
                "visible": True  # Set to False to hide the scale
                },
                id='surface_grid',
                coordinateUnit = "m",
                views = {
                    "layout": [1, 1],
                    "showLabel": False,
                    "viewports": [
                        {
                        "id": "deck_view",
                        "show3D": grid_settings["3D"],
                        "layerIds": layersid,
                        },
                    ],
                },

                bounds = [
                    depth_surface.xmin,
                    depth_surface.ymin - (depth_surface.ymax-depth_surface.ymin)*0.1,
                    depth_surface.xmax,
                    depth_surface.ymax + (depth_surface.ymax-depth_surface.ymin)*0.1,
                ],

                layers=[
                {
                    "@@type": "MapLayer",
                    "id":'MAP_LAYER',
                    # "meshData": depth_surface.get_values1d(order="F", asmasked=True).astype(np.float32).filled(np.NaN),
                    "meshUrl":"/map/map_identifier",
                    "ZIncreasingDownwards" : yflip_left_handed,

                    "frame": {
                        "origin": [depth_surface.xori, depth_surface.yori],
                        "count": [depth_surface.ncol, depth_surface.nrow],
                        "increment": [depth_surface.xinc, depth_surface.yinc],
                        "rotDeg": depth_surface.rotation,
                        },

                    "contours": [0, grid_settings["contour-gap-size"]],
                    "isContoursDepth": True,
                    "gridLines": False,
                    "material": {"shininess":4},
                    "smoothShading": True,
                    "colorMapName": grid_settings["color"],
                    "colorMapRange": [grid_settings["min_color"],grid_settings["max_color"]],
                    "name": "mesh",
                },

                {
                    "@@type": "AxesLayer",
                    "id": 'AXES_LAYER',
                    "bounds": [
                            depth_surface.xmin,
                            depth_surface.ymin,
                            min_grid_value,
                            depth_surface.xmax,
                            depth_surface.ymax,
                            max_grid_value,
                            ],
                }
                ]
                )
hkfb commented 11 months ago

This might have been fixed in recent versions of @webviz/subsurface-viewer. Do you know which version is included in the Python package?

Can you reproduce this in any of the storybook examples?

Just saw there is a 1.0.2 release. Does it solve the issue?

eirik-morken commented 11 months ago

I still experience the same issue.

Not able to recreate in storybook, but as far as I can see I do not have any settings that are different from the storybook. So do not understand how it would happen.

I also see that Depth and Property have changed their position in my image compared to storybook, if that means anything.

Is there a way to manually set/tweak these values?

nilscb commented 11 months ago

This used to work in dash did it not? At least I believe it has always worked in storybook.

eirik-morken commented 11 months ago

Yes, worked in older version. Our dev webviz in radix which uses webviz-subsurface-components-0.4.15 does not have this issue.

nilscb commented 11 months ago

Christophe Winkler reminded me on something that may solve this. The component has a property coords:

/**
 * Parameters for the InfoCard component
 */
coords?: {
    visible?: boolean | null;
    multiPicking?: boolean | null;
    pickDepth?: number | null;
};

Its typically used to hide of the readout panel. What is a bit confusing and poorly documented is that one also need to set "multiPicking" to true otherwise the readout will not work correctly. We should probably change this to always be true and not expose it to the user perhaps, pickDepth has a sensible default and you do not need to use this property.

eirik-morken commented 11 months ago

Thank you, that solved the issue 🏆