To make value interpolation on cylindrical surface

177 views Asked by At

I have a issue to interpolate my values "c" on cylindrical surface. The problem is that possibly I dont understand how to indicate surface for gridding with gridddata function..

>import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata as gd

#Creating data in polar coordinates

phi,d = np.linspace(0,  2* np.pi, 20), np.linspace(0,20,20)
PHI,D = np.meshgrid(phi,d)
R = 2

#Transforming in X Y Z coordinates

X = R *  np.cos(PHI)
Y = R * np.sin(PHI)
Z = R * D

T=np.linspace(0,10,400)
c=np.sin(T)*np.cos(T/2)  #Value c I would like to interpolate
fig1 = plt.figure()
ax = fig1.add_subplot(1,1,1, projection='3d')
xi=np.array(np.meshgrid(X,Y,Z))

img = ax.scatter(X, Y, Z,c=c, cmap=plt.hot())  #To plot data scatter before interpolation
fig1.colorbar(img)
plt.show()


X1,Y1,Z1 =np.meshgrid(X ,Y ,Z)   #To define sufrace for interpolation
int = gd((X,Y,Z), c, (X1,Y1,Z1), method='linear')
fig2 = plt.figure()  #trying to plot the answer
ax1 = fig2.add_subplot(1,1,1, projection='3d')
ax1.scatter(int)
img = ax1.scatter(X, Y, Z, c=c, cmap=plt.hot())
`

Its gives error: different number of values and points

I dont know how to indicate (X1,Y1,Z1) surface in griddata function

Thanks a lot for any tips ...

0

There are 0 answers