Repository navigation
Conversation
ux.map_blocks (also UxDataArray.map_blocks / UxDataset.map_blocks) wraps xarray.map_blocks so each block reaches func with a grid attached and the result comes back with the original grid: - grid dims unsplit (e.g. chunked along time): every block gets obj.uxgrid - n_face split: each block gets uxgrid.isel(n_face=...) for its faces, located via face positions passed as a hidden map_blocks argument; node and edge data in args is gathered onto the block's sub-grid - n_node or n_edge split: blocks keep the whole grid; grid variables passed in args are rechunked to match and arrive sliced to the block - splitting more than one grid dim, or mixing grid dims, raises DimensionError The docstring notes that grid-dim splits are only correct for element-local functions (and, with n_face split, faces computed from their own nodes and edges), not for neighbour-based ones like gradient. Grid.chunks reports the grid's chunk sizes. Grid.chunk gains inplace: inplace=False returns a new chunked Grid; leaving it unset keeps the in-place behaviour with a FutureWarning about the coming default. Face-area computation now handles zero-face grids (dtype probe instead of arr[0], np.min with initial), which xarray's template inference needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1846
Overview
This PR adds
map_blocksmethods forUxDatasetandUxDataArray.Expected Usage
PR Checklist
General
Testing & Benchmarking
Documentation and Examples
docs/api.rst; internal (private) function names start with an underscore (_)AI Disclosure
AI Usage: Claude Opus 5.5