fix: array creation in tests#169
Conversation
| shards=ShardsConfigParam( | ||
| shape=(32, 32, 32), index_location=outer_index_location | ||
| ), | ||
| dtype=data.dtype, | ||
| fill_value=0, | ||
| codecs=[ | ||
| ShardingCodec( | ||
| chunk_shape=(32, 32, 32), | ||
| codecs=[ | ||
| ShardingCodec( | ||
| chunk_shape=(16, 16, 16), index_location=inner_index_location | ||
| ) | ||
| ], | ||
| index_location=outer_index_location, | ||
| ) | ||
| ], | ||
| serializer=ShardingCodec( | ||
| chunk_shape=(16, 16, 16), index_location=inner_index_location | ||
| ), |
There was a problem hiding this comment.
Having both of these seems wrong?
There was a problem hiding this comment.
Before, it was the following, no idea how to express that the new way.
codecs=[
ShardingCodec(
chunk_shape=(32, 32, 32),
codecs=[
ShardingCodec(
chunk_shape=(16, 16, 16), index_location=inner_index_location
)
],
index_location=outer_index_location,
)
],There was a problem hiding this comment.
Ok this one specificully is for nested sharding. I think this one is specifically testing nested sharding but I dont know if the way you descibed it is valid, so cc @d-v-b again!
| shape=data.shape, | ||
| chunk_shape=data.shape, | ||
| chunks=data.shape, | ||
| shards=ShardsConfigParam( |
There was a problem hiding this comment.
the param docstring for shards needs work:
- the rST type contains only
tuple[int, ...] - the free text contains
"auto"and"keep"as well - the type contains
Sequence[Sequence[int]]and that TypedDict allowing to specifyindex_location
this drift between type annotation and docstring is why I make sure to use the annotations in scanpy …
There was a problem hiding this comment.
agree this is clunky. we goofed by having 2 flavors of array creation routines (create and create_array) X two function colors, each wrapped by multiple higher-level functions.
The idea behind the ShardsConfigParam is to give you some control of the sharding codec configuration via the shards parameter. If you don't need to specify where the index is, then ignore it and just pass the outer chunk shape you want to the shards param.
There was a problem hiding this comment.
OK, so it’s just a docs issue and you should
- document the exported location of
ShardsConfigParam - unify the 2 separate locations in the docstring where you explain what’s accepted by reflecting what the type annotation already says.
There was a problem hiding this comment.
and we should also probably make the ShardsConfigParam model the full configuration space of the sharding_indexed codec (you can't set the index codecs on it, iirc)

so what I thought happens is that they split up
codecsintoshards: if present, this contains the parameters for an implicitly createdArrayToArrayCodecthat wraps all other given codecs and applies them for each shard individuallyfilters: list ofArrayToArrayCodecsserializer: a singleArrayToBytesCodeccompressors: a list ofBytesToBytesCodecsthis assumption seems to hold for e.g.
tests/test_codecs.py::test_order, but other tests fail, so apparently I didn’t understand this.