welly icon indicating copy to clipboard operation
welly copied to clipboard

Unary operator doesn't work

Open kwinkunks opened this issue 3 years ago • 1 comments

E.g. this doesn't work:

w = Well.from_las('data/P-129_out.LAS')
gr = w.data['GR']

# This works:
gr.plot_2d(cmap='viridis', curve=True, lw=0.3, edgecolor='k')

# This doesn't:
(200 - gr).plot_2d(cmap='viridis', curve=True, lw=0.3, edgecolor='k')

Should be easy enough to fix with __neg__() and __pos__() I think.

kwinkunks avatar Jan 10 '22 17:01 kwinkunks

Do you mean here that (200-gr) is not working properly?

    curve = well.data['GR']
    curve2 = 200-curve

    arr1 = curve.df.to_numpy()
    arr3 = arr1-200

    arr2 = curve2.df.to_numpy()

    all(arr2 == arr3)

     Out[11]: True

patrick-reinhard avatar Jan 11 '22 08:01 patrick-reinhard