@@ -2439,9 +2439,149 @@ def require_groups(self, *names: str) -> tuple[Group, ...]:
24392439 """
24402440 return tuple (map (Group , self ._sync (self ._async_group .require_groups (* names ))))
24412441
2442- def create (self , * args : Any , ** kwargs : Any ) -> Array :
2443- # Backwards compatibility for 2.x
2444- return self .create_array (* args , ** kwargs )
2442+ def create (
2443+ self ,
2444+ name : str ,
2445+ * ,
2446+ shape : ShapeLike | None = None ,
2447+ dtype : ZDTypeLike | None = None ,
2448+ data : np .ndarray [Any , np .dtype [Any ]] | None = None ,
2449+ chunks : tuple [int , ...] | Literal ["auto" ] = "auto" ,
2450+ shards : ShardsLike | None = None ,
2451+ filters : FiltersLike = "auto" ,
2452+ compressors : CompressorsLike = "auto" ,
2453+ compressor : CompressorLike = "auto" ,
2454+ serializer : SerializerLike = "auto" ,
2455+ fill_value : Any | None = DEFAULT_FILL_VALUE ,
2456+ order : MemoryOrder | None = None ,
2457+ attributes : dict [str , JSON ] | None = None ,
2458+ chunk_key_encoding : ChunkKeyEncodingLike | None = None ,
2459+ dimension_names : DimensionNames = None ,
2460+ storage_options : dict [str , Any ] | None = None ,
2461+ overwrite : bool = False ,
2462+ config : ArrayConfigLike | None = None ,
2463+ write_data : bool = True ,
2464+ ) -> Array :
2465+ """Create an array within this group.
2466+
2467+ This method lightly wraps :func:`zarr.core.array.create_array`.
2468+
2469+ Parameters
2470+ ----------
2471+ name : str
2472+ The name of the array relative to the group. If ``path`` is ``None``, the array will be located
2473+ at the root of the store.
2474+ shape : ShapeLike, optional
2475+ Shape of the array. Must be ``None`` if ``data`` is provided.
2476+ dtype : npt.DTypeLike | None
2477+ Data type of the array. Must be ``None`` if ``data`` is provided.
2478+ data : Array-like data to use for initializing the array. If this parameter is provided, the
2479+ ``shape`` and ``dtype`` parameters must be ``None``.
2480+ chunks : tuple[int, ...], optional
2481+ Chunk shape of the array.
2482+ If not specified, default are guessed based on the shape and dtype.
2483+ shards : tuple[int, ...], optional
2484+ Shard shape of the array. The default value of ``None`` results in no sharding at all.
2485+ filters : Iterable[Codec] | Literal["auto"], optional
2486+ Iterable of filters to apply to each chunk of the array, in order, before serializing that
2487+ chunk to bytes.
2488+
2489+ For Zarr format 3, a "filter" is a codec that takes an array and returns an array,
2490+ and these values must be instances of :class:`zarr.abc.codec.ArrayArrayCodec`, or a
2491+ dict representations of :class:`zarr.abc.codec.ArrayArrayCodec`.
2492+
2493+ For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the
2494+ the order if your filters is consistent with the behavior of each filter.
2495+
2496+ The default value of ``"auto"`` instructs Zarr to use a default used based on the data
2497+ type of the array and the Zarr format specified. For all data types in Zarr V3, and most
2498+ data types in Zarr V2, the default filters are empty. The only cases where default filters
2499+ are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
2500+ `:class:zarr.dtype.VariableLengthUTF8` or `:class:zarr.dtype.VariableLengthUTF8`. In these cases,
2501+ the default filters contains a single element which is a codec specific to that particular data type.
2502+
2503+ To create an array with no filters, provide an empty iterable or the value ``None``.
2504+ compressors : Iterable[Codec], optional
2505+ List of compressors to apply to the array. Compressors are applied in order, and after any
2506+ filters are applied (if any are specified) and the data is serialized into bytes.
2507+
2508+ For Zarr format 3, a "compressor" is a codec that takes a bytestream, and
2509+ returns another bytestream. Multiple compressors my be provided for Zarr format 3.
2510+ If no ``compressors`` are provided, a default set of compressors will be used.
2511+ These defaults can be changed by modifying the value of ``array.v3_default_compressors``
2512+ in :mod:`zarr.core.config`.
2513+ Use ``None`` to omit default compressors.
2514+
2515+ For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may
2516+ be provided for Zarr format 2.
2517+ If no ``compressor`` is provided, a default compressor will be used.
2518+ in :mod:`zarr.core.config`.
2519+ Use ``None`` to omit the default compressor.
2520+ compressor : Codec, optional
2521+ Deprecated in favor of ``compressors``.
2522+ serializer : dict[str, JSON] | ArrayBytesCodec, optional
2523+ Array-to-bytes codec to use for encoding the array data.
2524+ Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion.
2525+ If no ``serializer`` is provided, a default serializer will be used.
2526+ These defaults can be changed by modifying the value of ``array.v3_default_serializer``
2527+ in :mod:`zarr.core.config`.
2528+ fill_value : Any, optional
2529+ Fill value for the array.
2530+ order : {"C", "F"}, optional
2531+ The memory of the array (default is "C").
2532+ For Zarr format 2, this parameter sets the memory order of the array.
2533+ For Zarr format 3, this parameter is deprecated, because memory order
2534+ is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory
2535+ order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``.
2536+ If no ``order`` is provided, a default order will be used.
2537+ This default can be changed by modifying the value of ``array.order`` in :mod:`zarr.core.config`.
2538+ attributes : dict, optional
2539+ Attributes for the array.
2540+ chunk_key_encoding : ChunkKeyEncoding, optional
2541+ A specification of how the chunk keys are represented in storage.
2542+ For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``.
2543+ For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``.
2544+ dimension_names : Iterable[str], optional
2545+ The names of the dimensions (default is None).
2546+ Zarr format 3 only. Zarr format 2 arrays should not use this parameter.
2547+ storage_options : dict, optional
2548+ If using an fsspec URL to create the store, these will be passed to the backend implementation.
2549+ Ignored otherwise.
2550+ overwrite : bool, default False
2551+ Whether to overwrite an array with the same name in the store, if one exists.
2552+ config : ArrayConfig or ArrayConfigLike, optional
2553+ Runtime configuration for the array.
2554+ write_data : bool
2555+ If a pre-existing array-like object was provided to this function via the ``data`` parameter
2556+ then ``write_data`` determines whether the values in that array-like object should be
2557+ written to the Zarr array created by this function. If ``write_data`` is ``False``, then the
2558+ array will be left empty.
2559+
2560+ Returns
2561+ -------
2562+ AsyncArray
2563+ """
2564+ return self .create_array (
2565+ name ,
2566+ shape = shape ,
2567+ dtype = dtype ,
2568+ data = data ,
2569+ chunks = chunks ,
2570+ shards = shards ,
2571+ filters = filters ,
2572+ compressors = compressors ,
2573+ compressor = compressor ,
2574+ serializer = serializer ,
2575+ fill_value = fill_value ,
2576+ order = order ,
2577+ attributes = attributes ,
2578+ chunk_key_encoding = chunk_key_encoding ,
2579+ dimension_names = dimension_names ,
2580+ storage_options = storage_options ,
2581+ overwrite = overwrite ,
2582+ config = config ,
2583+ write_data = write_data ,
2584+ )
24452585
24462586 def create_array (
24472587 self ,
0 commit comments