MCPcopy
hub / github.com/pydata/xarray / open_groups_as_dict

Method open_groups_as_dict

xarray/backends/zarr.py:1803–1864  ·  view source on GitHub ↗
(
        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,
    )

Source from the content-addressed store, hash-verified

1801 return datatree_from_dict_with_io_cleanup(groups_dict)
1802
1803 def open_groups_as_dict(
1804 self,
1805 filename_or_obj: T_PathFileOrDataStore,
1806 *,
1807 mask_and_scale=True,
1808 decode_times=True,
1809 concat_characters=True,
1810 decode_coords=True,
1811 drop_variables: str | Iterable[str] | None = None,
1812 use_cftime=None,
1813 decode_timedelta=None,
1814 group: str | None = None,
1815 mode="r",
1816 synchronizer=None,
1817 consolidated=None,
1818 chunk_store=None,
1819 storage_options=None,
1820 zarr_version=None,
1821 zarr_format=None,
1822 ) -> dict[str, Dataset]:
1823 filename_or_obj = _normalize_path(filename_or_obj)
1824
1825 # Check for a group and make it a parent if it exists
1826 if group:
1827 parent = str(NodePath("/") / NodePath(group))
1828 else:
1829 parent = str(NodePath("/"))
1830
1831 stores = ZarrStore.open_store(
1832 filename_or_obj,
1833 group=parent,
1834 mode=mode,
1835 synchronizer=synchronizer,
1836 consolidated=consolidated,
1837 consolidate_on_close=False,
1838 chunk_store=chunk_store,
1839 storage_options=storage_options,
1840 zarr_version=zarr_version,
1841 zarr_format=zarr_format,
1842 )
1843
1844 groups_dict = {}
1845 for path_group, store in stores.items():
1846 store_entrypoint = StoreBackendEntrypoint()
1847
1848 with close_on_error(store):
1849 group_ds = store_entrypoint.open_dataset(
1850 store,
1851 mask_and_scale=mask_and_scale,
1852 decode_times=decode_times,
1853 concat_characters=concat_characters,
1854 decode_coords=decode_coords,
1855 drop_variables=drop_variables,
1856 use_cftime=use_cftime,
1857 decode_timedelta=decode_timedelta,
1858 )
1859 if group:
1860 group_name = str(NodePath(path_group).relative_to(parent))

Callers 1

open_datatreeMethod · 0.95

Calls 8

open_datasetMethod · 0.95
_normalize_pathFunction · 0.90
NodePathClass · 0.90
close_on_errorFunction · 0.90
open_storeMethod · 0.80
itemsMethod · 0.80
relative_toMethod · 0.80

Tested by

no test coverage detected