home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 410412290

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2340#issuecomment-410412290 https://api.github.com/repos/pydata/xarray/issues/2340 410412290 MDEyOklzc3VlQ29tbWVudDQxMDQxMjI5MA== 90008 2018-08-04T01:26:08Z 2018-08-04T03:21:50Z CONTRIBUTOR

I guess I probably erroneously assumed a "scalar" was a 1x1x1x1....x1 array. It really isn't. It is just a scalar. When the number of dimensions hits 0, an IndexVariable, it automatically gets demoted to a Variable somewhere here https://github.com/pydata/xarray/blob/56381ef444c5e699443e8b4e08611060ad5c9507/xarray/core/variable.py#L465

I guess maybe: 1. Maybe what I'm looking for is a Dataset 2. Maybe sticky dimensions would be nice to have? We could maybe flag those dimensions as being sticky, and even if you select a single element, it would be maintained as a dimension. Is this already possible?

My old thinking @shoyer I feel like this solution: https://github.com/hmaarrfk/xarray/pull/1/files#diff-921db548d18a549f6381818ed08298c9R2144 should work. But I kinda understand why it doesn't. That solution moves the insertion to the "dataset level", then uses list comprehension to create the right order for the arrays contained within the dataset. should work, but when I try it, xarray won't even issue the repr ```python Traceback (most recent call last): File "C:\Users\Mark\Miniconda3\envs\owl\lib\site-packages\IPython\core\formatters.py", line 702, in __call__ printer.pretty(obj) File "C:\Users\Mark\Miniconda3\envs\owl\lib\site-packages\IPython\lib\pretty.py", line 400, in pretty return _repr_pprint(obj, self, cycle) File "C:\Users\Mark\Miniconda3\envs\owl\lib\site-packages\IPython\lib\pretty.py", line 695, in _repr_pprint output = repr(obj) File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 66, in __repr__ return ensure_valid_repr(self.__unicode__()) File "c:\users\mark\git\xarray\xarray\core\dataset.py", line 1190, in __unicode__ return formatting.dataset_repr(self) File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 455, in dataset_repr summary.append(coords_repr(ds.coords, col_width=col_width)) File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 350, in coords_repr summarizer=summarize_coord, col_width=col_width) File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 332, in _mapping_repr summary += [summarizer(k, v, col_width) for k, v in mapping.items()] File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 332, in <listcomp> summary += [summarizer(k, v, col_width) for k, v in mapping.items()] File "c:\users\mark\git\xarray\xarray\core\formatting.py", line 279, in summarize_coord coord = var.variable.to_index_variable() File "c:\users\mark\git\xarray\xarray\core\variable.py", line 406, in to_index_variable encoding=self._encoding, fastpath=True) File "c:\users\mark\git\xarray\xarray\core\variable.py", line 1624, in __init__ type(self).__name__) ValueError: IndexVariable objects must be 1-dimensional ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  347558405
Powered by Datasette · Queries took 0.566ms · About: xarray-datasette