Skip to content

Commit

Permalink
Merge pull request #197 from valeriupredoi/zero-chunk
Browse files Browse the repository at this point in the history
Set count to 0 for 0-sized data
  • Loading branch information
valeriupredoi authored Apr 25, 2024
2 parents 4816902 + 8b46b4b commit e4f2067
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion activestorage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def reduce_chunk(rfile,
if tmp.size:
return method(tmp), tmp.size
else:
return tmp, None
return tmp, 0
else:
return tmp, None

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_reduced_chunk_fully_masked_data_fill():
order="C", chunk_selection=ch_sel,
method=np.mean)
assert rc[0].size == 0
assert rc[1] is None
assert rc[1] == 0


def test_reduced_chunk_fully_masked_data_missing():
Expand All @@ -79,7 +79,7 @@ def test_reduced_chunk_fully_masked_data_missing():
order="C", chunk_selection=ch_sel,
method=np.mean)
assert rc[0].size == 0
assert rc[1] is None
assert rc[1] == 0


def test_reduced_chunk_fully_masked_data_vmin():
Expand All @@ -98,7 +98,7 @@ def test_reduced_chunk_fully_masked_data_vmin():
order="C", chunk_selection=ch_sel,
method=np.mean)
assert rc[0].size == 0
assert rc[1] is None
assert rc[1] == 0


def test_reduced_chunk_fully_masked_data_vmax():
Expand All @@ -117,7 +117,7 @@ def test_reduced_chunk_fully_masked_data_vmax():
order="C", chunk_selection=ch_sel,
method=np.mean)
assert rc[0].size == 0
assert rc[1] is None
assert rc[1] == 0


def test_zero_data():
Expand Down

0 comments on commit e4f2067

Please sign in to comment.