Skip to content

Commit

Permalink
take ICON edge node connectivity from grid file (#927)
Browse files Browse the repository at this point in the history
* take edge node connectivity from icon grid file

Saves a lot of time when reading a big grid, as n_edge is used in _map_dims_to_ugrid, and will call _populate_edge_node_connectivity(self) if "edge_node_connectivity" is not defined.

* update documentation.

---------

Co-authored-by: Philip Chmielowiec <[email protected]>
  • Loading branch information
florianziemen and philipc2 authored Sep 6, 2024
1 parent e50c879 commit ff9ec76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/user-guide/grid-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Connectivity
<td class="no-cell">No</td>
<td class="no-cell">No</td>
<td class="no-cell">No</td>
<td class="no-cell">No</td>
<td class="yes-cell">Yes</td>
</tr>
<tr>
<td>edge_edge</td>
Expand Down
7 changes: 7 additions & 0 deletions uxarray/io/_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def _primal_to_ugrid(in_ds, out_ds):
attrs=ugrid.EDGE_FACE_CONNECTIVITY_ATTRS,
)

edge_node_connectivity = in_ds["edge_vertices"].T - 1
out_ds["edge_node_connectivity"] = xr.DataArray(
data=edge_node_connectivity,
dims=ugrid.EDGE_NODE_CONNECTIVITY_DIMS,
attrs=ugrid.EDGE_NODE_CONNECTIVITY_ATTRS,
)

return out_ds, source_dims_dict


Expand Down

0 comments on commit ff9ec76

Please sign in to comment.