-
Notifications
You must be signed in to change notification settings - Fork 23
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
Support nested chunk storage #88
Conversation
Hi will, thanks for opening a PR! Last time I checked in zarr-python, |
It's not yet. I opened zarr-developers/zarr-python#707 to discuss. |
Ah, thanks for clarifying Josh. Hmm. I see two options. Ideally as shown in this PR, Another option, similar to the current solution in function nested(store: Store): Store {
const get = (target: Store, key: any) => {
if (key === 'getItem' || key === 'setItem' || key === 'containsItem') {
return (path, ...args) {
if (path.endsWith('.zarray') || path.endsWith('.zattrs') || path.endsWith('.zgroup')) {
return target[key](path, ...args);
}
const [...prefix, chunkKey] = path.split('/');
const newPath = [...prefix, chunkKey.replaceAll('.', '/')].join('/')
return target[key](newPath, ...args);
}
}
return Reflect.get(target, key);
};
return new Proxy(store, { get });
}
let store = new HTTPStore('http://localhost:8080/data.zarr');
store = nested(store);
store.getItem('path/to/chunk/0.0'); // --> store.getItem('path/to/chunk/0/0'); The proxy acts as a key-transformation layer between |
I definitely understand the hesitation of going adhoc on the metadata name. For what it's worth, we'll be implementing the "automate the user-choice based on the OME-Zarr metadata" (i.e. the version), likely next week. |
That's what I was curious about. I'd like to avoid zarr.js reading/writing adhoc For option 1.), I could see an API like: Curious what you think, @gzuidhof |
Certainly happy to have this, e.g., at the vizarr level. Just a heads up that we'll be starting to open PRs across the various libraries to assume 0.2 == |
@manzt Thanks for that. I'll close this for now and have a look at using your code sample in vizarr. Cheers. |
Code adapted from gzuidhof/zarr.js#88 (comment) No Typescript types yet
* Use Proxy store for nested chunks Code adapted from gzuidhof/zarr.js#88 (comment) No Typescript types yet * Only use nested(store) for correct version of OME-Zarr * format fixes * Move nested handling to io.ts * Revert changes to ome.ts, removing isNested duplication
This adds support for nested zarr stores, where the chunks are in nested directories.
Tested locally in the browser with data generated from latest
bioformats2raw
0.3.0rc1 release with and without the--nested
flag.