I get ZeroDivisionError from the following code:
Here xdata , ydata and self are all 2D numpy.ndarray (or their subclasses) with the same form and dtype=np.float32 . mask is a 2d ndarray with the same shape and dtype=bool . Here is a link for those who want to view the scipy.interpolate.griddata documentation .
Initially, xdata and ydata were obtained from an uneven cylindrical grid that has a 4-point stencil - I thought the error could come from the fact that the same point was determined several times, so I made the set of input points unique, as suggested in this question . Unfortunately, this did not seem to help. Full trace:
Traceback (most recent call last): File "/xxxxxxx/rcm.py", line 428, in <module> x[...,1].to_pz0() File "/xxxxxxx/rcm.py", line 285, in to_pz0 fill_value=fill_value) File "/usr/local/lib/python2.7/site-packages/scipy/interpolate/ndgriddata.py", line 183, in griddata ip = LinearNDInterpolator(points, values, fill_value=fill_value) File "interpnd.pyx", line 192, in scipy.interpolate.interpnd.LinearNDInterpolator.__init__ (scipy/interpolate/interpnd.c:2935) File "qhull.pyx", line 996, in scipy.spatial.qhull.Delaunay.__init__ (scipy/spatial/qhull.c:6607) File "qhull.pyx", line 183, in scipy.spatial.qhull._construct_delaunay (scipy/spatial/qhull.c:1919) ZeroDivisionError: float division
For what it's worth, the code "works" (without exception) if I use the "closest" method.
source share