xarray/backends/api.py
def to_zarr(
    dataset,
    store=None,
    chunk_store=None,
    mode=None,
    synchronizer=None,
    group=None,
    encoding=None,
    compute=True,
    consolidated=False,
    append_dim=None,
):
    """This function creates an appropriate datastore for writing a dataset to
    a zarr ztore

    See `Dataset.to_zarr` for full API docs.
    """
    if isinstance(store, Path):
        store = str(store)
    if isinstance(chunk_store, Path):
        chunk_store = str(store)
    if encoding is None:
        encoding = {}

    # validate Dataset keys, DataArray names, and attr keys/values
    _validate_dataset_names(dataset)
    _validate_attrs(dataset)

    if mode == "a":
        _validate_datatypes_for_zarr_append(dataset)
        _validate_append_dim_and_encoding(
            dataset,
            store,
            append_dim,
            group=group,
            consolidated=consolidated,
            encoding=encoding,
        )

    zstore = backends.ZarrStore.open_group(
        store=store,
        mode=mode,
        synchronizer=synchronizer,
        group=group,
        consolidate_on_close=consolidated,
        chunk_store=chunk_store,
    )
    zstore.append_dim = append_dim
    writer = ArrayWriter()
    # TODO: figure out how to properly handle unlimited_dims
    dump_to_store(dataset, zstore, writer, encoding=encoding)
    writes = writer.sync(compute=compute)

    if compute:
        _finalize_store(writes, zstore)
    else:
        import dask

        return dask.delayed(_finalize_store)(writes, zstore)

    return zstore
This function creates an appropriate datastore for writing a dataset to
    a zarr ztore

    See `Dataset.to_zarr` for full API docs.
    
This function creates an appropriate datastore for writing a dataset to
a zarr ztore

See `Dataset.to_zarr` for full API docs.
This function creates an appropriate datastore for writing a dataset to a zarr ztore See ` Dataset . to_zarr ` for full API docs .
def to_zarr(
    dataset,
    store=None,
    chunk_store=None,
    mode=None,
    synchronizer=None,
    group=None,
    encoding=None,
    compute=True,
    consolidated=False,
    append_dim=None,
):
    if isinstance(store, Path):
        store = str(store)
    if isinstance(chunk_store, Path):
        chunk_store = str(store)
    if encoding is None:
        encoding = {}
    _validate_dataset_names(dataset)
    _validate_attrs(dataset)
    if mode == "a":
        _validate_datatypes_for_zarr_append(dataset)
        _validate_append_dim_and_encoding(
            dataset,
            store,
            append_dim,
            group=group,
            consolidated=consolidated,
            encoding=encoding,
        )
    zstore = backends.ZarrStore.open_group(
        store=store,
        mode=mode,
        synchronizer=synchronizer,
        group=group,
        consolidate_on_close=consolidated,
        chunk_store=chunk_store,
    )
    zstore.append_dim = append_dim
    writer = ArrayWriter()
    dump_to_store(dataset, zstore, writer, encoding=encoding)
    writes = writer.sync(compute=compute)
    if compute:
        _finalize_store(writes, zstore)
    else:
        import dask
        return dask.delayed(_finalize_store)(writes, zstore)
    return zstore
def to_zarr ( dataset , store = None , chunk_store = None , mode = None , synchronizer = None , group = None , encoding = None , compute = True , consolidated = False , append_dim = None , ) : if isinstance ( store , Path ) : store = str ( store ) if isinstance ( chunk_store , Path ) : chunk_store = str ( store ) if encoding is None : encoding = { } _validate_dataset_names ( dataset ) _validate_attrs ( dataset ) if mode == "a" : _validate_datatypes_for_zarr_append ( dataset ) _validate_append_dim_and_encoding ( dataset , store , append_dim , group = group , consolidated = consolidated , encoding = encoding , ) zstore = backends . ZarrStore . open_group ( store = store , mode = mode , synchronizer = synchronizer , group = group , consolidate_on_close = consolidated , chunk_store = chunk_store , ) zstore . append_dim = append_dim writer = ArrayWriter ( ) dump_to_store ( dataset , zstore , writer , encoding = encoding ) writes = writer . sync ( compute = compute ) if compute : _finalize_store ( writes , zstore ) else : import dask return dask . delayed ( _finalize_store ) ( writes , zstore ) return zstore
This function creates an appropriate datastore for writing a dataset to
a zarr ztore
This function creates an appropriate datastore for writing a dataset to a zarr ztore
"""This function creates an appropriate datastore for writing a dataset to
    a zarr ztore

    See `Dataset.to_zarr` for full API docs.
    """ # validate Dataset keys, DataArray names, and attr keys/values # TODO: figure out how to properly handle unlimited_dims
dataset
store
chunk_store
mode
synchronizer
group
encoding
compute
consolidated
append_dim