Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When reopening a zarr sink, validate it
Browse files Browse the repository at this point in the history
Also, write the metadata after fundamental changes so that anything that
reopens the file after that point will see those changes.
manthey committed Jan 2, 2025
1 parent 0b2b7e8 commit 54a7a3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sources/zarr/large_image_source_zarr/__init__.py
Original file line number Diff line number Diff line change
@@ -158,6 +158,11 @@ def _initNew(self, path, **kwargs):
self._frameValues = None
self._frameAxes = None
self._frameUnits = None
if not self._created:
try:
self._validateZarr()
except Exception:
pass

def __del__(self):
if not hasattr(self, '_derivedSource'):
@@ -809,6 +814,7 @@ def addTile(self, tile, x=0, y=0, mask=None, axes=None, **kwargs):
self._levels = None
self.levels = int(max(1, math.ceil(math.log(max(
self.sizeX / self.tileWidth, self.sizeY / self.tileHeight)) / math.log(2)) + 1))
updateMetadata = True
if updateMetadata:
self._writeInternalMetadata()

0 comments on commit 54a7a3f

Please sign in to comment.