Hi Philipp,
thanks for reporting the bug and providing the file. This was indeed a bug that we had never noticed because we never do P0 interpolation. Some of the points of bug.x2,bug.y2 lie on the boundary of the mesh, and bamg has to make a decision (whether they are inside the mesh or outside). For one point, bamg decided that it was outside, and there is no possible interpolation for P0 field so it did not know what to do. Now it will return NaN.
Please update the code, you will need to treat the NaN manually after the interpolation I am afraid (using griddata with a nearest neighbor interpolation for example).
I hope all is well in Bergen!
Best
Mathieu