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

Update for zarr 2.18.0 and zarr 2.18.1 #195

Merged
merged 11 commits into from
May 22, 2024
Merged

Update for zarr 2.18.0 and zarr 2.18.1 #195

merged 11 commits into from
May 22, 2024

Conversation

mavaylon1
Copy link
Contributor

@mavaylon1 mavaylon1 commented May 16, 2024

Motivation

What was the reasoning behind this change? Please explain the changes briefly.
This PR is to update hdmf-zarr for changes that came n 2.18.0 and new changes in 2.18.0

2.18.0
This is in response to the failing workflows using the latest version of zarr, specifically the failing test test_fsspec_streaming.

The issue is how we are reading zarr scalar arrays. We are currently trying to directly index and access the scalar. From looking at the documentation, zarr accessed a scalar array as z[:], which seems to solve the problem. I also saw that z[()] was another syntax that works.

Why?
Not completely clear.
When we access a scalar array in numpy we do so with notation [()]. Supposedly, Zarr used to support indexing scalar arrays as z[0], but that was updated to numpy standard earlier in one of the zarr version 2.#. Maybe this was a functionality that finally got flushed out fully.

2.18.1
To ensure that the data being assigned is in a format that the Zarr array can handle efficiently, Zarr arrays seem to require that we set with numpy arrays, i.e., dset[:] = np.array(data).

Another weird behavior is when setting a dataset of references, the current method puts the entire dataset in each index vs matching the individual reference dictionary to the index (which is what we expect).

The solution to both is make sure the data is in an array first.

How to test the behavior?

Show how to reproduce the new behavior (can be a bug fix or a new feature)

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running ruff from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.05%. Comparing base (72ff80f) to head (e9cfb84).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #195   +/-   ##
=======================================
  Coverage   86.05%   86.05%           
=======================================
  Files           5        5           
  Lines        1162     1162           
  Branches      287      287           
=======================================
  Hits         1000     1000           
  Misses        107      107           
  Partials       55       55           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mavaylon1 mavaylon1 changed the title Update pyproject.toml Fix reading scalar arrays May 16, 2024
@mavaylon1 mavaylon1 mentioned this pull request May 16, 2024
3 tasks
@mavaylon1
Copy link
Contributor Author

Hey @oruebel can you give me your thoughts. I believe this is related to #192

@oruebel
Copy link
Contributor

oruebel commented May 16, 2024

Using the [()] syntax to access scalars makes sense to me

@mavaylon1
Copy link
Contributor Author

@oruebel There are also some deprecation warnings for zarr 3.0. I will add filters in this PR, but I'll also make a ticket for those deprecations to be resolved to whatever zarr will be pivoting to.

@mavaylon1 mavaylon1 changed the title Fix reading scalar arrays Update for zarr 2.18.0 and zarr 2.18.1 May 22, 2024
@mavaylon1 mavaylon1 requested a review from rly May 22, 2024 19:42
@mavaylon1 mavaylon1 marked this pull request as ready for review May 22, 2024 19:44
@mavaylon1
Copy link
Contributor Author

Review Notes:
I need to ping to see if this now resolved with this update or to see what changes:
#192

Copy link
Contributor

@rly rly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for taking care of this.

@mavaylon1 mavaylon1 merged commit 07a5bb2 into dev May 22, 2024
24 checks passed
@mavaylon1 mavaylon1 deleted the schedule branch May 22, 2024 20:39
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

Successfully merging this pull request may close these issues.

4 participants