[SciPy-User] Memory error with scipy.interpolate
ashwinD12 .
winash12 at gmail.com
Wed Jul 20 02:43:16 EDT 2016
Hello,
I get a memory error when I interpolate a data set of 567 points
as shown in this stack trace
Traceback (most recent call last):
File "contour.py", line 34, in <module>
rbf = scipy.interpolate.Rbf(x, y, data, function='linear')
File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/rbf.py",
line 200, in __init__
r = self._call_norm(self.xi, self.xi)
File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/rbf.py",
line 231, in _call_norm
return self.norm(x1, x2)
File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/rbf.py",
line 118, in _euclidean_norm
return np.sqrt(((x1 - x2)**2).sum(axis=0))
MemoryError
With numpy earlier I had gotten the same error and I had moved past it
by this option -
lon,lat = np.meshgrid(lon, lat,sparse=True,copy=False)
This is the minimum code snippet that should reproduce the problem
grbs = pygrib.open('20000')
grb = grbs.select(name='Geopotential',level=500)[0]
data = grb.values
hgt = [x/10 for x in data]
lat,lon = grb.latlons()
lon,lat = np.meshgrid(lon, lat,sparse=True,copy=False)
m=Basemap(projection='mill',lat_ts=10,llcrnrlon=lon.min(), \
urcrnrlon=lon.max(),llcrnrlat=lat.min(),urcrnrlat=lat.max(), \
resolution=None)
x,y = m(lon,lat)
rbf = scipy.interpolate.Rbf(x, y, data, function='linear')
zi = rbf(x, y)
Regards,
Ashwin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20160720/c998f84b/attachment.html>
More information about the SciPy-User
mailing list