(
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,
application=None,
session=None,
timeout=None,
verify=None,
user_charset=None,
checksums=True,
)
| 341 | return datatree_from_dict_with_io_cleanup(groups_dict) |
| 342 | |
| 343 | def open_groups_as_dict( |
| 344 | self, |
| 345 | filename_or_obj: T_PathFileOrDataStore, |
| 346 | *, |
| 347 | mask_and_scale=True, |
| 348 | decode_times=True, |
| 349 | concat_characters=True, |
| 350 | decode_coords=True, |
| 351 | drop_variables: str | Iterable[str] | None = None, |
| 352 | use_cftime=None, |
| 353 | decode_timedelta=None, |
| 354 | group: str | None = None, |
| 355 | application=None, |
| 356 | session=None, |
| 357 | timeout=None, |
| 358 | verify=None, |
| 359 | user_charset=None, |
| 360 | checksums=True, |
| 361 | ) -> dict[str, Dataset]: |
| 362 | from xarray.core.treenode import NodePath |
| 363 | |
| 364 | filename_or_obj = _normalize_path(filename_or_obj) |
| 365 | store = PydapDataStore.open( |
| 366 | url=filename_or_obj, |
| 367 | application=application, |
| 368 | session=session, |
| 369 | timeout=timeout, |
| 370 | verify=verify, |
| 371 | user_charset=user_charset, |
| 372 | checksums=checksums, |
| 373 | ) |
| 374 | |
| 375 | # Check for a group and make it a parent if it exists |
| 376 | if group: |
| 377 | parent = str(NodePath("/") / NodePath(group)) |
| 378 | else: |
| 379 | parent = str(NodePath("/")) |
| 380 | |
| 381 | groups_dict = {} |
| 382 | group_names = [parent] |
| 383 | # construct fully qualified path to group |
| 384 | try: |
| 385 | # this works for pydap >= 3.5.1 |
| 386 | Groups = store.ds[parent].groups() |
| 387 | except AttributeError: |
| 388 | # THIS IS ONLY NEEDED FOR `pydap == 3.5.0` |
| 389 | # `pydap>= 3.5.1` has a new method `groups()` |
| 390 | # that returns a dict of group names and their paths |
| 391 | def group_fqn(store, path=None, g_fqn=None) -> dict[str, str]: |
| 392 | """To be removed for pydap > 3.5.0. |
| 393 | Derives the fully qualifying name of a Group.""" |
| 394 | from pydap.model import GroupType |
| 395 | |
| 396 | if not path: |
| 397 | path = "/" # parent |
| 398 | if not g_fqn: |
| 399 | g_fqn = {} |
| 400 | groups = [ |
no test coverage detected