Skip to content

Improve DIM_NAMES and related docs - #1918

Merged
Sevans711 merged 7 commits into
mainfrom
sevans/ugrid-DIM_NAMES-update
Nov 24, 2026
Merged

Sevans711 merged 7 commits into
mainfrom
sevans/ugrid-DIM_NAMES-update

Conversation

@Sevans711

@Sevans711 Sevans711 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1766

Overview

This PR improves ugrid.DIM_NAMES and related docs, bringing them up to date with the rest of the codebase. I interpret the implied/intended scope of #1766 to be something broad; roughly: "handle anything which is clearly missing from ugrid.DIM_NAMES or anything which does not belong there, and also update the Connectivity table in the docs accordingly".

A few points in this PR go beyond that scope and are labeled accordingly, but the other points here all fall within that scope. In particular:

  • Removed unused dimension names (uxarray uses the name "two" instead):
    • Removed "n_max_edge_faces" from DIM_NAMES (that is the only place it appeared throughout the entire uxarray codebase, including the docs pages).
    • Removed "n_max_edge_nodes" from DIM_NAMES (that is the only place it appeared throughout the entire uxarray codebase, including the docs pages).
  • Added node_node details:
    • Added "n_max_node_nodes" to DIM_NAMES; it is one of the dimensions mentioned in the docstring of the public-facing Grid.node_node_connectivity.
      • Added a comment in ugrid.py with node_node_connectivity info, analogously to edge_edge_connectivity. UXarray does not yet support constructing either of these directly, but it does support model-supplied values in both cases.
    • Added a Node Node row to the Connectivity table in the docs, analogous to the Edge Edge row.
    • Removed the now-redundant special case for "n_max_node_nodes" in _drop_non_grid_data.
    • Expansion of scope: Added Grid.n_max_node_nodes property.

Additional expansions of scope:

  • Added "lat_lon" and "min_max" to DIM_NAMES.
    • Added comments to clarify/solidify the purpose/meaning of DIM_NAMES. This is ultimately a design decision, but I believe it makes more sense to include them here instead of special-casing them separately.
    • Added test_grid_repr_bounds_dims which ensures these dims exist in grid.dims and are visible in repr(grid) whenever they exist in the underlying grid object.
    • Removed the now-redundant special case for these dims in _drop_non_grid_data.

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR (add new tests if needed)
  • [N/A] If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • Docstrings updated with any function changes, and included in all new functions
  • User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)
  • [N/A] If touched any notebook files, cleared the output of all cells before committing
  • [N/A] If added new notebook files, put into appropriate directories and referenced in appropriate files

AI Disclosure

AI Usage: Claude Opus 5.5 to help with surveying and as a sanity check for some decisions, but not for implementing changes directly. Some GitHub Copilot inline code suggestions.

  • I have tested and take responsibility for all AI-generated content in my PR.

@Sevans711 Sevans711 added bug Something isn't working documentation Improvements or additions to documentation design Design of an API, feature, or user interface (not just implementation details) labels Nov 23, 2026
@Sevans711
Sevans711 requested a lite review from Copilot November 23, 2026 19:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still has an active moderate issue because node-node connectivity is not registered in the convention tables or covered by an I/O regression test, and its model-supplied accessor path also lacks coverage.

2 open issues
What changed in this PR

This PR updates UXarray’s recognized dimension names and related documentation to support node-node connectivity and consistently represent cached bounds dimensions.

Changes:

  • Removes obsolete edge connectivity dimensions and adds n_max_node_nodes, lat_lon, and min_max to DIM_NAMES.
  • Adds the Grid.n_max_node_nodes property and simplifies grid-data filtering.
  • Updates connectivity and API documentation and adds regression coverage for bounds dimensions in grid representations.
File Description
uxarray/​grid/​utils.py Uses the centralized DIM_NAMES collection when retaining grid variables and filtering non-grid data.
uxarray/​grid/​grid.py Uses canonical dimension names and adds the Grid.n_max_node_nodes property.
uxarray/​conventions/​ugrid.py Updates recognized dimension names and documents node-node connectivity dimensions.
test/​core/​test_repr.py Tests visibility of lat_lon and min_max in grid dimensions and representations.
docs/​user-guide/​representation.rst Adds node-node connectivity to the connectivity reference table.
docs/​api.rst Documents Grid.n_max_node_nodes in the API reference.

Review effort: Lite

Comment thread uxarray/conventions/ugrid.py Resolved
Comment thread uxarray/grid/grid.py Resolved

@dylannelson dylannelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming we are leaving all edge_edge_connectivity and node_node_connectivity for another PR, everything looks great. This covered a lot of confusing inconsistencies that were spread out across a few sources. Also really appreciate the updates to the grid cleaning function so that these changes don't break anything. Overall covers everything I could think of that we saw, and a few more things. Built locally and tested the grid cleaning on a handful of files and all turned out as expected. Thanks!

@erogluorhan erogluorhan left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the additions here seem like expansion from the #1766's scope, please document accordingly (either revise #1766 and description of this PR, or create/link to a new issue that describes that scope).

Also, regarding the addition of n_max_node_nodes, I think it should technically be equal to n_max_node_edges, but we decided in a team discussion to have explicitly defined dimensions for each separate connectivity, right?

@Sevans711

Copy link
Copy Markdown
Collaborator Author

@erogluorhan Thank you for your comments and for taking a look at this one. I believe I've addressed them all but please let me know if I missed anything!

All the additions here seem like expansion from the #1766's scope, please document accordingly (either revise #1766 and description of this PR, or create/link to a new issue that describes that scope).

When considering the issue title, content, and context in the linked comment/thread, I think a fair interpretation of the scope is something like: "handle anything which is clearly missing from ugrid.DIM_NAMES or anything which does not belong there, and also update the Connectivity table in the docs accordingly" I've updated the PR description to include this note, and added a comment in the original issue report to clarify there too (#1766 (comment))

I believe that most of the additions here fall within this clarified scope. However I do think the "Added Grid.n_max_node_nodes property" could still be considered an expansion of scope, so I update the PR overview to mark it accordingly. I believe that the scope is now clarified and all expansions of scope are clearly marked.

I don't think there's a need to create a new issue report for the expansions of scope at this point (to me they all still feel like "natural additions" / "on theme" for this PR). I'd be happy to open it though if you want, just let me know!

Also, regarding the addition of n_max_node_nodes, I think it should technically be equal to n_max_node_edges, but we decided in a team discussion to have explicitly defined dimensions for each separate connectivity, right?

I agree with your reading; I would always expect these two to be equal, but the discussion pointed towards having explicit dimensions for each separate connectivity. (Though, the same discussion contradicted using "two" as a connectivity dimension. But, "two" was actually already being used elsewhere in the codebase.) Additionally, "n_max_node_nodes" already appears in the docstring of Grid.node_node_connectivity.

@erogluorhan

Copy link
Copy Markdown
Member

@Sevans711 I think all is clarified about the PR; thank you!

@Sevans711
Sevans711 merged commit 2ea616d into main Nov 24, 2026
38 of 41 checks passed
@Sevans711
Sevans711 deleted the sevans/ugrid-DIM_NAMES-update branch November 24, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working design Design of an API, feature, or user interface (not just implementation details) documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit to connectivity dimensions in UXarray Docs and Conventions

4 participants