title: How can I check whether a python xarray Dataset/DataArray object is loaded into memory, or still points to data on disk?
body: <p>The <code>xarray</code> package in python seems to use "lazy loading" to point to structured data on the disk (e.g. netCDF, HDF5), then <a href="http://xarray.pydata.org/en/stable/generated/xarray.Dataset.load.html" rel="nofollow noreferrer">loads the data into memory</a> 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?"</p>
  
  <p>Ideally, something like </p>
  
  <pre><code>import xarray as xr
  dataset = xr.open_dataset('data.nc') 
  dataset.is_loaded() # is it loaded into memory?
  </code></pre>
  
  <p>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.</p>