The xarray package in python seems to use "lazy loading" to point to structured data on the disk (e.g. netCDF, HDF5), then loads the data into memory only "when necessary." How can I check whether a given Dataset or DataArray object in an interactive python session or in a python script is actually "loaded?"
Ideally, something like
import xarray as xr
dataset = xr.open_dataset('data.nc')
dataset.is_loaded() # is it loaded into memory?
Not sure if this is a meaningful question, but want to be able to safely and confidently control this behavior for giant datasets, so the whole file doesn't get unnecessarily read.