equinor/snapwell

diff is reset, but never used

oyvindeide opened this issue · 1 comments

This diff is reset, but never used:

diff = 0

Instead we do logs["TVD_DIFF"].append(new_tvd - z) should that be logs["TVD_DIFF"].append(diff)?

I think the code is correct altough surprising. I suggest the following refactoring:

       diff = z - new_tvd
       if abs(diff) > 100:
           logging.warning("Observed a vertical adjustment of %d m.  Ignoring.", diff)
           new_tvd = z
           logs["TVD_DIFF"].append(0)
       else:
           logs["TVD_DIFF"].append(diff)

Alternatively:

        if abs(z - new_tvd) > 100:
            logging.warning("Observed a vertical adjustment of %d m.  Ignoring.", diff)
            new_tvd = z

        logs["TVD_DIFF"].append(z - new_tvd)