Issues and fixes related to the handling of the regridding weights as a sparse.COO array and/or an xarray.DataArray backed by a sparse.COO array #190
Replies: 2 comments 3 replies
-
First of all, thanks a lot for the tremendous work you've done here! I've gone trough the notebooks Unfortunately I was not able to access the branches where the individual fixes live and I could only see your
repeat for large size problem. This test may or may not be able to run on github CI but we could still host it. Let me know if this sounds good to you. It's a bit more work but I'd really like for you to get full credit for this work. |
Beta Was this translation helpful? Give feedback.
-
@lemieuxbenedicte I am deeply sorry for this bug. It's my fault because I'm the one that coded I believe all your issues can be boiled down to #158 (and maybe #170, which might be related). In both your notebooks, you are using I have run your notebooks with sparse 0.13, xESMF 0.6.2 and 0.6.3, xarray 2022.6.0 and scipy 1.9.1 and did not get the errors you show. So désolé again that you spent so much time detailing and fixing the bug, but I think updating sparse will simply do it. |
Beta Was this translation helpful? Give feedback.
-
Quick description :
Issue 9 and FIX10 :
This problem is encountered with the xesmf package while
encapsulating the sparse sparse.COO matrix of the regridding weights
under an xarray.DataArray structure.
xarray fails interpreting the sparse.COO object hidden behind the
numpy.ndarray type. It reserves Memory for the full size array instead.
This can cause MemoryError failures and/or result in the use of an
unecessary large amount of Memory.
Issue 1 and 2 and FIX2 :
Issue 1 arises when the regridding involves a source grid with masked data.
Issue 2 is related to the writing of the
regridding weights to a netCDF file with the dedicated Class
BaseRegridder method.
Issue 1, 2 and 9 are all connected to the handling of the
regridding weights as a sparse.COO array and/or an xarray.DataArray
backed by a sparse.COO array.
We propose fixes and tests under the github in a forked repository. In the master branch you will find the sources with fixes as well as two jupyter-notebooks in the dedicated directory xESMF/xesmf/doc/notebooks with full details :
notebook with issue9 and FIX10
notebook with issue1 and 2 and FIX2
More Details :
The xesmf package was installed with conda using the conda-forge channel. The installed version of the conda binaries is xesmf-0.6.2 but we did the appropriate checks confirming that the latest conda binaries version xesmf-0.6.3 were not solving the issues documented hereafter. The underlying package versions are therefore the following:
Issues were experimented with real data but they are reproduced in the notebook with synthetic grids prepared with xesmf.util.grid_2d.
Tests were conducted on HPC facilities without applying any type of parallelization (frontend).
TODO
Urgent : test the fix FIX10 with dask.
Beta Was this translation helpful? Give feedback.
All reactions