Check data location, not size==n_face, in UxDataArray.to_geodataframe() and .integrate() - #1628
Open
Sevans711 wants to merge 3 commits into
Open
Check data location, not size==n_face, in UxDataArray.to_geodataframe() and .integrate()#1628Sevans711 wants to merge 3 commits into
size==n_face, in UxDataArray.to_geodataframe() and .integrate()#1628Sevans711 wants to merge 3 commits into
Conversation
Addresses #1616 TODO: regression tests
for UxDataArray.to_geodataframe() and UxDataArray.integrate().
Sevans711
marked this pull request as ready for review
July 30, 2026 19:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1616
Overview
Switches to using
self._face_centered()instead ofself.values.size == self.uxgrid.n_face, insideUxDataArray.to_geodataframe()andUxDataArray.integrate(). The comparison toself.uxgrid.n_faceis brittle; it might get messed up by any grids which happen to have the same number of nodes as faces, or same number of edges as faces.Entirely removes the
... == self.uxgrid.n_edgeand... == self.uxgrid.n_nodechecks, and rewrites corresponding error messages. Those checks were just being used to provide a different error message based on size-based guess of data location; ultimately the errors were all ValueErrors with different ways to say "data that is not face_centered is not yet supported".Adds a comment inside the integrate() method suggesting that it should support integration of face_centered data regardless of the n_face dimension position. In the meantime, the method continues to only support integration where the n_face dimension is the last dimension. (Possibly related: #1461.)
Still draft PR because still need to add regression tests, as discussed in issue 1616.EDIT: now ready for review. Added tests for UxDataArray.to_geodataframe() and UxDataArray.integrate() for a node-centered array on a grid with n_face==n_node==6 (with same structure as the grid mentioned here: #1616 (comment)). These tests confirm a ValueError must be raised in this case, because these methods are not yet supported. Currently on
main, these tests silently incorrectly assume face-centered data and provide answers instead of crashing. A crash should be expected here, to prevent silently incorrect results. (Sidenote: should probably be NotImplementedError instead, but changing error types should not be part of this PR; see #1622 instead for further discussion about error types.)PR Checklist
General
Testing