Skip to content

Check data location, not size==n_face, in UxDataArray.to_geodataframe() and .integrate() - #1628

Draft
Sevans711 wants to merge 1 commit into
mainfrom
fix-check-size==n_face
Draft

Check data location, not size==n_face, in UxDataArray.to_geodataframe() and .integrate()#1628
Sevans711 wants to merge 1 commit into
mainfrom
fix-check-size==n_face

Conversation

@Sevans711

Copy link
Copy Markdown
Collaborator

Closes #1616

Overview

Switches to using self._face_centered() instead of self.values.size == self.uxgrid.n_face, inside UxDataArray.to_geodataframe() and UxDataArray.integrate(). The comparison to self.uxgrid.n_face is 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_edge and ... == self.uxgrid.n_node checks, 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.

PR Checklist

General

  • An issue is linked created and linked
  • Add appropriate labels
  • Filled out Overview and Expected Usage (if applicable) sections

Testing

  • Adequate tests are created if there is new functionality
  • Tests cover all possible logical paths in your function
  • Tests are not too basic (such as simply calling a function and nothing else)

Addresses #1616
TODO: regression tests
@Sevans711 Sevans711 added the bug Something isn't working label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_geodataframe() and integrate() check size==n_faces, not data_location

1 participant