Skip to content

add use_zarr_fill_value_as_mask in open_datatree for Zarr Stores #11361

@vincentsarago

Description

@vincentsarago

Maybe I'm totally mistaken but it seems that use_zarr_fill_value_as_mask option is not available when using xarray.open_datatree for a Zarr store, while it's available for open_dataset

xarray/xarray/backends/zarr.py

Lines 1770 to 1808 in d022da5

def open_datatree(
self,
filename_or_obj: T_PathFileOrDataStore,
*,
mask_and_scale=True,
decode_times=True,
concat_characters=True,
decode_coords=True,
drop_variables: str | Iterable[str] | None = None,
use_cftime=None,
decode_timedelta=None,
group: str | None = None,
mode="r",
synchronizer=None,
consolidated=None,
chunk_store=None,
storage_options=None,
zarr_version=None,
zarr_format=None,
) -> DataTree:
filename_or_obj = _normalize_path(filename_or_obj)
groups_dict = self.open_groups_as_dict(
filename_or_obj=filename_or_obj,
mask_and_scale=mask_and_scale,
decode_times=decode_times,
concat_characters=concat_characters,
decode_coords=decode_coords,
drop_variables=drop_variables,
use_cftime=use_cftime,
decode_timedelta=decode_timedelta,
group=group,
mode=mode,
synchronizer=synchronizer,
consolidated=consolidated,
chunk_store=chunk_store,
storage_options=storage_options,
zarr_version=zarr_version,
zarr_format=zarr_format,
)

Looking at

xarray/xarray/backends/zarr.py

Lines 1840 to 1851 in d022da5

stores = ZarrStore.open_store(
filename_or_obj,
group=parent,
mode=mode,
synchronizer=synchronizer,
consolidated=consolidated,
consolidate_on_close=False,
chunk_store=chunk_store,
storage_options=storage_options,
zarr_version=zarr_version,
zarr_format=zarr_format,
)

it seems that we should be able to forward a use_zarr_fill_value_as_mask option

cc @d-v-b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions