home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 599993415

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
599993415 MDU6SXNzdWU1OTk5OTM0MTU= 3972 Variable objects not displayable in notebook 9948595 closed 0     2 2020-04-15T03:32:13Z 2020-04-29T15:54:23Z 2020-04-29T15:54:23Z CONTRIBUTOR      

class Variable subclassesAbstractArray which has a _repr_html_ method so variable objects should display in a notebook.

But this fails with a AttributeError: 'Variable' object has no attribute 'variable':

python from os.path import join,dirname import xarray as xr ds=join(dirname(xr.__file__), 'tests/data/bears.nc') xr.open_dataset(ds).variables['cross']

Fix:

change line 186 in xarray.core.formatting_html.py:: array_section from python preview = escape(inline_variable_array_repr(obj.variable, max_width=70)) to (because obj is a variable):

python preview = escape(inline_variable_array_repr(obj.variable if hasattr(obj, "variable") else obj, max_width=70)) I can make a PR if you like.

``` INSTALLED VERSIONS


commit: None python: 3.7.6 | packaged by conda-forge | (default, Mar 23 2020, 23:03:20) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.3.0-46-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_AU.UTF-8 LOCALE: en_AU.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.4

xarray: 0.15.1 pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.1.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.14.0 distributed: 2.6.0 matplotlib: 3.2.1 cartopy: None seaborn: 0.10.0 numbagg: None setuptools: 46.1.3.post20200325 pip: 20.0.2 conda: 4.8.3 pytest: 5.4.1 IPython: 7.13.0 sphinx: 2.2.1 ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3972/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

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