Skip to content

Upgrade YAC to v3.21.0 and YAXT to v0.12.2.2, expose more YAC methods - #1907

Merged
cmdupuis3 merged 11 commits into
mainfrom
rajeeja/yac-3-21
Nov 25, 2026
Merged

cmdupuis3 merged 11 commits into
mainfrom
rajeeja/yac-3-21

Conversation

@rajeeja

@rajeeja rajeeja commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1906

Overview

  • ⬆️ Upgrade: optional YAC CI now builds YAC v3.21.0 (2026-08-25) and YAXT v0.12.2.2 (2026-11-11), up from v3.20.2 (2026-08-12) and v0.11.5.1 (2025-11-28).
  • 🐛 Bilinear fix: found during the upgrade. bilinear(backend="yac") now defaults to reduction_type="AVG_BARY" (barycentric) instead of YAC's arithmetic average, and matches the native backend. A user yac_options value still overrides it.
  • ✨ New yac_method values:
    • "ncc" (nearest corner cells): weight_type ("YAC_INTERP_NCC_AVG" default | "YAC_INTERP_NCC_DIST", also accepted as reduction_type), partial_coverage (bool, default False).
    • "rbf" (radial basis function): n (default 9 source points), max_search_distance (default 0.0, unlimited), scale (default 14.87973).
    • "bernstein_bezier": no options.
  • ➕ creep_distance (new yac_options key): adds a creep fill after the chosen method, so targets it left empty (for example DNN with a small search distance) are filled from filled neighbors. It is the maximum number of neighbor steps, -1 means unlimited, and it is not applied to "conservative".
  • 🚫 Not exposed: n_min (new in v3.21.0, but yac.core does not take it yet), spmap, user_file, check.
  • 🛡️ Clear errors: dnn to nodes or edges without a FIXED search distance, and ncc from a non-face source, now raise ValueError. YAC aborts the whole process on both.
  • 📚 Docs: accessor docstrings, and the method list and table in docs/user-guide/remapping.ipynb.

Expected Usage

import uxarray as ux

uxds = ux.open_dataset(grid_path, data_path)

# bilinear now uses barycentric weights with the YAC backend
out = uxds["var"].remap.bilinear(destination_grid=dest, backend="yac")

# new methods
out = uxds["var"].remap.nearest_neighbor(
    destination_grid=dest, backend="yac", yac_method="rbf", yac_options={"n": 9}
)

# fill targets the chosen method left empty
out = uxds["var"].remap.nearest_neighbor(
    destination_grid=dest,
    backend="yac",
    yac_method="dnn",
    yac_options={
        "search_distance_type": "FIXED",
        "search_distance": 0.02,
        "creep_distance": -1,
    },
)

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

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR (add new tests if needed)
  • [N/A] If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • Docstrings updated with any function changes, and included in all new functions
  • [N/A] User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)
  • If touched any notebook files, cleared the output of all cells before committing
  • [N/A] If added new notebook files, put into appropriate directories and referenced in appropriate files

AI Disclosure

AI Usage: AI assisted with code and testing. I reproduced the results locally and reviewed the changes.

  • I have tested and take responsibility for all AI-generated content in my PR.

Both versions build and pass test/test_remap_yac.py locally with no source changes.
bilinear(backend='yac') used YAC's default arithmetic average, which is not bilinear. It now uses barycentric weights and matches the native result.
Adds the methods to yac_method, an optional creep_distance fill, tests, and docs.
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@rajeeja
rajeeja marked this pull request as ready for review November 23, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The injected default reduction_type overrides an explicit yac_options weight_type, silently using barycentric weights instead of the caller’s requested weighting.

1 open issue
What changed in this PR

Updates UXarray’s optional YAC remapping backend and expands its interpolation options, addressing issue #1906.

Changes:

  • Upgrades CI to YAC v3.21.0 and YAXT v0.12.2.2, with clone retries.
  • Adds ncc, rbf, bernstein_bezier, creep filling, and validation for unsupported grid locations.
  • Defaults YAC bilinear remapping to barycentric weights and adds tests and documentation.
File Description
uxarray/​remap/​yac.py Adds interpolation methods, creep filling, and input validation.
uxarray/​remap/​accessor.py Sets barycentric bilinear defaults and documents expanded options.
test/​test_remap_yac.py Tests new methods, creep filling, validation, and bilinear agreement.
docs/​user-guide/​remapping.ipynb Updates supported methods and backend guidance.
.github/​workflows/​yac-optional.yml Upgrades dependency pins and retries source clones.

Review effort: Balanced

Comment thread uxarray/remap/accessor.py Resolved

@erogluorhan erogluorhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me as it only touches the YAC pieces. Thanks!

@cmdupuis3 cmdupuis3 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.

AC calls MPI_ABORT for these two cases, so a script or Jupyter kernel dies with no Python exception.

Case YAC error Fix
bernstein_bezier on edge-centered data (yac.py:303) only supports CORNER or CELL sources raise if the source is edge-centered
creep_distance with remap_to="edges" (yac.py:322) target must be CELL or CORNER raise if the target is edge-centered

A dataset that mixes face and edge variables also triggers the first case.

Comment thread test/test_remap_yac.py Resolved
Comment thread test/test_remap_yac.py Resolved
@rajeeja
rajeeja requested a review from cmdupuis3 November 25, 2026 23:37
@cmdupuis3
cmdupuis3 merged commit b7a43bb into main Nov 25, 2026
20 checks passed
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.

Upgrade the optional YAC backend to YAC v3.21.0 and YAXT v0.12.2.2

4 participants