Skip to content

Change substring matching to use of constants in SpatialCoordsRemapper - #1673

Open
erogluorhan wants to merge 2 commits into
mainfrom
fix_spatial_coords_remap_py
Open

Change substring matching to use of constants in SpatialCoordsRemapper#1673
erogluorhan wants to merge 2 commits into
mainfrom
fix_spatial_coords_remap_py

Conversation

@erogluorhan

@erogluorhan erogluorhan commented Aug 12, 2026

Copy link
Copy Markdown
Member

Closes #1671

Overview

We already have global constants for geometric element dim names, but I realized we used lowercase substring matching in SpatialCoordsRemapper. This PR fixes that.

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

AI Disclosure

AI Usage: N/A

@erogluorhan erogluorhan added the bug Something isn't working label Aug 12, 2026

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Noting that this change breaks backwards compatibility for anyone who was using SpatialCoordsRemapper with nonstandard dimension names like "nMesh2_face". Can you clarify here, is this actually the intended behavior?

I noticed that _yac_remap seems to intentionally support dimension inputs like "face centers" (see LABEL_TO_COORD). On skimming, it looks like those names might all be converted to the standard dimension names like "n_face" before getting passed to _construct_remapped_ds (which uses SpatialCoordsRemapper), so it might be fine for this case. Just wanted to confirm the intention here is to drop support for nonstandard dimension names in this remapper.

Comment thread uxarray/remap/spatial_coords_remap.py Outdated
@erogluorhan

Copy link
Copy Markdown
Member Author

Noting that this change breaks backwards compatibility for anyone who was using SpatialCoordsRemapper with nonstandard dimension names like "nMesh2_face". Can you clarify here, is this actually the intended behavior?

I noticed that _yac_remap seems to intentionally support dimension inputs like "face centers" (see LABEL_TO_COORD). On skimming, it looks like those names might all be converted to the standard dimension names like "n_face" before getting passed to _construct_remapped_ds (which uses SpatialCoordsRemapper), so it might be fine for this case. Just wanted to confirm the intention here is to drop support for nonstandard dimension names in this remapper.

That's technically correct; however, in practice, it'd be fair to expect no one to have used this outside its implicit use under remap functions, which should already input either of "n_face", "n_node", or "n_edge" only. The call trace so far should have been:

either of (nearest_neighbor, bilinear, inverse_distance_weighted, yac) -> uxarray/remap/utils/_construct_remapped_ds() -> remap/spatial_coords_remap/construct_output_coords() -> remap/spatial_coords_remap/_get_element_type_from_dimension()

Does that make sense?

@erogluorhan
erogluorhan requested a review from Sevans711 August 13, 2026 15:32

@Sevans711 Sevans711 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With function docstring update, and clarifications in comments that this was almost certainly only being used inside internal methods, I think it looks good and is ready to merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use our canonical constants in SpatialCoordsRemapper instead of lowercase substring matching

2 participants