# Path: zarr/creation.py
# def array(data, **kwargs):
#     """Create an array filled with `data`.
# 
#     The `data` argument should be a NumPy array or array-like object. For
#     other parameter definitions see :func:`zarr.creation.create`.
# 
#     Examples
#     --------
#     >>> import numpy as np
#     >>> import zarr
#     >>> a = np.arange(100000000).reshape(10000, 10000)
#     >>> z = zarr.array(a, chunks=(1000, 1000))
#     >>> z
#     <zarr.core.Array (10000, 10000) int64>
# 
#     """
# 
#     # ensure data is array-like
#     if not hasattr(data, 'shape') or not hasattr(data, 'dtype'):
#         data = np.asanyarray(data)
# 
#     # setup dtype
#     kw_dtype = kwargs.get('dtype')
#     if kw_dtype is None:
#         kwargs['dtype'] = data.dtype
#     else:
#         kwargs['dtype'] = kw_dtype
# 
#     # setup shape and chunks
#     data_shape, data_chunks = _get_shape_chunks(data)
#     kwargs['shape'] = data_shape
#     kw_chunks = kwargs.get('chunks')
#     if kw_chunks is None:
#         kwargs['chunks'] = data_chunks
#     else:
#         kwargs['chunks'] = kw_chunks
# 
#     # pop read-only to apply after storing the data
#     read_only = kwargs.pop('read_only', False)
# 
#     # instantiate array
#     z = create(**kwargs)
# 
#     # fill with data
#     z[...] = data
# 
#     # set read_only property afterwards
#     z.read_only = read_only
# 
#     return z


import numpy as np
from numcodecs import (BZ2, AsType, Blosc, Categorize, Delta, FixedScaleOffset,
                       PackBits, Quantize, Zlib)
from numpy.testing import assert_array_almost_equal, assert_array_equal
from zarr.creation import array
    from numcodecs import LZMA


compressors = [
    None,
    Zlib(),
    BZ2(),
    Blosc(),
]

try:
except ImportError:  # pragma: no cover
    LZMA = None
else:
    compressors.append(LZMA())


def test_array_with_delta_filter():

    # setup
    astype = 'u1'
    dtype = 'i8'
    filters = [Delta(astype=astype, dtype=dtype)]
    data = np.arange(100, dtype=dtype)

    for compressor in compressors:


# Path: zarr/creation.py
# def array(data, **kwargs):
#     """Create an array filled with `data`.
# 
#     The `data` argument should be a NumPy array or array-like object. For
#     other parameter definitions see :func:`zarr.creation.create`.
# 
#     Examples
#     --------
#     >>> import numpy as np
#     >>> import zarr
#     >>> a = np.arange(100000000).reshape(10000, 10000)
#     >>> z = zarr.array(a, chunks=(1000, 1000))
#     >>> z
#     <zarr.core.Array (10000, 10000) int64>
# 
#     """
# 
#     # ensure data is array-like
#     if not hasattr(data, 'shape') or not hasattr(data, 'dtype'):
#         data = np.asanyarray(data)
# 
#     # setup dtype
#     kw_dtype = kwargs.get('dtype')
#     if kw_dtype is None:
#         kwargs['dtype'] = data.dtype
#     else:
#         kwargs['dtype'] = kw_dtype
# 
#     # setup shape and chunks
#     data_shape, data_chunks = _get_shape_chunks(data)
#     kwargs['shape'] = data_shape
#     kw_chunks = kwargs.get('chunks')
#     if kw_chunks is None:
#         kwargs['chunks'] = data_chunks
#     else:
#         kwargs['chunks'] = kw_chunks
# 
#     # pop read-only to apply after storing the data
#     read_only = kwargs.pop('read_only', False)
# 
#     # instantiate array
#     z = create(**kwargs)
# 
#     # fill with data
#     z[...] = data
# 
#     # set read_only property afterwards
#     z.read_only = read_only
# 
#     return z


# Path: zarr/tests/test_filters.py
import numpy as np
from numcodecs import (BZ2, AsType, Blosc, Categorize, Delta, FixedScaleOffset,
                       PackBits, Quantize, Zlib)
from numpy.testing import assert_array_almost_equal, assert_array_equal
from zarr.creation import array
    from numcodecs import LZMA



compressors = [
    None,
    Zlib(),
    BZ2(),
    Blosc(),
]

try:
except ImportError:  # pragma: no cover
    LZMA = None
else:
    compressors.append(LZMA())


def test_array_with_delta_filter():

    # setup
    astype = 'u1'
    dtype = 'i8'
    filters = [Delta(astype=astype, dtype=dtype)]
    data = np.arange(100, dtype=dtype)

    for compressor in compressors:


        a = array(data, chunks=10, compressor=compressor, filters=filters)