datatree: Automatically close files using open_datatree context manager #9337
Labels
needs triage
Issue that has not been reviewed by xarray team member
topic-DataTree
Related to the implementation of a DataTree class
What is your issue?
Originally posted by @TomNicholas in xarray-contrib/datatree#93
Attempted implementation in this PR.
In xarray it's possible to automatically close a dataset after opening by opening it using a context manager. From the documentation:
We currently don't have a DataTree.close() method, or any context manager behaviour for open_datatree. To add them presumably we would need to iterate over all file handles (i.e. groups) and close them one by one.
Related to xarray-contrib/datatree#90 @jhamman @thewtex
The text was updated successfully, but these errors were encountered: