Skip to content

Expanding samples (bands) in a zarr sink does work #1978

@manthey

Description

@manthey

If you have a zarr sink and create an image one sample at a time, when we expand the array to accommodate a larger number of samples, the array fails to behave as expected.

Here is an example of the error:

import large_image
import numpy as np

sink = large_image.new()
for band in range(0, 10, 1):
    data = np.zeros((2000, 2000))
    data.fill(band)
    sink.addTile(data, s=band)
sink.write('test1.tiff')


sink = large_image.new()
for band in range(9, -1, -1):
    data = np.zeros((2000, 2000))
    data.fill(band)
    sink.addTile(data, s=band)
sink.write('test2.tiff')


ts1 = large_image.open('test1.tiff')
print(ts1.getRegion(format='numpy')[0][100, 100, 8])
# WRONG: prints np.uint8(0)

ts2 = large_image.open('test2.tiff')
print(ts2.getRegion(format='numpy')[0][100, 100, 8])
# RIGHT: prints np.uint8(8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions