[SciPy-User] Interpolation in 3D with interp2d

Jana Schulz schrabacke@web...
Sun Aug 1 14:25:37 CDT 2010


I'm trying to interpolate a 3D data (from the pic attached) with the
interp2d command. What I have, are three vectors f, z, A (x, y, z
respectively, A is the percentage data given on the isolines). I first put
the f and z in a meshgrid and afterwards pruduced a mesh with the A vector
then started to interpolate. I plotted the the data after gridding, and I
observed that almost all nodes are ignored.
Do you have any idea how to prepare data to the interp2d command?

my code so far is:

import numpy as np
from matplotlib import rc
from mpl_toolkits.mplot3d import axes3d
from scipy.interpolate import interp2d
from scipy import interpolate, mgrid
import matplotlib.pyplot as plt
from matplotlib import mlab
import griddata

fig = plt.figure(1)
ax = axes3d.Axes3D(fig)

#read data
(ff,ZZ,A,a) = np.loadtxt("accuracy-map_pointsonly.txt", unpack=True)

##grid everything
fgrid, zgrid=np.meshgrid(f,z)
#define grid
n=1e2 #number of nodes (linear)
ef=np.linspace(min(f), max(f), n)
ez=np.linspace(min(z), max(z), n)
efmesh, ezmesh=np.meshgrid(ef,ez)

efg, ezg=np.meshgrid(f, z)

int2d=interp2d(fgrid, zgrid, Ag, kind='linear')
intnew=int2d(ef, ez)                                      #return the new function

ax.plot(f,z,A,'ok', markerfacecolor='w')
ax.plot_surface(efmesh,ezmesh, intnew)
ax.view_init(elev=220, azim=270)
ax.set_xlim3d((min(f), max(f)))
ax.set_ylim3d(min(z), max(z))
WEB.DE DSL ab 19,99 Euro/Monat. Bis zu 150,- Euro Startguthaben und 
50,- Euro Geldprämie inklusive! https://freundschaftswerbung.web.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: novo-error.pdf
Type: application/octet-stream
Size: 151538 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20100801/4f8afef1/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accuracy-map_pointsonly.txt
Type: application/octet-stream
Size: 2816 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20100801/4f8afef1/attachment-0003.obj 

More information about the SciPy-User mailing list