Repository navigation
Fix ascending-y grids: affine from coords, and rasterize/mask/coverage engines - #97
Merged
Merged
Conversation
get_affine took the Y origin from y[-1] when dy > 0 but kept scale dy, so materialized coords walked up from y.max(). Use y[0] - dy/2 for either sign. test_assign_index_from_coords asserted the buggy value. Supersedes #91 Co-Authored-By: Michael Sumner <mdsumner@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rusterize and exactextract assume a north-up grid and gave flipped results when affine.e > 0. For such grids, run on the y-flipped object and flip the result back. 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.
Supersedes #91 (thanks @mdsumner for the report and the fix).
get_affinebuilt a wrong affine from ascending-y coordinate arrays: the origin came fromy[-1]but the scale stayed+dy. Nowy[0] - dy/2for either sign.test_assign_index_from_coordsasserted the buggy value; fixed, plus a round-trip test.e > 0affine, rusterize and exactextract (which assume north-up) gave y-flipped results. Before (1) they gave empty results. Fore > 0,rasterize,geometry_maskandcoveragenow run on the y-flipped object and flip the result back. rasterio was already correct.New tests: ascending-y for each engine, eager and chunked.
#92 is an xarray bug (
CoordinateTransformIndexingAdapter._oindex_getkeeps integer-indexed axes); fixed upstream in pydata/xarray#11679.🤖 Generated with Claude Code