issue_comments: 610519628
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/3946#issuecomment-610519628 | https://api.github.com/repos/pydata/xarray/issues/3946 | 610519628 | MDEyOklzc3VlQ29tbWVudDYxMDUxOTYyOA== | 35968931 | 2020-04-07T17:29:10Z | 2020-04-07T17:32:59Z | MEMBER | Hi @lanougue , thanks for the suggestion! If I understand correctly, you want to check that all elements are close along one dimension, and if so, then select only one index from that dimension? That seems to me to be two consecutive operations, the first of which is a reduction, and the second is just def reduce_if_constant_along_dim(da, dim): first = da.isel(**{dim: 0}) constant_along_dim = (da == first).all(dim)
print(reduce_if_constant_along_dim(da, dim='x'))
or are you imagining something that applies the above function to every dim, more like: ```python def drop_constant_dims(da): for dim in da.dims: da = reduce_if_constant_along_dim(da, dim) return da print(drop_constant_dims(da))
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
595813283 |