Skip to content

Commit

Permalink
Remove key from n5 array metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmoore committed Apr 19, 2021
1 parent 17f54d5 commit 0da3a03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions zarr/n5.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ def array_metadata_to_n5(array_metadata):
compressor_config = compressor_config_to_n5(compressor_config)
array_metadata['compression'] = compressor_config

if 'dimension_separator' in array_metadata:
del array_metadata['dimension_separator']

return array_metadata


Expand Down
28 changes: 15 additions & 13 deletions zarr/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1677,14 +1677,6 @@ def create_array(read_only=False, **kwargs):

class TestArrayWithN5Store(TestArrayWithDirectoryStore):

DIGESTS = (
"453feae4fa9c7086da9e77982e313a45180e4954",
"35e50e63ec4443b6f73094daee51af9a28b8702f",
"8946a49684c3ca9432c896c6129cb00e5d70ad80",
"c71ad4699147c54cde28a54d23ea83e4c80b14b6",
"eb997d6507c5bf9ab994b75b28e24ad2a99fa3d6",
)

@staticmethod
def create_array(read_only=False, **kwargs):
path = mkdtemp()
Expand Down Expand Up @@ -1935,27 +1927,37 @@ def test_compressors(self):
assert np.all(a2[:] == 1)

def test_hexdigest(self):
expecting = [
'c6b83adfad999fbd865057531d749d87cf138f58',
'a3d6d187536ecc3a9dd6897df55d258e2f52f9c5',
'ec2e008525ae09616dbc1d2408cbdb42532005c8',
'b63f031031dcd5248785616edcb2d6fe68203c28',
'0cfc673215a8292a87f3c505e2402ce75243c601',
]
found = []
# Check basic 1-D array
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
assert self.DIGESTS[0] == z.hexdigest()
found.append(z.hexdigest())

# Check basic 1-D array with different type
z = self.create_array(shape=(1050,), chunks=100, dtype='<f4')
assert self.DIGESTS[1] == z.hexdigest()
found.append(z.hexdigest())

# Check basic 2-D array
z = self.create_array(shape=(20, 35,), chunks=10, dtype='<i4')
assert self.DIGESTS[2] == z.hexdigest()
found.append(z.hexdigest())

# Check basic 1-D array with some data
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
z[200:400] = np.arange(200, 400, dtype='i4')
assert self.DIGESTS[3] == z.hexdigest()
found.append(z.hexdigest())

# Check basic 1-D array with attributes
z = self.create_array(shape=(1050,), chunks=100, dtype='<i4')
z.attrs['foo'] = 'bar'
assert self.DIGESTS[4] == z.hexdigest()
found.append(z.hexdigest())

assert expecting == found


class TestArrayWithDBMStore(TestArray):
Expand Down

0 comments on commit 0da3a03

Please sign in to comment.