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-825050144,https://api.github.com/repos/pydata/xarray/issues/5205,825050144,MDEyOklzc3VlQ29tbWVudDgyNTA1MDE0NA==,5635139,2021-04-22T17:34:39Z,2021-04-22T17:34:39Z,MEMBER,"I got the sign wrong, corrected: ``` In [4]: lower_inf = lower.where(lower.notnull(), -np.inf) In [5]: da.clip(lower_inf, upper) Out[5]: array([[ 1., 1., 2., 3., 4., 4.], [ 6., 7., 8., 9., 10., 10.], [12., 13., 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 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]: 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]: 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 https://github.com/pydata/xarray/issues/5205#issuecomment-824521012,https://api.github.com/repos/pydata/xarray/issues/5205,824521012,MDEyOklzc3VlQ29tbWVudDgyNDUyMTAxMg==,5635139,2021-04-22T04:02:45Z,2021-04-22T04:02:45Z,MEMBER,"If that's unclear, check out some other issues in the repo and use those as a template for yours.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,864494256 https://github.com/pydata/xarray/issues/5205#issuecomment-824520444,https://api.github.com/repos/pydata/xarray/issues/5205,824520444,MDEyOklzc3VlQ29tbWVudDgyNDUyMDQ0NA==,5635139,2021-04-22T04:00:57Z,2021-04-22T04:00:57Z,MEMBER,"Sure — when you created the issue, there was a template in the text box — could you fill that out?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,864494256 https://github.com/pydata/xarray/issues/5205#issuecomment-824504715,https://api.github.com/repos/pydata/xarray/issues/5205,824504715,MDEyOklzc3VlQ29tbWVudDgyNDUwNDcxNQ==,5635139,2021-04-22T03:08:03Z,2021-04-22T03:08:03Z,MEMBER,"Hi @babameme — please could you fill out the issue template, including formatting the code reasonably?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,864494256