Skip to content

Commit

Permalink
Merge pull request #296 from will-moore/handle_empty_wells
Browse files Browse the repository at this point in the history
Check Well exists before trying to load data
  • Loading branch information
will-moore authored Sep 29, 2023
2 parents 03de064 + 1af6d7b commit 2739e55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ome_zarr/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ def get_stitched_grid(self, level: int, tile_shape: tuple) -> da.core.Array:

def get_tile(row: int, col: int) -> da.core.Array:
"""tile_name is 'level,z,c,t,row,col'"""

# check whether the Well exists at this row/column
well_path = f"{self.row_names[row]}/{self.col_names[col]}"
if well_path not in self.well_paths:
LOGGER.debug("empty well: %s", well_path)
return np.zeros(tile_shape, dtype=self.numpy_type)

path = self.get_tile_path(level, row, col)
LOGGER.debug("creating tile... %s with shape: %s", path, tile_shape)

Expand Down

0 comments on commit 2739e55

Please sign in to comment.