Add structured and curvilinear grid support for Zarr#22
Merged
Conversation
Zarr stores with structured grids (1D lat/lon of different sizes) and curvilinear grids (2D lat/lon arrays) now work the same as NetCDF files. Changes: - mesh.c: Rewrite read_zarr_coord to handle N-dimensional coordinate arrays with proper multi-dimensional chunk paths and row-by-row copying for 2D chunks. Rewrite mesh_create_from_zarr to detect and handle three coordinate types: 1D unstructured (same-size), 1D structured (different-size with meshgrid expansion), and 2D curvilinear. - file_zarr.c: Add zarr_read_spatial_slice helper that supports both single and dual spatial dimensions with multi-chunk iteration and stride-based indexing. Update zarr_scan_variables to detect structured grids by matching lat/lon dimension sizes against orig_nx/orig_ny. Use matches_name_list() for coordinate skip lists. - tests/test_file_zarr.c: Add 7 tests for structured grid support covering mesh creation, variable scanning, data reading, and multi-chunk spatial dimensions for both 1D structured and 2D curvilinear grids. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
closes #20 |
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.
Summary
read_zarr_coordrewritten to handle N-dimensional coordinate arrays with proper multi-dimensional chunk pathsmesh_create_from_zarrdetects three coordinate types: 1D unstructured, 1D structured (meshgrid expansion), and 2D curvilinearzarr_read_spatial_slicehelper supports both single and dual spatial dimensions with multi-chunk iterationzarr_scan_variablesupdated to detect structured grids by matching lat/lon dimension sizesCloses #20
Test plan
🤖 Generated with Claude Code