From ff9ec76e5ce3422a8af7005e843fcec0a75155d5 Mon Sep 17 00:00:00 2001 From: Florian Ziemen Date: Fri, 6 Sep 2024 20:38:38 +0200 Subject: [PATCH] take ICON edge node connectivity from grid file (#927) * 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 <67855069+philipc2@users.noreply.github.com> --- docs/user-guide/grid-formats.rst | 2 +- uxarray/io/_icon.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/grid-formats.rst b/docs/user-guide/grid-formats.rst index 234b6dae1..b4d729a2c 100644 --- a/docs/user-guide/grid-formats.rst +++ b/docs/user-guide/grid-formats.rst @@ -328,7 +328,7 @@ Connectivity No No No - No + Yes edge_edge diff --git a/uxarray/io/_icon.py b/uxarray/io/_icon.py index aaba56995..01ed891f2 100644 --- a/uxarray/io/_icon.py +++ b/uxarray/io/_icon.py @@ -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