Skip to content

get_isosurface_1d does not work as expected #549

@OnnoEbbens

Description

@OnnoEbbens

I try to calculate isosurfaces but I don't get the results I expect when the isovalue is crossed multiple times.

>>> import numpy as np
>>> import nlmod
>>> nlmod.layers.get_isosurface_1d(np.array([10, 20, 30, 30, 10]),
                                   np.array([-1, -2, -3, -4, -5]),
                                   25)
np.float64(-5.0)

It works fine when the isovalue is crossed one time

>>> nlmod.layers.get_isosurface_1d(np.array([10, 20, 30, 30, 40]),
                                   np.array([-1, -2, -3, -4, -5]),
                                   25)
np.float64(-2.5)

The docstring states:

This function interpolates linearly along z, if da crosses the given interpolation
value at multiple depths, the first elevation is returned.
but this doesn't seem to be the case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions