From: hardi on

Hi,

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 in the griddata to get a 3D-grid
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 mpl_toolkits.mplot3d import axes3d
from scipy.interpolate import interp2d
import matplotlib.pyplot as plt
from matplotlib import mlab


plt.clf()
fig = plt.figure(1)
ax = axes3d.Axes3D(fig)
#read data
(ff,ZZ,A,a) = np.loadtxt("accuracy-map.txt", unpack=True)
f=np.log10(ff)
z=np.log10(ZZ)

##grid everything
fgrid, zgrid=np.meshgrid(f,z)
#define grid
ef=np.linspace(min(f), max(f), len(f))
ez=np.linspace(min(z), max(z), len(f))
Agrid=mlab.griddata(f,z,A, ef,ez)

int2d=interp2d(fgrid, zgrid, Agrid, kind='linear')

ax.plot(f, z, A, 'ok', markerfacecolor='w')
ax.plot_surface(fgrid, zgrid, Agrid)

ax.set_xlim3d((min(f), max(f)))
ax.set_ylim3d(min(z), max(z))
ax.set_zlim3d(0,100)
plt.show()



http://old.nabble.com/file/p29288748/novo-error.pdf novo-error.pdf

--
View this message in context: http://old.nabble.com/Linear-nterpolation-in-3D-tp29288748p29288748.html
Sent from the Python - python-list mailing list archive at Nabble.com.

From: Chris Rebert on
On Wed, Jul 28, 2010 at 9:57 AM, hardi <schrabacke(a)web.de> wrote:
> Hi,
>
> 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 in the griddata to get a 3D-grid
> 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?

Since interp2d() is part of SciPy, you may have better luck asking on
the SciPy-specific mailinglist:
http://mail.scipy.org/mailman/listinfo/scipy-user

Cheers,
Chris