예제 #1
0
 def _zeros_nosync(self, name, **kwargs):
     path = self._item_path(name)
     kwargs.setdefault('synchronizer', self._synchronizer)
     return zeros(store=self._store,
                  path=path,
                  chunk_store=self._chunk_store,
                  **kwargs)
예제 #2
0
def test_zeros_like(zarr_version):

    kwargs = _init_creation_kwargs(zarr_version)
    expected_zarr_version = DEFAULT_ZARR_VERSION if zarr_version is None else zarr_version

    # zarr array
    z = zeros(100,
              chunks=10,
              dtype='f4',
              compressor=Zlib(5),
              order='F',
              **kwargs)
    z2 = zeros_like(z, path=kwargs.get('path', None))
    assert z.shape == z2.shape
    assert z.chunks == z2.chunks
    assert z.dtype == z2.dtype
    assert z.compressor.get_config() == z2.compressor.get_config()
    assert z.fill_value == z2.fill_value
    assert z.order == z2.order
    assert (z._store._store_version == z2._store._store_version ==
            expected_zarr_version)
    # numpy array
    a = np.empty(100, dtype='f4')
    z3 = zeros_like(a, chunks=10, **kwargs)
    assert a.shape == z3.shape
    assert (10, ) == z3.chunks
    assert a.dtype == z3.dtype
    assert 0 == z3.fill_value
예제 #3
0
def test_zeros_like():
    # zarr array
    z = zeros(100, chunks=10, dtype='f4', compressor=Zlib(5), order='F')
    z2 = zeros_like(z)
    assert z.shape == z2.shape
    assert z.chunks == z2.chunks
    assert z.dtype == z2.dtype
    assert z.compressor.get_config() == z2.compressor.get_config()
    assert z.fill_value == z2.fill_value
    assert z.order == z2.order
    # numpy array
    a = np.empty(100, dtype='f4')
    z3 = zeros_like(a, chunks=10)
    assert a.shape == z3.shape
    assert (10, ) == z3.chunks
    assert a.dtype == z3.dtype
    assert 0 == z3.fill_value
예제 #4
0
def test_zeros_like():
    # zarr array
    z = zeros(100, chunks=10, dtype='f4', compressor=Zlib(5), order='F')
    z2 = zeros_like(z)
    eq(z.shape, z2.shape)
    eq(z.chunks, z2.chunks)
    eq(z.dtype, z2.dtype)
    eq(z.compressor.get_config(), z2.compressor.get_config())
    eq(z.fill_value, z2.fill_value)
    eq(z.order, z2.order)
    # numpy array
    a = np.empty(100, dtype='f4')
    z3 = zeros_like(a, chunks=10)
    eq(a.shape, z3.shape)
    eq((10, ), z3.chunks)
    eq(a.dtype, z3.dtype)
    eq(0, z3.fill_value)
예제 #5
0
def test_zeros_like():
    # zarr array
    z = zeros(100, chunks=10, dtype='f4', compressor=Zlib(5),
              order='F')
    z2 = zeros_like(z)
    eq(z.shape, z2.shape)
    eq(z.chunks, z2.chunks)
    eq(z.dtype, z2.dtype)
    eq(z.compressor.get_config(), z2.compressor.get_config())
    eq(z.fill_value, z2.fill_value)
    eq(z.order, z2.order)
    # numpy array
    a = np.empty(100, dtype='f4')
    z3 = zeros_like(a, chunks=10)
    eq(a.shape, z3.shape)
    eq((10,), z3.chunks)
    eq(a.dtype, z3.dtype)
    eq(0, z3.fill_value)
예제 #6
0
def test_zeros_like():
    # zarr array
    z = zeros(100, chunks=10, dtype='f4', compressor=Zlib(5),
              order='F')
    z2 = zeros_like(z)
    assert z.shape == z2.shape
    assert z.chunks == z2.chunks
    assert z.dtype == z2.dtype
    assert z.compressor.get_config() == z2.compressor.get_config()
    assert z.fill_value == z2.fill_value
    assert z.order == z2.order
    # numpy array
    a = np.empty(100, dtype='f4')
    z3 = zeros_like(a, chunks=10)
    assert a.shape == z3.shape
    assert (10,) == z3.chunks
    assert a.dtype == z3.dtype
    assert 0 == z3.fill_value
예제 #7
0
def test_zeros():
    z = zeros(100, chunks=10)
    assert (100, ) == z.shape
    assert (10, ) == z.chunks
    assert_array_equal(np.zeros(100), z[:])
예제 #8
0
파일: hierarchy.py 프로젝트: alimanfoo/zarr
 def _zeros_nosync(self, name, **kwargs):
     path = self._item_path(name)
     kwargs.setdefault('synchronizer', self._synchronizer)
     return zeros(store=self._store, path=path,
                  chunk_store=self._chunk_store, **kwargs)
예제 #9
0
def test_zeros():
    z = zeros(100, chunks=10)
    eq((100,), z.shape)
    eq((10,), z.chunks)
    assert_array_equal(np.zeros(100), z[:])
예제 #10
0
def test_zeros():
    z = zeros(100, chunks=10)
    assert (100,) == z.shape
    assert (10,) == z.chunks
    assert_array_equal(np.zeros(100), z[:])
예제 #11
0
def test_zeros():
    z = zeros(100, chunks=10)
    eq((100, ), z.shape)
    eq((10, ), z.chunks)
    assert_array_equal(np.zeros(100), z[:])
예제 #12
0
def test_json_dumps_chunks_numpy_dtype():
    z = zeros((10, ), chunks=(np.int64(2), ))
    assert np.all(z[...] == 0)
예제 #13
0
def test_zeros(zarr_version):
    kwargs = _init_creation_kwargs(zarr_version)
    z = zeros(100, chunks=10, **kwargs)
    assert (100, ) == z.shape
    assert (10, ) == z.chunks
    assert_array_equal(np.zeros(100), z[:])