diff is reset, but never used
oyvindeide opened this issue · 1 comments
oyvindeide commented
This diff
is reset, but never used:
Line 326 in 8233707
Instead we do logs["TVD_DIFF"].append(new_tvd - z)
should that be logs["TVD_DIFF"].append(diff)
?
eivindjahren commented
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)