Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d647774

Browse files
author
Jeff Whitaker
committed
fix bug in griddata that occurs when mask is a scalar boolean (found by James Conners)
svn path=/trunk/matplotlib/; revision=7965
1 parent 974b360 commit d647774

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/matplotlib/mlab.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,9 +2687,11 @@ def griddata(x,y,z,xi,yi,interp='nn'):
26872687
raise TypeError("inputs x,y,z must all be 1D arrays of the same length")
26882688
# remove masked points.
26892689
if hasattr(z,'mask'):
2690-
x = x.compress(z.mask == False)
2691-
y = y.compress(z.mask == False)
2692-
z = z.compressed()
2690+
# make sure mask is not a scalar boolean array.
2691+
if a.mask.ndim:
2692+
x = x.compress(z.mask == False)
2693+
y = y.compress(z.mask == False)
2694+
z = z.compressed()
26932695
if _use_natgrid: # use natgrid toolkit if available.
26942696
if interp != 'nn':
26952697
raise ValueError("only natural neighor interpolation"

0 commit comments

Comments
 (0)