Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fabc95b
Bump gson from 2.8.5 to 2.8.9
dependabot[bot] May 20, 2022
315440d
Bump jackson-databind from 2.11.3 to 2.12.7.1
dependabot[bot] Nov 16, 2022
a130573
suppress writing fill value-only chunks
martin-boettcher Jan 3, 2025
9960873
suppress writing fill value-only chunks (2)
martin-boettcher Jan 14, 2025
56456df
Change maven build version nuber to 0.3.7-SNAPSHOT
SabineEmbacher Mar 20, 2025
5dc9115
update repository
BeLu-23 May 22, 2025
f35a5ae
removed SNAPSHOT
BeLu-23 May 22, 2025
5468bb6
Merge pull request #46 from bcdev/BL-update-to-new-repository
BeLu-23 May 22, 2025
1dc5c17
Merge remote-tracking branch 'fork/main' into toniof-xxx-harmonize_wi…
TonioF Jan 26, 2026
a264c99
addressed warnings
TonioF Jan 26, 2026
f795956
Bump org.assertj:assertj-core from 3.19.0 to 3.27.7
dependabot[bot] Jan 26, 2026
3267149
adjusted test
TonioF Jan 27, 2026
82a62f3
added repo
TonioF Jan 27, 2026
8859b4f
set version to snapshot
TonioF Feb 18, 2026
61635a7
Merge pull request #33 from bcdev/dependabot/maven/com.google.code.gs…
TonioF Feb 18, 2026
7924943
Merge pull request #36 from bcdev/dependabot/maven/com.fasterxml.jack…
TonioF Feb 18, 2026
d5b8d34
Merge pull request #40 from bcdev/IAE_if_space_in_path#39
TonioF Feb 18, 2026
0bba28e
Merge pull request #47 from bcdev/dependabot/maven/org.assertj-assert…
TonioF Feb 18, 2026
7adcfe2
Merge branch 'master' into toniof-xxx-harmonize_with_zarr_devs
TonioF Feb 18, 2026
7818f91
updated pom
TonioF Mar 6, 2026
b1a1234
adjusted group id
TonioF Mar 10, 2026
9827458
updated repository
TonioF Mar 13, 2026
78ecf8f
Update pom.xml
SabineEmbacher Mar 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 17 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
</scm>

