I think cdms should support context management with the with keyword. So the idea is to have something similar to how files are handled in Python:
with cdms2.open('precc.nc') as precc_file:
var = precc_file('PRECC')
This automatically has exception handling and automatically closes the file after leaving the scope. All that is needed is to implement __enter__() and __exit__() functions.
I think cdms should support context management with the
withkeyword. So the idea is to have something similar to how files are handled in Python:This automatically has exception handling and automatically closes the file after leaving the scope. All that is needed is to implement
__enter__()and__exit__()functions.