I have 3 arrays, for longitude, latitude and temperature (so the observations are scattered in space). I want to apply interpolation on these data, but also extrapolation. I 've written the code beow, but I get an error about memory. Each of the three arrays has about 700 points.
The reason that I want to extrapolate is because i want to cover all of the region of the map.
This is the part of my code, which is about what I described:
m = Basemap(projection='merc',llcrnrlat=34,urcrnrlat=42,\
llcrnrlon=19,urcrnrlon=35,lat_ts=20,resolution='h')
xi = np.arange(19,35,0.01)
yi = np.arange(34,42,0.01)
xi,yi = np.meshgrid(xi,yi)
lon = np.asarray(lon)
lat = np.asarray(lat)
temperature = np.asarray(temperature)
rbf = scipy.interpolate.Rbf(lon, lat, temperature, function='gaussian', smooth=0.)
zi = rbf(xi, yi)
x,y = m(xi, yi)
zi=np.array(zi)
mdata=maskoceans(xi,yi,zi,resolution='f',grid=1.25)
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary(fill_color="#cce6ff")
sc = m.contourf(x,y,mdata, np.arange(-15.0,40.01,1),cmap=jet,extend="both")
Does anyone have any ideas about the interpolation methods that I should use and how I could make it work?
I've already used griddata, which works fine, but it is just for interpolation, so the new matrix is limited and it doesn't cover the whole area. I've also read that rbf doesn't work for more than 20 points, but is there any other method for large datasets?
xi = np.arange(19,35,0.01)
and the next line to 0.05 or something. Extrapolating temperature data is a bad idea, btw, and I think using a smaller number to avoid the out of memory error might help you see that. $\endgroup$ – user967 Sep 1 '17 at 23:17