From 2b1a63211ae9252b8410ac07979ba9e8e84f1a91 Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Mon, 2 Feb 2026 16:45:02 -0700 Subject: [PATCH 1/3] Fix fallback case issues with nodes destination in _barycentric_weights() --- uxarray/remap/bilinear.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/uxarray/remap/bilinear.py b/uxarray/remap/bilinear.py index 34ec94a15..1ebfd0fb2 100644 --- a/uxarray/remap/bilinear.py +++ b/uxarray/remap/bilinear.py @@ -124,8 +124,16 @@ def _barycentric_weights(point_xyz, dual, data_size, source_grid): cur_inds, counts = source_grid.get_faces_containing_point(points=point_xyz[i]) if counts == 0: continue - all_weights[i, 0] = 1.0 - all_indices[i, 0] = int(cur_inds[0]) + # 2/2/2026: Below was the default assumption of the original implementation, but + # there were rare cases where counts > 0, hence the newer condition at the end + elif counts == 1: + all_weights[i, 0] = 1.0 + all_indices[i, 0] = int(cur_inds[0]) + # 2/2/2026: For some `remap_to="nodes"` cases, `counts` happen to be bigger than 1. Not sure + # if the best way to add weights from multiple faces is to take only the first face's though + else: + all_weights[i, 0] = 1.0 + all_indices[i, 0] = int(cur_inds[0][0]) # Prepare args for the Numba function valid_idxs = np.where(hits != 0)[0] From 861b448005cb9b95018ea0dd5dbae78fedb85e82 Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Mon, 2 Feb 2026 16:55:33 -0700 Subject: [PATCH 2/3] Add test case --- test/test_remap.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_remap.py b/test/test_remap.py index b626ade5d..186faae0d 100644 --- a/test/test_remap.py +++ b/test/test_remap.py @@ -236,6 +236,17 @@ def test_b_edge_centers_dim_change(gridpath): ) assert "n_edge" in da.dims +def test_b_nodes_many_faces_in_fallback(gridpath): + """Bilinear remap to edge centers produces an 'n_edge' dimension.""" + source_path = gridpath("mpas", "QU", "oQU480.231010.nc") + dest_path = gridpath("mpas", "QU", "480", "grid.nc") + uxds = ux.open_dataset(source_path, source_path) + dest = ux.open_grid(dest_path) + da = uxds["latCell"].remap.bilinear( + destination_grid=dest, + remap_to="nodes" + ) + assert "n_node" in da.dims def test_b_value_errors(gridpath, datasetpath): """Bilinear remapping raises a value error when the source data is not on the faces""" From bc6b18e811ec3bf432d20267bd1d095d29bea4c3 Mon Sep 17 00:00:00 2001 From: erogluorhan Date: Tue, 3 Feb 2026 13:04:45 -0700 Subject: [PATCH 3/3] Ignore healpix URL to fix linkcheck errors --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 5bf192c48..b51659491 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -236,6 +236,7 @@ def __getattr__(cls, name): r"https://gmao.gsfc.nasa.gov/gmaoftp/*", r"https://docs.xarray.dev/*", r"https://seatstandards.org/*", + r"https://healpix.sourceforge.io/*", # More URLs as needed ]