-
-
Notifications
You must be signed in to change notification settings - Fork 364
Write chunks with negative zero values and a zero fill value #3216
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
Changes from 1 commit
c4904e3
3f8c84f
1cc3250
683ec5f
c65774c
919be15
dba8b0b
58f45b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
For arrays with ``config={"write_empty_chunks: False}`` and ``fill_value=0.0`` (default), chunks containing negative zeroes are written out. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -904,6 +904,30 @@ def test_write_empty_chunks_behavior( | |
assert arr.nchunks_initialized == arr.nchunks | ||
|
||
|
||
@pytest.mark.parametrize("store", ["memory"], indirect=True) | ||
@pytest.mark.parametrize("fill_value", [0.0, -0.0]) | ||
def test_write_empty_chunks_negative_zero( | ||
zarr_format: ZarrFormat, store: MemoryStore, fill_value: float | ||
) -> None: | ||
# regression test for https://github.com/zarr-developers/zarr-python/issues/3144 | ||
|
||
arr = zarr.create_array( | ||
store=store, | ||
shape=(2,), | ||
zarr_format=zarr_format, | ||
dtype="f4", | ||
fill_value=fill_value, | ||
chunks=(1,), | ||
config={"write_empty_chunks": False}, | ||
) | ||
|
||
assert arr.nchunks_initialized == 0 | ||
|
||
# initialize the with the negated fill value (-0.0 for +0.0, +0.0 for -0.0) | ||
arr[:] = -fill_value | ||
assert arr.nchunks_initialized == arr.nchunks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test is fine but ideally we would be testing the altered function explicitly, instead of indirectly via array creation + chunk writing. this is not a blocker for this PR, just something to sort out down the road There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That test is basically copied from |
||
|
||
|
||
@pytest.mark.parametrize( | ||
("fill_value", "expected"), | ||
[ | ||
|
Uh oh!
There was an error while loading. Please reload this page.