Skip to content

Add transform_precision parameter to merge()#1456

Merged
brendancol merged 3 commits intomainfrom
merge-transform-precision-param
May 4, 2026
Merged

Add transform_precision parameter to merge()#1456
brendancol merged 3 commits intomainfrom
merge-transform-precision-param

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • Adds transform_precision=16 to merge() and plumbs it through _merge_inmemory and _merge_dask (previously hardcoded to 16). Set to 0 for exact per-pixel transforms matching GDAL/rasterio.
  • Passes the value through _validate_grid_params so the existing validation runs.
  • Updates the merge() docstring with the parameter description and adds a Notes line saying the dask path should be used for very large outputs.
  • max_memory is not added; merge() has no streaming path that would consume it.

Closes #1452

Test plan

  • pytest xrspatial/tests/test_reproject.py -x (153 passed, including 5 new tests under TestValidateMergeGridParams)
  • merge([raster], transform_precision=0) runs and produces a result
  • Default transform_precision=16 (no kwarg) still works
  • Negative and float values raise ValueError matching transform_precision
  • transform_precision=0 and transform_precision=16 produce numerically identical merged output (rtol=1e-10) on smooth EPSG:4326 inputs

reproject() exposes transform_precision but merge() did not, so users
had no way to pick the control-grid subdivision count or request exact
per-pixel transforms when merging. The parameter is now plumbed through
_merge_inmemory and _merge_dask instead of being hardcoded to 16.

max_memory was intentionally not added because merge() has no streaming
path; the docstring notes the dask path for very large outputs.

Closes #1452
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 4, 2026
@brendancol
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…n _merge_inmemory

Co-authored-by: brendancol <433221+brendancol@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in a0cc6ed. The only conflict was in _merge_inmemory — combined the per-raster r_nd nodata sentinel from main with the transform_precision parameter from this branch: resampling, r_nd, transform_precision. All 157 tests pass.

@brendancol
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…ision Notes

Co-authored-by: brendancol <433221+brendancol@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 3b37a14. The conflict was in the merge() docstring's Returns section — combined main's additions (y-coordinate order description and non-spatial coords note) with our branch's Notes section. 170 tests pass.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.proj.org
    • Triggering command: /usr/bin/python3 python3 -m pytest xrspatial/tests/test_reproject.py -x -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@brendancol brendancol merged commit 8b792ff into main May 4, 2026
1 check passed
@brendancol brendancol deleted the merge-transform-precision-param branch May 5, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

merge() lacks transform_precision parameter exposed by reproject()

2 participants