From jmpmcmanus at gmail.com Thu Jun 9 13:59:28 2022 From: jmpmcmanus at gmail.com (James McManus) Date: Thu, 9 Jun 2022 13:59:28 -0400 Subject: [Matplotlib-users] matplotlib.tri.LinearTriInterpolator and dask Message-ID: 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 :1, in 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: From ianthomas23 at gmail.com Sat Jun 11 12:58:03 2022 From: ianthomas23 at gmail.com (Ian Thomas) Date: Sat, 11 Jun 2022 17:58:03 +0100 Subject: [Matplotlib-users] matplotlib.tri.LinearTriInterpolator and dask In-Reply-To: References: Message-ID: Hi Jim, No, there are no Dask versions of any Matplotlib code as far as I am aware. The TriInterpolator and related classes in Matplotlib are only intended to be helpers for visualisation purposes, for any serious manipulation of unstructured grids you should probably use some appropriate domain-specific code. I don't do much tri grid work now so I am not familiar with what is available now. When the tri grid code was first written we would have preferred to use a robust well-maintained library for such functionality but we couldn't find one. There were quite a few people talking about how good it would be for one to exist, but nobody was really prepared to make it so. Maybe the situation has improved since then? A couple of possibilities spring to mind: 1) scipy have similar functionality that may not require as much RAM, see https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html 2) The Pangeo discourse might be a good place to ask this question ( https://discourse.pangeo.io/) as there are a number of atmospheric and oceanic scientists there who use triangular grids. Ian On Thu, 9 Jun 2022 at 18:59, James McManus wrote: > 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 :1, in > > 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 > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Sat Jun 25 07:33:10 2022 From: ndbecker2 at gmail.com (Neal Becker) Date: Sat, 25 Jun 2022 07:33:10 -0400 Subject: [Matplotlib-users] qt backends, save dialog broken Message-ID: Fedora 26, mpl 3.5.2 I'm using mpl on a remote machine, via x2go. Starting sometime recently, I'm unable to save files via the gui. Click on the save button should open a file chooser, but now does nothing. This appears to happen with various qt backends. Choosing Tkagg works. I can't test gtk. For example choosing GTK3Cairo gives: ModuleNotFoundError: No module named 'matplotlib.backends.backend_gtk3cairo' Any ideas? -- *Those who don't understand recursion are doomed to repeat it* -------------- next part -------------- An HTML attachment was scrubbed... URL: