Skip to content

Commit 0ff7645

Browse files
authored
Remove order from GetOptions (#274)
1 parent c5c19de commit 0ff7645

File tree

6 files changed

+14
-33
lines changed

6 files changed

+14
-33
lines changed

.changeset/all-apples-beam.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"zarrita": minor
3+
"@zarrita/ndarray": minor
4+
---
5+
6+
Remove explicit `order` from `GetOptions`.

packages/@zarrita-ndarray/__tests__/index.test.ts

-10
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,4 @@ describe("ndarray", () => {
272272
expect(res.shape).toStrictEqual([3, 3, 3]);
273273
expect(res.stride).toStrictEqual([1, 3, 9]);
274274
});
275-
276-
it("3d.chunked.mixed.i2.F -- force C", async () => {
277-
let arr = await zarr.open.v2(store.resolve("/3d.chunked.mixed.i2.F"), {
278-
kind: "array",
279-
});
280-
let res = await get(arr, null, { order: "C" });
281-
expect(res.data).toStrictEqual(new Int16Array(range(27)));
282-
expect(res.shape).toStrictEqual([3, 3, 3]);
283-
expect(res.stride).toStrictEqual([9, 3, 1]);
284-
});
285275
});

packages/zarrita/__tests__/indexing/get.test.ts

-16
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,6 @@ describe("get v2", () => {
518518
expect(res.stride).toStrictEqual([1, 3, 9]);
519519
});
520520

521-
it("3d.chunked.mixed.i2.F -- force C", async () => {
522-
let res = await get_v2("/3d.chunked.mixed.i2.F", null, { order: "C" });
523-
expect(res.data).toStrictEqual(new Int16Array(range(27)));
524-
expect(res.shape).toStrictEqual([3, 3, 3]);
525-
expect(res.stride).toStrictEqual([9, 3, 1]);
526-
});
527-
528521
it("3d.chunked.O", async () => {
529522
let arr = await get_v2("/3d.chunked.O");
530523
expect(arr).toStrictEqual({
@@ -667,13 +660,4 @@ describe("get v3", () => {
667660
expect(res.shape).toStrictEqual([3, 3, 3]);
668661
expect(res.stride).toStrictEqual([1, 3, 9]);
669662
});
670-
671-
it("3d.chunked.mixed.i2.F -- force C", async () => {
672-
let res = await get_v3("/3d.chunked.mixed.i2.F", null, {
673-
order: "C",
674-
});
675-
expect(res.data).toStrictEqual(new Int16Array(range(27)));
676-
expect(res.shape).toStrictEqual([3, 3, 3]);
677-
expect(res.stride).toStrictEqual([9, 3, 1]);
678-
});
679663
});

packages/zarrita/src/hierarchy.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ function create_context<Store extends Readable, D extends DataType>(
9999
shape: configuration.chunk_shape,
100100
codecs: configuration.codecs,
101101
}),
102-
get_strides(shape: number[], order?: "C" | "F") {
103-
return get_strides(shape, order ?? native_order);
102+
get_strides(shape: number[]) {
103+
return get_strides(shape, native_order);
104104
},
105105
get_chunk_bytes: create_sharded_chunk_getter(
106106
location,
@@ -121,8 +121,8 @@ function create_context<Store extends Readable, D extends DataType>(
121121
shape: metadata.chunk_grid.configuration.chunk_shape,
122122
codecs: metadata.codecs,
123123
}),
124-
get_strides(shape: number[], order?: "C" | "F") {
125-
return get_strides(shape, order ?? native_order);
124+
get_strides(shape: number[]) {
125+
return get_strides(shape, native_order);
126126
},
127127
async get_chunk_bytes(chunk_coords, options) {
128128
let chunk_key = shared_context.encode_chunk_key(chunk_coords);
@@ -142,7 +142,7 @@ interface ArrayContext<Store extends Readable, D extends DataType> {
142142
/** The TypedArray constructor for this array chunks. */
143143
TypedArray: TypedArrayConstructor<D>;
144144
/** A function to get the strides for a given shape, using the array order */
145-
get_strides(shape: number[], order?: "C" | "F"): number[];
145+
get_strides(shape: number[]): number[];
146146
/** The fill value for this array. */
147147
fill_value: Scalar<D> | null;
148148
/** A function to get the bytes for a given chunk. */

packages/zarrita/src/indexing/get.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ export async function get<
4242
shape: arr.shape,
4343
chunk_shape: arr.chunks,
4444
});
45+
4546
let out = setter.prepare(
4647
new context.TypedArray(indexer.shape.reduce((a, b) => a * b, 1)),
4748
indexer.shape,
48-
context.get_strides(indexer.shape, opts.order),
49+
context.get_strides(indexer.shape),
4950
);
5051

5152
let queue = opts.create_queue?.() ?? create_queue();

packages/zarrita/src/indexing/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type Options = {
4444
create_queue?: () => ChunkQueue;
4545
};
4646

47-
export type GetOptions<O> = Options & { opts?: O; order?: "C" | "F" };
47+
export type GetOptions<O> = Options & { opts?: O };
4848

4949
export type SetOptions = Options;
5050

0 commit comments

Comments
 (0)