Package com.bc.zarr

Class ArrayParams


  • public class ArrayParams
    extends Object
    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:
        za = zarr.create(
            shape=(12, 10000, 5000),
            chunks=(12, 200, 200),
            dtype='>u4',
            compressor=Zlib(level=1),
            fill_value=-1)
     
    Java example:
        ZarrArray za = ZarrArray.create(new ArrayParams()
             .shape(12, 10000, 5000)
             .chunks(12, 200, 200)
             .dataType(DataType.u4)
             .byteOrder(ByteOrder.BIG_ENDIAN)
             .compressor(CompressorFactory.create("zlib", 1))
             .fillValue(-1)
        );
     
    Shape must be given! If not given ... parameter default values are:
       boolean chunked = true;
       DataType dataType = DataType.f8;
       ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
       Number fillValue = 0;
       Compressor compressor = CompressorFactory.createDefaultCompressor();
       DimensionSeparator sep = DimensionSeparator.DOT;
     
    • Constructor Detail

      • ArrayParams

        public ArrayParams()
    • Method Detail

      • shape

        public ArrayParams shape​(int... shape)
        Sets the mandatory shape and returns a reference to this Builder so that the methods can be chained together.
        Parameters:
        shape - the shape to set
        Returns:
        a reference to this Builder
      • chunks

        public ArrayParams chunks​(int... chunks)
        Sets the optional 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.
        Parameters:
        chunks - the chunks to set.
        Returns:
        a reference to this Builder
      • chunked

        public ArrayParams chunked​(boolean chunked)
        Sets the optional chunked and returns a reference to this Builder so that the methods can be chained together. If no chunks is given and chunked is true, chunks will be calculated using an heuristic algorithm. If chunked is false und no chunks are set, only one chunk with the full array shape will be created. Default value: true
        Parameters:
        chunked - the chunked to set
        Returns:
        a reference to this Builder
      • dataType

        public ArrayParams dataType​(DataType dataType)
        Sets the optional dataType and returns a reference to this Builder so that the methods can be chained together. Default value: DataType.f8
        Parameters:
        dataType - the dataType to set
        Returns:
        a reference to this Builder
      • byteOrder

        public ArrayParams byteOrder​(ByteOrder byteOrder)
        Sets the optional byteOrder and returns a reference to this Builder so that the methods can be chained together. Default value: ByteOrder.BIG_ENDIAN
        Parameters:
        byteOrder - the byteOrder to set
        Returns:
        a reference to this Builder
      • fillValue

        public ArrayParams fillValue​(Number fillValue)
        Sets the optional fillValue and returns a reference to this Builder so that the methods can be chained together. Default value: 0
        Parameters:
        fillValue - the fillValue to set
        Returns:
        a reference to this Builder
      • dimensionSeparator

        public ArrayParams dimensionSeparator​(DimensionSeparator sep)
        Sets the optional dimension_separator and returns a reference to this Builder so that the methods can be chained together. An argument null will be converted to DimensionSeparator.DOT. If this method is not used, the default separator DimensionSeparator.DOT remains unchanged.
        Parameters:
        sep - the DimensionSeparator to set or null
        Returns:
        a reference to this Builder