# Buggy code
def __init__(
    self, points, values, method="linear", bounds_error=True, fill_value=np.nan
):
    if method not in ["linear", "nearest"]:
        raise ValueError("Method '%s' is not defined" % method)
    self.method = method
    self.bounds_error = bounds_error

    if not hasattr(values, "ndim"):
        # allow reasonable duck-typed values
        values = np.asarray(values)

    if len(points) > values.ndim:
        raise ValueError(
            "There are %d point arrays, but values has %d "
            "dimensions" % (len(points), values.ndim)
        )

    if hasattr(values, "dtype") and hasattr(values, "astype"):
        if not np.issubdtype(values.dtype, np.inexact):
            values = values.astype(float)

    self.fill_value = fill_value
    if fill_value is not None:
        fill_value_dtype = np.asarray(fill_value).dtype
        if hasattr(values, "dtype") and not np.can_cast(fill_value_dtype, values.dtype):
            raise ValueError(
                "fill_value must be either 'None' or of a type compatible with values"
            )

    for i, p in enumerate(points):
        if not np.all(np.diff(p) > 0.0):
            raise ValueError(
                "The points in dimension %d must be strictly ascending" % i
            )
        if not np.asarray(p).ndim == 1:
            raise ValueError("The points in dimension %d must be 1-dimensional" % i)
        if not values.shape[i] == len(p):
            raise ValueError(
                "There are %d points and %d values in "
                "dimension %d" % (len(p), values.shape[i], i)
            )
    self.grid = tuple([np.asarray(p) for p in points])
    self.values = values


# Traceback (ValueError)
import numpy as np
from scipy import interpolate

values = np.ones((10, 20 , 30), dtype='>f4')
points = map(np.arange, values.shape)
xi = [(1, 1, 1)]
interpolator = interpolate.RegularGridInterpolator(points, values)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 1495, in __init__
raise ValueError("fill_value must be either 'None' or "
ValueError: fill_value must be either 'None' or of a type compatible with values
interpolator = interpolate.RegularGridInterpolator(points, values, fill_value=0.)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 1495, in __init__
raise ValueError("fill_value must be either 'None' or "
ValueError: fill_value must be either 'None' or of a type compatible with values

# Fixed code
def __init__(
    self, points, values, method="linear", bounds_error=True, fill_value=np.nan
):
    if method not in ["linear", "nearest"]:
        raise ValueError("Method '%s' is not defined" % method)
    self.method = method
    self.bounds_error = bounds_error

    if not hasattr(values, "ndim"):
        # allow reasonable duck-typed values
        values = np.asarray(values)

    if len(points) > values.ndim:
        raise ValueError(
            "There are %d point arrays, but values has %d "
            "dimensions" % (len(points), values.ndim)
        )

    if hasattr(values, "dtype") and hasattr(values, "astype"):
        if not np.issubdtype(values.dtype, np.inexact):
            values = values.astype(float)

    self.fill_value = fill_value
    if fill_value is not None:
        fill_value_dtype = np.asarray(fill_value).dtype
        if not NUMPY_LT_160:
            if hasattr(values, "dtype") and not np.can_cast(
                fill_value_dtype, values.dtype, casting="same_kind"
            ):
                raise ValueError(
                    "fill_value must be either 'None' or "
                    "of a type compatible with values"
                )

    for i, p in enumerate(points):
        if not np.all(np.diff(p) > 0.0):
            raise ValueError(
                "The points in dimension %d must be strictly ascending" % i
            )
        if not np.asarray(p).ndim == 1:
            raise ValueError("The points in dimension %d must be 1-dimensional" % i)
        if not values.shape[i] == len(p):
            raise ValueError(
                "There are %d points and %d values in "
                "dimension %d" % (len(p), values.shape[i], i)
            )
    self.grid = tuple([np.asarray(p) for p in points])
    self.values = values