Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set scalar #219

Open
ondave opened this issue Oct 17, 2024 · 1 comment
Open

Cannot set scalar #219

ondave opened this issue Oct 17, 2024 · 1 comment

Comments

@ondave
Copy link

ondave commented Oct 17, 2024

It does not appear to be possible to set a scalar 'array'. The zarr specification does apparently allow this with shape=[] and the read case is handled in https://github.com/manzt/zarrita.js/blob/main/packages/indexing/src/get.ts with this code:
return indexer.shape.length === 0 ? unwrap(out.data, 0) : out;

However in https://github.com/manzt/zarrita.js/blob/main/packages/indexing/src/set.ts the zero length shape results in a zero length indexer which means nothing gets written to the array.

@ondave
Copy link
Author

ondave commented Oct 17, 2024

Looking a bit more into this, is this related to the fact that the only way to represent a typed value suitable for writing to the array is a TypedArray? Which of course is an array! Without a TypedScalar equivalent, it is not so straightforward to set a scalar value.
Setting a zarr array with a length 1 TypedArray works fine but is then represented in zarr as having shape [1].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant