home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 338397633

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/1388#issuecomment-338397633 https://api.github.com/repos/pydata/xarray/issues/1388 338397633 MDEyOklzc3VlQ29tbWVudDMzODM5NzYzMw== 6815844 2017-10-21T13:51:04Z 2017-10-21T13:51:04Z MEMBER

I am thinking again how argmin should work with our new vectorizing indexing #1639 . It would be great if arr.isel(**arr.argmin(dim)) == arr.min(dim) could be satisfied even with a multi-dimensional array, although the behavior is different from numpy.argmin. (Maybe our current min should be replaced by arr.isel(**arr.argmin(dim)) so that it preserves the coordinates.)

(We discussed the name for this new method in #1469 but here I just use argmin for the simplicity.)

For example with a three dimensional array with dims=['x', 'y', 'z'], such as arr = xr.DataArray(np.random.randn(4, 3, 2), dims=['x', 'y', 'z']) I am thinking that... + arr.argmin() would return a xr.Dataset which contains 'x', 'y', 'z' as its data_vars. 1. ds = arr.argmin(dims=None) case: - ds['x'], ds['y'], ds['z'] would be 0d-integers. 2. ds = arr.argmin(dims=['x', 'y']) case: - ds['x'], ds['y'], ds['z'] would be 1d-integer-arrays. - The dimension of these three arrays would be 'z_argmin', where ds['z_argmin'] == arr['z']. 3. ds = arr.argmin(dims='x') case: - ds['x'], ds['y'], ds['z'] would be 2d-integer-arrays. - The dimensions of these three arrays are 'y_argmin' and 'z_argmin', where ds['y_argmin'] == arr['y'] and ds['z_argmin'] == arr['z'].

The above proposal for ii (and iii) is not quite clean, as if it is used as an argument of isel, it appends a new coordinate 'z_argmin', which is just a duplicate of 'arr['z']', i.e. arr.isel(**arr.argmin(dims=['x', 'y']))['z_argmin'] == arr['z'].

Any thoughts are welcome.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  224878728
Powered by Datasette · Queries took 0.855ms · About: xarray-datasette