Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
18 stars 3 forks source link

2 tests fail, presumably after xugrid v0.5.0 update #397

Closed Manangka closed 10 months ago

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on May 26, 2023, 16:10

Presumably due to the latest xugrid update, 2 tests fail (example_job):

FAILED test_formats/test_disv_conversion.py::test_convert_to_disv[create_quadgrid] - ValueError: applied function returned data with unexpected number of dimensions. Received 1 dimension(s) but expected 2 dimensions with names: ('layer', 'mesh2d_nFaces')

FAILED test_formats/test_disv_conversion.py::test_convert_to_disv[create_trigrid] - ValueError: applied function returned data with unexpected number of dimensions. Received 1 dimension(s) but expected 2 dimensions with names: ('layer', 'mesh2d_nFaces')
``ValueError: applied function returned data with unexpected number of dimensions. Received 1 dimension(s) but expected 2 dimensions with names: ('layer', 'mesh2d_nFaces')``

Probably due to the xugrid update of yesterday, since xarray had its last update 18th of May (v2023.05.0), and for example this pipeline ran with this version without error

TODO list

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jun 2, 2023, 12:49

I have verified locally it happens after the xugrid v0.5.0 update

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jun 2, 2023, 16:42

I had trouble debugging this, I think because of numba or the lazy computation. So I need some help to allow me to debug these.

Thoughts

It might be because of this: https://github.com/Deltares/xugrid/pull/76/files#diff-1abd10142227adbfafcf2d350665c95b3518c3f1acc1d8c7258d002c7d920c57R148

Or because of this changed line: https://github.com/Deltares/xugrid/pull/76/files#diff-1abd10142227adbfafcf2d350665c95b3518c3f1acc1d8c7258d002c7d920c57L109

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jun 5, 2023, 12:44

marked the checklist item Investigate source of issue as completed

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jun 5, 2023, 12:48

I made a simple test in xugrid which reproduces the error, after discussion with Huite and Hendrik. It appears to be caused by constructing regridders from weights with a DataArray with dimensions ({face_dim}), then trying to regrid with (layer, {face_dim}).

See PR here: https://github.com/Deltares/xugrid/pull/89

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jun 27, 2023, 16:00

Unfortunately with the latest fixes in xugrid, I still get a cryptic datatype error in numba

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jul 3, 2023, 16:36

marked the checklist item Come up with fix as completed

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jul 3, 2023, 16:36

This PR fixes things! https://github.com/Deltares/xugrid/pull/108, only need to do a new xugrid release, after code review is done.

Manangka commented 1 year ago

In GitLab by @JoerivanEngelen on Jul 5, 2023, 16:46

I made a xugrid v0.6.0 release, which includes the fix. Once it is on conda-forge, the tests should start running automatically again. I'm closing this issue for now, reopen if xugrid v0.6.0 doesn't fix things in the CI.