# [Scipy-tickets] [SciPy] #1412: Bug in griddata (Code does not return)

SciPy Trac scipy-tickets@scipy....
Mon Mar 21 07:12:08 CDT 2011

#1412: Bug in griddata (Code does not return)
-------------------------------+--------------------------------------------
Reporter:  schicketanz        |       Owner:  somebody
Type:  defect             |      Status:  new
Priority:  high               |   Milestone:
Component:  scipy.interpolate  |     Version:  0.9.0
Keywords:  griddata           |
-------------------------------+--------------------------------------------

Comment(by schicketanz):

There was a formatting problem. Here is the correctly formatted Code:

import numpy as np[[BR]]
from scipy.interpolate import griddata[[BR]]

#coord is a circle with a regular grid[[BR]]
A = np.zeros(coord.shape[0])[[BR]]
coordi = np.array([[ 0.02803372, -0.03142812]]) #This should return
nan[[BR]]

#This does not work (Code does not return)[[BR]]
print griddata(coord, A, coordi)[[BR]]

#The triangulation works[[BR]]
from scipy.interpolate import LinearNDInterpolator[[BR]]
ip = LinearNDInterpolator(coord, A, fill_value=np.nan)[[BR]]
print 'triangulation works'[[BR]]

#This works![[BR]]
#The point is outside the convex hull. The data near this point is defined
by index[[BR]]
index = (coord[:,0]>0.02) & (coord[:,0]<0.035) & (coord[:,1]>-0.04)[[BR]]
print griddata(coord[index,:], A[index], coordi)[[BR]]

#If the data is shifted or scaled the example works[[BR]]

--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1412#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.