[Matplotlib-users] matplotlib.tri.LinearTriInterpolator and dask

James McManus jmpmcmanus at gmail.com
Thu Jun 9 13:59:28 EDT 2022


Hi - I'm using matplotlib.tri.LinearTriInterpolator to regrid data from an
unstructured 2d triangular grid, to a structured grid. It works great on
smaller datasets, but when I try to regrid a larger dataset I get the
following error:

---------------------------------------------------------------------------MemoryError
                              Traceback (most recent call last)
File <timed exec>:1, in <module>

File ~/.conda/envs/pangeo/lib/python3.8/site-packages/matplotlib/tri/triinterpolate.py:265,
in LinearTriInterpolator.__call__(self, x, y)    264 def
__call__(self, x, y):--> 265     return self._interpolate_multikeys(x,
y, tri_index=None,    266
return_keys=('z',))[0]

File ~/.conda/envs/pangeo/lib/python3.8/site-packages/matplotlib/tri/triinterpolate.py:163,
in TriInterpolator._interpolate_multikeys(self, x, y, tri_index,
return_keys)    160 if x.shape != y.shape:    161     raise
ValueError("x and y shall have same shapes."    162
  " Given: {0} and {1}".format(x.shape, y.shape))--> 163 x =
np.ravel(x)    164 y = np.ravel(y)    165 x_scaled = x/self._unit_x

File <__array_function__ internals>:180, in ravel(*args, **kwargs)

File ~/.conda/envs/pangeo/lib/python3.8/site-packages/numpy/core/fromnumeric.py:1859,
in ravel(a, order)   1857     return asarray(a).ravel(order=order)
1858 else:-> 1859     return asanyarray(a).ravel(order=order)
MemoryError: Unable to allocate 13.2 GiB for an array with shape
(1767600000,) and data type float64


Is there a version of matplotlib.tri that uses Dask, to enable
regridding of larger datasets?


Thanks

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/matplotlib-users/attachments/20220609/9853c18f/attachment.html>


More information about the Matplotlib-users mailing list