Deltares / xugrid

Xarray and unstructured grids
https://deltares.github.io/xugrid/
MIT License
58 stars 8 forks source link

Implement __enter__ and __exit__; enable with blocks #170

Open Huite opened 10 months ago

Huite commented 10 months ago

I might've investigated this before, but if I'm not mistaken a with block like this currently does not close:

with xu.open_dataset(path) as uds:
     print(uds)

I'm under the impression that this does work for xarray DataArrays and Datasets.