Example #1
0
    def add_surface_layer(
        self,
        surface: RegularSurface,
        name: str,
        tooltip: str = None,
        color: str = "blue",
        checked: bool = True,
    ):
        """Adds a polyline overlay layer
        for a given XTGeo surface"""

        x_arr, y_arr = self.slice_surface(surface.copy())
        positions = [[x, y] for x, y in zip(x_arr, y_arr)]

        self._surface_layers.append({
            "name":
            name,
            "checked":
            checked,
            "base_layer":
            False,
            "data": [{
                "type": "polyline",
                "positions": positions,
                "color": color,
                "tooltip": tooltip if tooltip else name,
            }],
        })
Example #2
0
def calculate_surface_difference(
    surface: xtgeo.RegularSurface,
    surface2: xtgeo.RegularSurface,
    calculation: str = "Difference",
) -> xtgeo.RegularSurface:
    surface3 = surface.copy()
    if calculation == "Difference":
        surface3.values = surface3.values - surface2.values
    elif calculation == "Sum":
        surface3.values = surface3.values + surface2.values
    elif calculation == "Product":
        surface3.values = surface3.values * surface2.values
    elif calculation == "Quotient":
        surface3.values = surface3.values / surface2.values
    return surface3