home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 634869703

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
634869703 MDU6SXNzdWU2MzQ4Njk3MDM= 4131 Why am I able to load data from a closed dataset? 29104956 closed 0     10 2020-06-08T19:14:46Z 2022-04-05T18:35:06Z 2022-04-05T18:35:06Z NONE      

I don't understand why I am able to open and close a dataset, but then proceed to read data from said dataset.

I can open a 4 GB dataset and promptly close is, and then still access the data within, which appears to still be loading lazily. Does querying a closed dataset automatically reopen it?

MCVE Code Sample

```python import numpy as np import xarray as xr

ds = xr.Dataset({"foo": (("x",), np.random.rand(4,))}, coords={"x": [10, 20, 30, 40]}) ds.to_netcdf("tmp_example.nc") python

data = xr.open_dataset("tmp_example.nc") data.close() data.foo <xarray.DataArray 'foo' (x: 4)> array([0.894788, 0.017935, 0.696086, 0.827004]) Coordinates: * x (x) int64 10 20 30 40 ```

Expected Output

Because netCDF data sets are loaded lazily, I would imagine that, having not been touched when opened, that closing the data set would render it inaccessible

Versions

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.4.0-166-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.2 libnetcdf: 4.6.1 xarray: 0.15.0 pandas: 1.0.3 numpy: 1.16.3 scipy: 1.4.1 netCDF4: 1.4.1 pydap: None h5netcdf: None h5py: 2.8.0 Nio: None zarr: None cftime: 1.1.3 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.14.0 distributed: None matplotlib: 3.0.3 cartopy: None seaborn: None numbagg: None setuptools: 46.1.3.post20200330 pip: 20.0.2 conda: None pytest: 5.4.1 IPython: 7.5.0 sphinx: 2.4.4
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4131/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 10 rows from issue in issue_comments
Powered by Datasette · Queries took 0.746ms · About: xarray-datasette