<developers>
<developer>
<id>SabineEmbacher</id>
<name>Sabine Embacher</name>
<roles>
<role>maintainer</role>
</roles>
</developer>
<developer>
<id>TonioF</id>
<name>Tonio Fincke</name>
<roles>
<role>maintainer</role>
</roles>
</developer>
<developer>
<id>joshmoore</id>
<name>Josh Moore</name>
Expand Down Expand Up @@ -119,23 +133,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.lasersonlab</groupId>
<artifactId>s3fs</artifactId>
<version>2.2.3</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
</exclusions>
<version>3.27.7</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -154,7 +152,7 @@
<repositories>
<repository>
<id>unidata.releases</id>
<url>https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases</url>
<url>https://artifacts.unidata.ucar.edu/repository/unidata-all/</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
Expand Down Expand Up @@ -265,14 +263,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>**/*.java</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand Down Expand Up @@ -332,4 +322,4 @@
</profile>
</profiles>

</project>
</project>
3 changes: 0 additions & 3 deletions src/main/java/com/bc/zarr/ArrayParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* The class ArrayParams implements the Builder pattern. It is used on java side to imitate the pythonic default
* value feature for function arguments. So the recognition factor for users who are familiar with the python zarr
* framework should be high. E.g.:
*
* Python example:
* <pre>
* za = zarr.create(
Expand All @@ -58,7 +57,6 @@
* );
* </pre>
* Shape must be given!
*
* If not given ... parameter default values are:
* <pre>
* boolean chunked = true;
Expand Down Expand Up @@ -92,7 +90,6 @@ public ArrayParams shape(int... shape) {

/**
* Sets the optional {@code chunks} and returns a reference to this Builder so that the methods can be chained together.
*
* The number of dimensions must be equal to the number of dimensions of the shape.
*
* @param chunks the {@code chunks} to set.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/bc/zarr/CompressorFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.Deflater;
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/bc/zarr/ZarrArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,14 @@ private boolean isBufferShapeEqualChunkShape(int[] bufferShape) {
}

private boolean isZeroOffset(int[] offset) {
return Arrays.equals(offset, new int[offset.length]);
//return Arrays.equals(offset, new int[offset.length]);
// avoid new for a test
for (int i : offset) {
if (i != 0) {
return false;
}
}
return true;
}

public void writeAttributes(Map<String, Object> attributes) throws IOException {
Expand Down
30 changes: 24 additions & 6 deletions src/main/java/com/bc/zarr/chunk/ChunkReaderWriterImpl_Byte.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.bc.zarr.storage.Store;
import ucar.ma2.Array;
import ucar.ma2.DataType;
import ucar.ma2.IndexIterator;

import java.io.*;

Expand Down Expand Up @@ -57,14 +58,31 @@ public Array read(String storeKey) throws IOException {
}
}

protected boolean isFillOnly(Array array) {
if (fill == null) {
return false;
}
final IndexIterator iter = array.getIndexIterator();
while (iter.hasNext()) {
if (iter.getByteNext() != fill.byteValue()) {
return false;
}
}
return true;
}

@Override
public void write(String storeKey, Array array) throws IOException {
final byte[] bytes = (byte[]) array.get1DJavaArray(DataType.BYTE);
try (
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
final OutputStream os = store.getOutputStream(storeKey)
) {
compressor.compress(is, os);
if (isFillOnly(array)) {
store.delete(storeKey);
} else {
final byte[] bytes = (byte[]) array.get1DJavaArray(DataType.BYTE);
try (
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
final OutputStream os = store.getOutputStream(storeKey)
) {
compressor.compress(is, os);
}
}
}
}
47 changes: 37 additions & 10 deletions src/main/java/com/bc/zarr/chunk/ChunkReaderWriterImpl_Double.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.bc.zarr.storage.Store;
import ucar.ma2.Array;
import ucar.ma2.DataType;
import ucar.ma2.IndexIterator;

import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
Expand Down Expand Up @@ -69,18 +70,44 @@ public Array read(String storeKey) throws IOException {
}
}

protected boolean isFillOnly(Array array) {
if (fill == null) {
return false;
}
final IndexIterator iter = array.getIndexIterator();
final double fillValue = fill.doubleValue();
if (Double.isNaN(fillValue)) {
while (iter.hasNext()) {
if (! Double.isNaN(iter.getDoubleNext())) {
return false;
}
}
} else {
while (iter.hasNext()) {
if (iter.getDoubleNext() != fillValue) {
return false;
}
}
}
return true;
}

@Override
public void write(String storeKey, Array array) throws IOException {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final double[] doubles = (double[]) array.get1DJavaArray(DataType.DOUBLE);
iis.setByteOrder(order);
iis.writeDoubles(doubles, 0, doubles.length);
iis.seek(0);
compressor.compress(is, os);
if (isFillOnly(array)) {
store.delete(storeKey);
} else {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final double[] doubles = (double[]) array.get1DJavaArray(DataType.DOUBLE);
iis.setByteOrder(order);
iis.writeDoubles(doubles, 0, doubles.length);
iis.seek(0);
compressor.compress(is, os);
}
}
}
}
47 changes: 37 additions & 10 deletions src/main/java/com/bc/zarr/chunk/ChunkReaderWriterImpl_Float.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.bc.zarr.storage.Store;
import ucar.ma2.Array;
import ucar.ma2.DataType;
import ucar.ma2.IndexIterator;

import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
Expand Down Expand Up @@ -69,18 +70,44 @@ public Array read(String storeKey) throws IOException {
}
}

protected boolean isFillOnly(Array array) {
if (fill == null) {
return false;
}
final IndexIterator iter = array.getIndexIterator();
final float fillValue = fill.floatValue();
if (Float.isNaN(fillValue)) {
while (iter.hasNext()) {
if (! Float.isNaN(iter.getFloatNext())) {
return false;
}
}
} else {
while (iter.hasNext()) {
if (iter.getFloatNext() != fillValue) {
return false;
}
}
}
return true;
}

@Override
public void write(String storeKey, Array array) throws IOException {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final float[] floats = (float[]) array.get1DJavaArray(DataType.FLOAT);
iis.setByteOrder(order);
iis.writeFloats(floats, 0, floats.length);
iis.seek(0);
compressor.compress(is, os);
if (isFillOnly(array)) {
store.delete(storeKey);
} else {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final float[] floats = (float[]) array.get1DJavaArray(DataType.FLOAT);
iis.setByteOrder(order);
iis.writeFloats(floats, 0, floats.length);
iis.seek(0);
compressor.compress(is, os);
}
}
}
}
38 changes: 28 additions & 10 deletions src/main/java/com/bc/zarr/chunk/ChunkReaderWriterImpl_Integer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.bc.zarr.storage.Store;
import ucar.ma2.Array;
import ucar.ma2.DataType;
import ucar.ma2.IndexIterator;

import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
Expand Down Expand Up @@ -69,18 +70,35 @@ public Array read(String storeKey) throws IOException {
}
}

protected boolean isFillOnly(Array array) {
if (fill == null) {
return false;
}
final IndexIterator iter = array.getIndexIterator();
while (iter.hasNext()) {
if (iter.getIntNext() != fill.intValue()) {
return false;
}
}
return true;
}

@Override
public void write(String storeKey, Array array) throws IOException {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final int[] ints = (int[]) array.get1DJavaArray(DataType.INT);
iis.setByteOrder(order);
iis.writeInts(ints, 0, ints.length);
iis.seek(0);
compressor.compress(is, os);
if (isFillOnly(array)) {
store.delete(storeKey);
} else {
try (
final ImageOutputStream iis = new MemoryCacheImageOutputStream(new ByteArrayOutputStream());
final InputStream is = new ZarrInputStreamAdapter(iis);
final OutputStream os = store.getOutputStream(storeKey)
) {
final int[] ints = (int[]) array.get1DJavaArray(DataType.INT);
iis.setByteOrder(order);
iis.writeInts(ints, 0, ints.length);
iis.seek(0);
compressor.compress(is, os);
}
}
}
}
Loading
Loading