cf.RaggedContiguousArray.subarray_shapes

RaggedContiguousArray.subarray_shapes(shapes)[source]

Create the subarray shapes along each uncompressed dimension.

New in version (cfdm): 1.10.0.0

See also

subarray

Parameters
chunks: int, sequence, dict or str, optional

Define the subarray shapes.

Any value accepted by the chunks parameter of the dask.array.from_array function is allowed.

The subarray sizes implied by chunks for a dimension that has been compressed are ignored and replaced with values that are implied by the decompression algorithm, so their specification is arbitrary.

By default, chunks is -1, meaning that all non-compressed dimensions in each subarray have the maximum possible size.

Returns
list

The subarray sizes along each uncompressed dimension.

Examples

>>> a.shape
(2, 3, 4)
>>> a.compressed_dimensions()
{0: (0, 1)}
>>> a.subarray_shapes(-1)
[(1, 1), (3,), (4,)]
>>> a.subarray_shapes("auto")
[(1, 1), (3,), "auto"]
>>> a.subarray_shapes(2)
[(1, 1), (3,), 2]
>>> a.subarray_shapes("60B")
[(1, 1), (3,), "60B"]
>>> a.subarray_shapes((None, None, 2))
[(1, 1), (3,), 2]
>>> a.subarray_shapes((None, None, (1, 3)))
[(1, 1), (3,), (1, 3)]
>>> a.subarray_shapes((None, None, "auto"))
[(1, 1), (3,), "auto"]
>>> a.subarray_shapes((None, None, "60B"))
[(1, 1), (3,), "60B"]
>>> a.subarray_shapes({2: (1, 3)})
[(1, 1), (3,), (1, 3)]
>>> import dask.array as da
>>> da.core.normalize_chunks(
...   a.subarray_shapes("auto"), shape=a.shape, dtype=a.dtype
... )
[(1, 1), (3,), (4,)]
>>> da.core.normalize_chunks(
...   a.subarray_shapes(2, shape=a.shape, dtype=a.dtype
... )
[(1, 1), (3,), (2, 2)]
>>> a.shape
(2, 3, 3, 4)
>>> a.compressed_dimensions()
{0: (0, 1, 2)}
>>> a.subarray_shapes(-1)
[(1, 1), (1, 1, 1), (3,), (4,)]
>>> a.subarray_shapes("auto")
[(1, 1), (1, 1, 1), (3,), "auto"]
 >>> a.subarray_shapes(2)
[(1, 1), (1, 1, 1), (3,), 2]
 >>> a.subarray_shapes("60B")
[(1, 1), (1, 1, 1), (3,), "60B"]
>>> a.subarray_shapes((None, None, None, 2))
[(1, 1), (1, 1, 1), (3,), 2]
>>> a.subarray_shapes((None, None, None, (1, 3)))
[(1, 1), (1, 1, 1), (3,), (1, 3)]
>>> a.subarray_shapes((None, None, None, "auto"))
[(1, 1), (1, 1, 1), (3,), "auto"]
>>> a.subarray_shapes((None, None, None, "60B"))
[(1, 1), (1, 1, 1), (3,), "60B"]
>>> a.subarray_shapes({3: (1, 3)})
[(1, 1), (1, 1, 1), (3,), (1, 3)]