Hi, I am trying to use griddata to interpolate some irregularly spaced data onto a linspace-created mesh in order to get a temperature plot.
I’ve been able to follow this example and it’s worked perfectly for me: http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html
However, when I do my own data I get an error message that says:
Traceback (most recent call last):
File “make_colormap.py”, line 248, in
File “/usr/lib/pymodules/python2.6/matplotlib/mlab.py”, line 2579, in griddata
raise ValueError("output grid must have constant spacing"
ValueError: output grid must have constant spacing when using interp=‘linear’
Looking into the documentation it seems that this is just suggesting that the xi,yi grids to be interpolated on have constant spacing. I don’t know if this is supposed to be the SAME constant spacing in xi and yi, but it appears not to be, since the example above uses the line:
xi = np.linspace(-2.1,2.1,100)
yi = np.linspace(-2.1,2.1,200)
so one is twice as fine as the other.
However, my code, when I do something like
it gives me the above error complaining about “constant spacing”.
Anyone have an idea what I might be missing here? I can turn interp to ‘nn’ and the code works fine, but I’m just curious what about a “constant spaced” output grid I don’t understand. Is it even possible to create a non-constant spaced output grid with linspace?
Thanks for the help!