I'm tryin to bilerp a cell into one value using python for a NetCDF data set. I'm new to python and I can't understand what I'm doing wrong here. I have a 2d array and I give the four points by iterating through the dataset dataArr. I use Lerp method for the calculation. Somehow when I pass the 3 values it seems to consider it as more than 3. What am I doing wrong here? Thanks in adv.
This is the error I get>> self.Lerp((dataArr[i][j]),(dataArr[i+1][j]),fraction) takes exactly 3 arguments (4 given)
def compute(self,varval):
vars=self.data.variables
for var in vars:
if var==varval:
ntimes, ny, nx=vars[var].shape #inherit the method above.
print(ntimes, ny, nx)
#create the old computational grid.
computational_grid=np.zeros((ny,nx),dtype=int)
fraction=.5
newnx,newny =(nx*fraction,ny*fraction)
new_computational_grid=np.zeros((newny,newnx),dtype=int)
phy_value_arr=self.get_data(varval)
t=10 #send this t value with coords
dataArr=self.data.variables['tos'][t]
for i in range(0,(ny-1),1):
for j in range(0,(nx-1),1):
a=self.Lerp((dataArr[i][j]),(dataArr[i+1][j]),fraction)
b=self.Lerp((dataArr[i][j]),(dataArr[i+1][j]),fraction)
self.tempY.append(self.Lerp(a,b,fraction))
tempY.reshape(newnx,newny)
pcolormesh(self.tempY)
colorbar()
def Lerp( _a, _b, _t) :
return _a+(_b-_a)*_t