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

Function datatree_from_dict_with_io_cleanup

xarray/backends/common.py:276–286  ·  view source on GitHub ↗

DataTree.from_dict with file clean-up.

(groups_dict: Mapping[str, Dataset])

Source from the content-addressed store, hash-verified

274
275
276def datatree_from_dict_with_io_cleanup(groups_dict: Mapping[str, Dataset]) -> DataTree:
277 """DataTree.from_dict with file clean-up."""
278 try:
279 tree = DataTree.from_dict(groups_dict)
280 except Exception:
281 for ds in groups_dict.values():
282 ds.close()
283 raise
284 for path, ds in groups_dict.items():
285 tree[path].set_close(ds._close)
286 return tree
287
288
289def robust_getitem(array, key, catch=Exception, max_retries=6, initial_delay=500):

Callers 4

open_datatreeMethod · 0.90
open_datatreeMethod · 0.90
open_datatreeMethod · 0.90
open_datatreeMethod · 0.90

Calls 5

itemsMethod · 0.80
from_dictMethod · 0.45
valuesMethod · 0.45
closeMethod · 0.45
set_closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…