Skip to content

Add optional YAC remapping backend with NNN/conservative support and CI coverage#1440

Open
rajeeja wants to merge 21 commits intomainfrom
rajeeja/yac
Open

Add optional YAC remapping backend with NNN/conservative support and CI coverage#1440
rajeeja wants to merge 21 commits intomainfrom
rajeeja/yac

Conversation

@rajeeja
Copy link
Copy Markdown
Contributor

@rajeeja rajeeja commented Jan 10, 2026

Closes #1441, Close #897

  • Added a YAC-backed remapping backend so UXarray can use YAC’s interpolation machinery when requested, while remaining entirely unchanged for existing UXarray workflows. The UXarray remap API now accepts backend="yac" plus yac_method and yac_options. If YAC isn’t available, throw error.
  • Implemented YAC NNN (nearest‑neighbor) remap using YAC’s InterpolationStack.add_nnn, mapping UXarray grid locations (nodes/edges/faces) to YAC cloud grids (point-based) and remapping via YAC’s coupling API.
  • Implemented YAC conservative remap for face‑centered data only, using YAC unstructured grids with face‑node connectivity. This preserves the correct conservative semantics for cell‑centered fields.
  • Built a YAC-to-UXarray conversion path that:
    • Converts node coordinates to radians for YAC,
    • Constructs YAC UnstructuredGrid from UXarray face_node_connectivity,
    • Uses YAC points at the appropriate locations (CELL for conservative, CORNER for cloud).
  • Added a backend parity test to compare UXarray NN and YAC NNN on a tiny deterministic 3‑node grid. This avoids tie‑breaking ambiguity and provides a direct sanity check that YAC’s nearest‑neighbor agrees with UXarray’s own implementation.

@rajeeja rajeeja self-assigned this Jan 10, 2026
Copy link
Copy Markdown
Contributor

@hongyuchen1030 hongyuchen1030 left a comment

Choose a reason for hiding this comment

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

Looks good! Just add one comment about bit more comment description. Thanks

@k202077
Copy link
Copy Markdown

k202077 commented Feb 3, 2026

In your application the setup of YAC should get much easier (e.g. no setting of calendar or start/end time required) by using the (unfortunately basically undocumented) Python bindings for the yac_core library.

Here is some basic documentation:
https://dkrz-sw.gitlab-pages.dkrz.de/yac/d8/d22/core_8pyx.html

This is an example using this interface:
https://dkrz-sw.gitlab-pages.dkrz.de/yac/d8/d58/test__core_8py_source.html

You can configure YAC to only build the yac_core library (which does not depend on libfyaml). In addition libnetcdf is also optional.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an optional YAC-backed remapping backend to UXarray so users can route remap operations through YAC’s interpolation machinery when requested, while keeping existing UXarray behavior as the default.

Changes:

  • Introduces a new YAC backend implementation for NNN (nearest-neighbor) and conservative remapping.
  • Extends the .remap accessor API to accept backend="yac" plus yac_method/yac_options.
  • Adds YAC-only tests and a dedicated GitHub Actions workflow to build YAC/YAXT from source and run those tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
uxarray/remap/yac.py New YAC backend implementation and import/loading logic.
uxarray/remap/accessor.py Adds backend/method/options parameters and routes to YAC backend when requested.
test/test_remap_yac.py Adds YAC integration/parity tests (skipped when YAC unavailable).
.github/workflows/yac-optional.yml New optional CI job that builds YAXT+YAC and runs YAC-specific tests.
.github/workflows/ci.yml Sets MPLBACKEND=Agg in CI environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…Error for unknown values

Agent-Logs-Url: https://github.com/UXARRAY/uxarray/sessions/228d9dce-524e-47fd-aadd-749b46604550

Co-authored-by: rljacob <947068+rljacob@users.noreply.github.com>
Raise NotImplementedError/ValueError for backend='yac' here until a real YAC-IDW implementation exists.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
rljacob and others added 3 commits March 28, 2026 20:07
Pass the original remap_to label into _construct_remapped_ds instead of destination_dim.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

YAC as optional dependency Area Weighted Conservative Remapping

6 participants