In experimenting a bit with writing v3 Zarr and then reading the results back, I haven't been able to read chunks that contain data other than the fill value using the most recent commit (a063c1e). This line seems to be the source of the problem:
https://github.com/zarr-developers/zarr-java/blob/main/src/main/java/dev/zarr/zarrjava/v3/Array.java#L214
If I change that line to if (!chunkIsInArray(chunkCoords)) { and re-run my test code with the patched version of zarr-java, then I can see non-fill-value data as expected. I'm not sure if I just misunderstand that logic, though - it's also possible there is something wrong with my test data or code.
Minimal test code that demonstrates the issue:
// inputLocation is "/path/to/v3.zarr"
Store store = new FilesystemStore(inputLocation);
Group firstSeries = Group.open(store.resolve("0"));
Node[] resolutions = firstSeries.listAsArray();
for (Node r : resolutions) {
Array resolutionArray = (Array) r;
// only read the first chunk
int[] chunks = resolutionArray.metadata.chunkShape();
long[] offset = new long[] {0, 0, 0, 0, 0};
ucar.ma2.Array tile = resolutionArray.read(offset, chunks);
// test dataset only has uint8 arrays
ByteBuffer buffer = tile.getDataAsByteBuffer();
System.out.println("comparing " + buffer.limit() + " bytes against fill value");
int nonFill = 0;
for (int i=0; i<buffer.limit(); i++) {
if (buffer.get(i) != ((Number) resolutionArray.metadata.fillValue).byteValue()) {
nonFill++;
}
}
// expect this to print a value greater than 0 since none of the chunks are empty
System.out.println("bytes of non-fill: " + nonFill);
}
And test data: v3-example.tar.gz. That is https://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1-Small-Region.svs converted with https://github.com/glencoesoftware/bioformats2raw, then copied from v2 to v3 using jzarr to read and zarr-java to write.
In experimenting a bit with writing v3 Zarr and then reading the results back, I haven't been able to read chunks that contain data other than the fill value using the most recent commit (a063c1e). This line seems to be the source of the problem:
https://github.com/zarr-developers/zarr-java/blob/main/src/main/java/dev/zarr/zarrjava/v3/Array.java#L214
If I change that line to
if (!chunkIsInArray(chunkCoords)) {and re-run my test code with the patched version of zarr-java, then I can see non-fill-value data as expected. I'm not sure if I just misunderstand that logic, though - it's also possible there is something wrong with my test data or code.Minimal test code that demonstrates the issue:
And test data: v3-example.tar.gz. That is https://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1-Small-Region.svs converted with https://github.com/glencoesoftware/bioformats2raw, then copied from v2 to v3 using jzarr to read and zarr-java to write.