home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 437940426

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
437940426 MDU6SXNzdWU0Mzc5NDA0MjY= 2923 Calling max() on a stacked dimension raises exception 9948595 closed 0     1 2019-04-27T12:50:01Z 2019-06-27T16:06:55Z 2019-06-27T16:06:55Z CONTRIBUTOR      

Code Sample, a copy-pastable example if possible

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

python import numpy as np import xarray as xr data2 = np.random.randn(3,100, 4) da = xr.DataArray( data2, name='value', dims=['replicate', 'rsample', 'exp'], coords=dict(replicate=[0,1,2], exp=['a', 'b', 'c', 'd'], rsample=list(range(100)))) da2 = da.stack(sample=('replicate', 'rsample')) da2.sample.max()

Problem description

Calling max() on a stacked dimension raises the exception ValueError: dimensions () must have the same length as the number of data dimensions, ndim=1

Expected Output

Maximum value of selected dimension. i.e an index I can use with loc e.g. da2.loc['a', da2.sample.max()] that is da2.loc['a', (2,99)]

So I guess I'm expecting something like: <xarray.DataArray 'sample' ()> array((2, 99), dtype=object) This works: da2.loc['a', xr.DataArray((2,99), dims=(), name='sample')]

Output of xr.show_versions()

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.15.0-47-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.4 libnetcdf: 4.6.1

xarray: 0.12.1 pandas: 0.24.2 numpy: 1.15.4 scipy: 1.2.1 netCDF4: 1.4.2 pydap: None h5netcdf: None h5py: 2.9.0 Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.2.1 dask: 1.2.0 distributed: 1.27.0 matplotlib: 3.0.3 cartopy: None seaborn: 0.9.0 setuptools: 40.6.3 pip: 18.1 conda: 4.6.14 pytest: None IPython: 7.4.0 sphinx: 2.0.1

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2923/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
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.67ms · About: xarray-datasette