Skip to content

Fix tensorstore empty array handling#326

Merged
ieivanov merged 5 commits into
write-shardingfrom
fix-tensorstore-empty-array-handling
Aug 29, 2025
Merged

Fix tensorstore empty array handling#326
ieivanov merged 5 commits into
write-shardingfrom
fix-tensorstore-empty-array-handling

Conversation

@ieivanov
Copy link
Copy Markdown
Contributor

@ieivanov ieivanov commented Aug 22, 2025

Fixing a bug where writing writing with _save_transformed throws an error when all chunks returned by _apply_transform_to_czyx are None

- Add validation for empty arrays in _save_transformed before tensorstore write
- Skip write operations for empty arrays with warning messages
- Add comprehensive error handling with detailed diagnostics for tensorstore failures
- Improve error messages to include array shapes, sizes, and tensorstore details

This resolves the ValueError: Error aligning dimensions issue when empty arrays
are passed to tensorstore write operations.
Adds validation in apply_transform_to_tczyx_and_save() to check for empty
results dictionary before calling _save_transformed(). When no valid time
points are available, logs diagnostic message and skips write operation
instead of attempting to write empty arrays to tensorstore, which causes
alignment dimension mismatches.
@ieivanov ieivanov requested a review from ziw-liu August 24, 2025 02:21
@ieivanov ieivanov marked this pull request as ready for review August 24, 2025 02:21
@ziw-liu
Copy link
Copy Markdown
Contributor

ziw-liu commented Aug 24, 2025

Co-Authored-By: Claude <noreply@anthropic.com>

Not sure if we want to include this in the git tree.

Copy link
Copy Markdown
Contributor

@ziw-liu ziw-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this edge case! Please remove the LLM authorship from the commit message before merging.

@ieivanov ieivanov force-pushed the fix-tensorstore-empty-array-handling branch from 7fb9827 to 1110367 Compare August 29, 2025 19:28
@ieivanov ieivanov merged commit 9efd351 into write-sharding Aug 29, 2025
7 checks passed
@ieivanov ieivanov deleted the fix-tensorstore-empty-array-handling branch August 29, 2025 19:46
ziw-liu added a commit that referenced this pull request Sep 4, 2025
* update signature type hints

* clarify the type of position keys

* expose sharding in plate creation

* isort

* fix default version

* fix example code block format

* fix type hints

* utility to split indices by shards

* separate apply and save

* simplify random number generation

* wip: batched writing in time

* match storage keys with values

* removed unused argument

* fix import

* fix string formatting

* add more version testing

* use tensorstore instead

* control tensorstore concurrency

* memory management

* isort

* format

* remove platform check

* warning if shards is specified for 0.4

* set shards to none for 0.4

* Update acquire-zarr OME v0.5 fixture / aqz test to reflect new config API and downsampling behavior

* add notes about upstream issues

* add example of sharded plate

* explicitly add layout in open_ome_zarr

* Fix tensorstore empty array handling (#326)

* Fix tensorstore empty array handling

- Add validation for empty arrays in _save_transformed before tensorstore write
- Skip write operations for empty arrays with warning messages
- Add comprehensive error handling with detailed diagnostics for tensorstore failures
- Improve error messages to include array shapes, sizes, and tensorstore details

This resolves the ValueError: Error aligning dimensions issue when empty arrays
are passed to tensorstore write operations.

* Add empty results check to prevent tensorstore alignment errors

Adds validation in apply_transform_to_tczyx_and_save() to check for empty
results dictionary before calling _save_transformed(). When no valid time
points are available, logs diagnostic message and skips write operation
instead of attempting to write empty arrays to tensorstore, which causes
alignment dimension mismatches.

* Revert "Fix tensorstore empty array handling"

This reverts commit 65c9ddb.

* better handling of output_time_indices

* style

* bugfix and better type hints

* better messaging

* style

* raise error if attempting sharding along channel dimension

---------

Co-authored-by: Alan Liddell <aliddell@chanzuckerberg.com>
Co-authored-by: Ivan Ivanov <ivan.ivanov@czbiohub.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants