-
Notifications
You must be signed in to change notification settings - Fork 1
Support partial reading of Zarr datasets #106
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
Open
krisfed
wants to merge
6
commits into
main
Choose a base branch
from
partial-read
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
792d144
First draft of partial read
krisfed 1bd22db
mustBeRow not available before R2024b - for now allow other shapes an…
krisfed 603eb9b
Adding test for scalar Start/Stride/Count
krisfed 6f763b9
Included info about defaults for Start/Stride/Count in M-help
krisfed 9936f79
Error message update
krisfed 7889203
Address feedback and add doc
krisfed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"chunks":[3,4],"compressor":null,"dimension_separator":".","dtype":"<f8","fill_value":null,"filters":null,"order":"C","shape":[3,4],"zarr_format":2} |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"chunks":[1,10],"compressor":null,"dimension_separator":".","dtype":"<f8","fill_value":null,"filters":null,"order":"C","shape":[1,10],"zarr_format":2} |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
function data = zarrread(filepath) | ||
function data = zarrread(filepath, options) | ||
%ZARRREAD Read data from Zarr array | ||
% DATA = ZARRREAD(FILEPATH) retrieves all the data from the Zarr array | ||
% located at FILEPATH. | ||
% The datatype of DATA is the MATLAB equivalent of the Zarr datatype of the | ||
% array located at FILEPATH. | ||
% located at FILEPATH. The datatype of DATA is the MATLAB equivalent of | ||
% the Zarr datatype of the array located at FILEPATH. | ||
% | ||
% DATA = ZARRREAD(..., Start=start) retrieves a subset of the data from | ||
% the Zarr array. Specify start as a row vector of one-based indices of | ||
% the first elements to be read in each dimension. If you do not specify | ||
% start, then the function starts reading the dataset from the first | ||
% index along each dimension. | ||
% | ||
% DATA = ZARRREAD(..., Count=count) retrieves a subset of the data from | ||
% the Zarr array. Specify count as a row vector of numbers of elements to | ||
% be read in each dimension. If you do not specify count, then the | ||
% function reads data until the end of each dimension. | ||
% | ||
% DATA = ZARRREAD(..., Stride=stride) retrieves a subset of the data from | ||
% the Zarr array. Specify stride as a row vector of differences between | ||
% indices along each dimension. A value of 1 accesses adjacent elements | ||
% in the corresponding dimension, a value of 2 accesses every other | ||
% element in the corresponding dimension, and so on. If you do not | ||
% specify stride, then the function reads data without skipping indices | ||
% along each dimension. | ||
|
||
% Copyright 2025 The MathWorks, Inc. | ||
|
||
arguments | ||
filepath {mustBeTextScalar, mustBeNonzeroLengthText} | ||
options.Start (1,:) {mustBeInteger, mustBePositive} = []; | ||
options.Count (1,:) {mustBeInteger, mustBePositive} = []; | ||
options.Stride (1,:) {mustBeInteger, mustBePositive} = []; | ||
end | ||
|
||
zarrObj = Zarr(filepath); | ||
data = zarrObj.read; | ||
data = zarrObj.read(options.Start, options.Count, options.Stride); | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.