Repository navigation
fix(raster): preserve complex samples through writes and translation - #841
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI reviewed the full diff against Bugs
Security
Performance
Quality
CLAUDE.md (AGENTS.md)
Change sizeCompared with the base branch (merge base 4cf5683 to PR head ecc3bc2).
|
Preserve the specific unsupported integer-complex dtype error and exercise direct writer validation.
Code reviewBugs
Security
Performance
Quality
CLAUDE.md (AGENTS.md)
Checked and found correct
Change sizeCompared with the base branch (merge base 4cf5683 to PR head daea750), not the latest push.
|
Keep logical-band metadata on individual complex components, account for complex128 copy buffers, and update the obsolete complex-array refusal test.
Code reviewI read the full diff and the surrounding code for the risky spots. I found no definite bugs. I could not compile or run the tests here (no Bash), so the PR's reported test results are unverified by me. Bugs: None found. Checked and consistent:
Security: None found. The changes are numeric conversion and dtype-name handling, with no external input reaching a dangerous sink. Performance:
Quality:
CLAUDE.md (AGENTS.md):
I posted three inline comments: Change sizeCompared with the base branch (main, merge base 4cf5683, PR head c935371), which covers the whole PR.
|
Document the native complex_int32 storage selector and reuse the shared complex-integer name check in writer validation.
Code reviewRead-only review of PR #841 ( Bugs
Security
Performance
Quality
CLAUDE.md (AGENTS.md)
Change sizeCompared with
|
Code reviewBugs
Security
Performance
Quality
CLAUDE.md / AGENTS.md
I checked the Python API surface against the stub: Change sizeCompared with
Sizes are file sizes from |
Preserve physical complex sample types and exact Int32 components in readable writer updates and copies. Account for complex128 storage in slab sizing and document whole-array allocation and metadata scope.
Preserve complex-write and WebP conformance documentation, suites and Node regressions.
Code reviewI read the full diff, the surrounding Rust ( Bugs
Security
Performance
Quality
CLAUDE.md (AGENTS.md)
Change sizeCompared with the base branch (merge base 5a48730 to PR head f9dc62d), using whole-PR file sizes.
|
|
@coderabbitai full review |
Action not completed
|
Code reviewI reviewed the diff against the surrounding source. I could not build or run the tests (no shell here), so the findings below come from reading the code, not from execution. Bugs
Security
Performance
Quality
CLAUDE.md / AGENTS.md
Nothing was approved, merged, or modified. Change sizeCompared: the whole PR against main (merge base 433ed60 to PR head 6be7ce7).
|
- Keep CInt16 writer buffers in complex128 so integer components round once. - Account for the wider storage in spill selection and slab budgets, with GDAL regressions. - Document row-writer component conversion and NumPy allocation admission boundaries.
|
@coderabbitai review Final allocation update 6be7ce7 has been reviewed: output working-set accounting includes conversion buffers and dtype/endian casts; same-dtype astype uses copy=False. No new correctness blocker found in the incremental review. Please review the updated head. |
Action not completed
|
Code reviewBugs
Performance
Security
Quality (nits, not posted inline)
CLAUDE.md / AGENTS.md
Checked: Rust I did not run the test suite or build; these findings come from reading the staged diff and the surrounding source. Change sizeCompared with the base branch: the whole PR against main (merge base 433ed60 to PR head 3b52805).
|
|
@coderabbitai review Final head 2ec26a2 fixes both verified CInt16 readable-copy precision and chunk-budget findings, extends the existing GDAL regression to copy an open writer, and adds the missing nested test-double docstrings. Full-repository pre-commit passes. Please review the updated head. |
Action not completed
|
Code reviewBugs
Security
Performance
Quality
CLAUDE.md / AGENTS.md
Checked and not flagged: the Rust integer rounding ( Change sizeCompared: the whole PR against main (merge base 433ed60 to PR head 2ec26a2).
|
|
@coderabbitai full review Final head 2ec26a2 is CI-green and all known findings are addressed. Prior incremental requests were rate-limited. Please review the current complete diff; keep the normal approval checks. |
Action not completed
|
Code reviewChecked the full diff against the surrounding source. The core paths hold up: the streamed GTiff/COG chunk accounting for planar complex is consistent, Bugs
Security
Performance
Quality
CLAUDE.md (AGENTS.md)
Change sizeCompared with the base branch (merge base 433ed60 to PR head de3a59d), covering the whole PR.
|
Code reviewBugs: I found no confirmed functional bug. I traced the main paths: complex write, copy, update, translate, and the read gating for precise CInt32 output. The Security: none found. Subprocesses use fixed argument lists, and the conformance additions contain no injection surface. Performance: nothing material. The precise CInt32 path doubles buffer size (16 B per sample) by design, and the PR describes this. The memory admission in Quality:
CLAUDE.md / AGENTS.md:
Test coverage:
Change sizeCompared: the whole PR against main (merge base 433ed60 to PR head 2f07cdf).
Largest changes by file size:
|
Terrio writes complex NumPy rasters and preserves complex TIFF sample types through streamed GTiff/COG writes, updates, copies, CLI conversion and translation. Integer-complex copies preserve Int32 real and imaginary components exactly, including values above 2²⁴. Both native Raster and read-only rio APIs provide precise complex128 output, including big-endian dtypes and explicit output arrays.
Fixes #718.
Shared TIFF row writing retains the complex sample flag and real/imaginary pairing for pixel and band interleaving. Python construction and low-level row writers accept complex64/complex128 and explicit physical complex sample types. rio supports complex64, complex128 and complex_int16, preserving CInt16/CInt32 on copies and updates. Translation keeps complete component pairs and logical-band descriptions. Integer-complex writers use complex128 internal buffers for ordinary and file-backed writes and updates: CInt16 inputs round only once, while CInt32 components retain exact integer values. Spill selection and slab accounting include the full 16-byte complex sample.
Default complex read dtypes remain unchanged. Explicit complex128 reads preserve exact Int32 components before output conversion through whole reads, windows, nearest decimation, boundless windows and supplied output arrays. NumPy dtype objects and byte order are retained by Raster.read and array. Real out_dtype casts follow NumPy’s real-component conversion and warnings. Incomplete component-pair translation remains a real-component operation.
Validation in a local environment with GDAL 3.13.3:
The source-backed CInt32 copy regression measured the same 131,641 HTTP body bytes in four requests before and after its chunk-budget correction. The largest returned complex128 buffer fell from 134,217,728 to 67,108,864 bytes; total returned buffers remained 134,217,728 bytes. This measures returned buffers, not peak process RSS. Whole-array construction may hold temporary component and converted integer buffers simultaneously; the returned-buffer bound is not a total process-memory limit. Compressed-byte identity with GDAL is not claimed.
Unresampled and nearest complex reads are validated. Other interpolation methods compute components separately; their complex results have not been validated against GDAL. An explicit copy dtype overrides the source physical sample type and may reduce precision. Negative-to-unsigned output follows the existing final cast policy; exact positive component preservation does not imply GDAL-equivalent negative saturation.
Final copy-path correction in 2ec26a2: open readable CInt16 writers retain their unrounded complex128 components during copies, and CInt16 copy chunks use the corresponding 16-byte budget. The existing near-half-value GDAL regression now copies the open writer before closure across GTiff/COG and spill limits. A focused Python precision control and full-repository pre-commit pass. The locally installed native extension predates CInt16 writer support, so its six integration cases cannot validate this matrix; CI rebuilds the PR extension and runs the extended regression. Earlier optimized-package results above predate this final correction.
Update-path correction: reopening a non-spilled CInt16 writer in r+ mode now requests complex128 components, preserving near-half inputs until their final integer conversion. The GDAL window-write regression now covers both w+ and r+ modes across both drivers and all three spill thresholds. Full-repository pre-commit passes. The expanded integration matrix requires the rebuilt CI extension; the older locally installed extension cannot validate it.
Documented limits (2f07cdf): exact CInt32-component output applies to direct Raster and terrio.rio dataset reads. WarpedVRT complex working dtypes remain unsupported. Raster.from_array keeps native component storage and may make a contiguous NumPy copy; those constructor copies are outside read working-memory admission. Documentation-only review follow-up passes changed-file pre-commit.
Summary by CodeRabbit