Skip to content

Conversation

@philipc2
Copy link
Member

@philipc2 philipc2 commented Jun 26, 2025

Closes #1309

@philipc2 philipc2 self-assigned this Jun 26, 2025
@rajeeja
Copy link
Contributor

rajeeja commented Jun 26, 2025

we only want this to get populated when needed. This will be an expensive operation for large grids

@philipc2
Copy link
Member Author

philipc2 commented Jun 26, 2025

we only want this to get populated when needed. This will be an expensive operation for large grids

Agreed. That is handled by our decorated accessors.

uxarray/uxarray/grid/grid.py

Lines 1286 to 1292 in c18617b

@property
def node_edge_connectivity(self) -> xr.DataArray:
"""Indices of the edges that surround each node."""
if "node_edge_connectivity" not in self._ds:
_populate_node_edge_connectivity(self)
return self._ds["node_edge_connectivity"]

@philipc2
Copy link
Member Author

philipc2 commented Jun 27, 2025

Connectivity output looks good

image

Below is the construct Node Edge Connectivity

[[                   0                    1                    2]
 [                   0                    3                    4]
 [                   3                    5 -9223372036854775808]
 [                   5                    6 -9223372036854775808]
 [                   6                    7                    8]
 [                   1                    7                    9]
 [                  10                   11 -9223372036854775808]
 [                  10                   12 -9223372036854775808]
 [                  13                   14 -9223372036854775808]
 [                  13                   15 -9223372036854775808]
 [                  16                   17 -9223372036854775808]
 [                  16                   18 -9223372036854775808]
 [                   2                   11                   14]
 [                   4                   15 -9223372036854775808]
 [                   8                   18 -9223372036854775808]
 [                   9                   12                   17]]

@philipc2
Copy link
Member Author

For a 15km grid, it takes about 100ms on my machine to compute the connectivity.

@philipc2
Copy link
Member Author

@egallmeier

I still need to clean up this PR, however you should be able to use it to generate the connectivity for the grids that you would like to test.

@philipc2 philipc2 requested a review from egallmeier June 30, 2025 22:28
@philipc2 philipc2 marked this pull request as ready for review June 30, 2025 22:28
@philipc2 philipc2 changed the title DRAFT: Construct node_edge_connectivity Construct node_edge_connectivity Jul 1, 2025
@philipc2 philipc2 requested a review from rajeeja July 7, 2025 17:19
Copy link
Collaborator

@egallmeier egallmeier left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@rajeeja rajeeja left a comment

Choose a reason for hiding this comment

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

Looks good - this will lead way to other changes.

@rajeeja rajeeja merged commit a85d046 into main Jul 8, 2025
20 checks passed
@erogluorhan erogluorhan deleted the construct-node-edge-conn branch September 26, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Construct node_edge_connectivity

4 participants