issue_comments: 824556068
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/5205#issuecomment-824556068 | https://api.github.com/repos/pydata/xarray/issues/5205 | 824556068 | MDEyOklzc3VlQ29tbWVudDgyNDU1NjA2OA== | 5635139 | 2021-04-22T05:45:07Z | 2021-04-22T05:45:07Z | MEMBER | It's still not great but it's sufficient! What you want isn't available in numpy, the library we wrap: ```python In [3]: da.values.clip(lower.values, upper.values) Out[3]: array([[ 1., 1., 2., 3., 4., 4.], [ 6., 7., 8., 9., 10., 10.], [nan, nan, nan, nan, nan, nan]]) ``` But I think what you want is this: ```python In [11]: lower_inf = lower.where(lower.notnull(), np.inf) In [14]: lower_inf Out[14]: <xarray.DataArray (x: 3, y: 6)> array([[ 1., 1., 1., 1., 1., 1.], [ 2., 2., 2., 2., 2., 2.], [inf, inf, inf, inf, inf, inf]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 5 In [12]: da.clip(lower_inf, upper) Out[12]: <xarray.DataArray (x: 3, y: 6)> array([[ 1., 1., 2., 3., 4., 4.], [ 6., 7., 8., 9., 10., 10.], [14., 14., 14., 14., 14., 14.]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 5 * ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
864494256 |