Skip to content

Commit

Permalink
Merge pull request #1752 from girder/validate-on-load
Browse files Browse the repository at this point in the history
When reopening a zarr sink, validate it
  • Loading branch information
manthey authored Jan 3, 2025
2 parents bf58412 + 87928dc commit 9facaae
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
Expand Up @@ -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'):
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 9facaae

Please sign in to comment.