Skip to content

Add remapping to rectilinear grids#1501

Open
rajeeja wants to merge 7 commits intomainfrom
rajeeja/yac_structured_mesh
Open

Add remapping to rectilinear grids#1501
rajeeja wants to merge 7 commits intomainfrom
rajeeja/yac_structured_mesh

Conversation

@rajeeja
Copy link
Copy Markdown
Contributor

@rajeeja rajeeja commented Apr 28, 2026

Closes #95.

Adds native UXarray support for remapping to rectilinear structured latitude-longitude grids through remap.to_rectilinear(...), and adds YAC support for the same workflow using YAC rectilinear grid registration. The method returns regular xarray output on lat/lon dimensions, with tests and API docs for both backends. Also addresses the structured-grid YAC workflow discussed in #768 (comment).

Native UXarray backend:

out = uxda.remap.to_rectilinear(
    lon=np.linspace(0.0, 359.0, 360),
    lat=np.linspace(-89.5, 89.5, 180),
    backend="uxarray",
)

YAC backend:

out = uxda.remap.to_rectilinear(
    lon=np.linspace(0.0, 359.0, 360),
    lat=np.linspace(-89.5, 89.5, 180),
    backend="yac",
    yac_method="nnn",
    yac_options={"n": 1},
)

@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

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 a new remap.to_rectilinear(...) convenience API to remap UXarray data onto 1-D rectilinear lon/lat targets, returning standard xarray output on lat/lon dimensions, with support for both the native UXarray backend and YAC (including YAC rectilinear grid registration).

Changes:

  • Added a rectilinear target normalization/reshape utility (RectilinearGridSpec, edge inference, and lat/lon reshaping).
  • Implemented YAC rectilinear target registration and a dedicated YAC remap-to-rectilinear path.
  • Exposed to_rectilinear() on the remap accessor, added tests, and documented the new API in user guide + generated API docs.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uxarray/remap/yac.py Adds rectilinear-target detection/registration and _yac_remap_to_rectilinear() returning xarray output.
uxarray/remap/structured.py Introduces rectilinear target spec normalization (centers→edges) and reshaping utilities + native backend helper.
uxarray/remap/accessor.py Adds public to_rectilinear() method to the remap accessor (backend switch between yac and uxarray).
test/test_remap_yac.py Adds YAC-backed to_rectilinear() tests for node data and extra dimensions.
test/test_remap.py Adds native backend to_rectilinear() test and direct reshape utility coverage.
docs/user-guide/remapping.ipynb Mentions the new .remap.to_rectilinear(...) workflow for YAC.
docs/generated/uxarray.UxDataset.remap.to_rectilinear.rst Adds generated API stub for UxDataset.remap.to_rectilinear.
docs/generated/uxarray.UxDataArray.remap.to_rectilinear.rst Adds generated API stub for UxDataArray.remap.to_rectilinear.
docs/api.rst Adds to_rectilinear to the API reference listings for both UxDataArray and UxDataset.

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

Comment thread uxarray/remap/accessor.py
Comment thread uxarray/remap/yac.py
Comment thread uxarray/remap/yac.py
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.

Add Regridding to lat-lon

2 participants