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/6493#issuecomment-1105918933,https://api.github.com/repos/pydata/xarray/issues/6493,1105918933,IC_kwDOAMm_X85B6vvV,9312831,2022-04-22T01:40:46Z,2022-04-22T01:40:46Z,NONE,"Oh, I see the release of xgcm of 0.7.0. It is really a great update! I also find the `boundary condition` and `grid_ufunc` examples on the docs (still 0.6.0), which indeed may solve many of my problems. The `grid-ufunc` provides flexible building blocks for complicated cases. I'll spend some times trying the new version, re-think my cases in this great architecture, and report soon if I have problems with that. Thanks to you guys' great work! A quite question is that has the xgcm been refactored using `grid_ufunc`? (I hope I could catch up with you guys).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1206634329 https://github.com/pydata/xarray/issues/6493#issuecomment-1102107532,https://api.github.com/repos/pydata/xarray/issues/6493,1102107532,IC_kwDOAMm_X85BsNOM,9312831,2022-04-19T05:43:05Z,2022-04-19T05:43:05Z,NONE,"Thanks to you guys here @Illviljan @TomNicholas @dcherian. I've been a user of xgcm for quite a time. So you can see my proposal just follows the style of xgcm. I am working on my [`xinvert`](https://github.com/miniufo/xinvert) package, in which I may need some partial differential calculations. This can be done by `xgcm` quite well, but I am still worried about the metrics concept introduced by xgcm. I think this should be discussed over xgcm's repo. For most of the cases, lat/lon-type grids are uniform and on the Arakawa A grid. So xarray's `differentiate()` is good enough with `pad()` (although it is experimental) for BCs, as suggested by @dcherian. We don't need stagged grid point and metrics, as in xgcm, but centered difference (a[i+1]-a[i-1]) will be good enough for A grid. This is simpler and do not make heavy dependence of the third-party package like xgcm. I'll give a try with `differentiate()` and `pad()` to implement grad/div/vor... But some designs in xgcm also inspire me to make things much natural.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1206634329 https://github.com/pydata/xarray/issues/6399#issuecomment-1074983948,https://api.github.com/repos/pydata/xarray/issues/6399,1074983948,IC_kwDOAMm_X85AEvQM,9312831,2022-03-22T10:14:17Z,2022-03-22T10:14:17Z,NONE,"OK, thanks again. This is clear to me now. So this should be a `matplotlib` problem. I am closing this now.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1176172498 https://github.com/pydata/xarray/issues/6399#issuecomment-1074939174,https://api.github.com/repos/pydata/xarray/issues/6399,1074939174,IC_kwDOAMm_X85AEkUm,9312831,2022-03-22T09:39:10Z,2022-03-22T09:39:10Z,NONE,"Thanks @mathause , that works well. After searching the doc on `infer_intervals`, I still don't know why this is happening.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1176172498 https://github.com/pydata/xarray/issues/4011#issuecomment-621317315,https://api.github.com/repos/pydata/xarray/issues/4011,621317315,MDEyOklzc3VlQ29tbWVudDYyMTMxNzMxNQ==,9312831,2020-04-29T16:20:54Z,2020-04-29T16:20:54Z,NONE,"Thanks @dcherian. I use the `get_group` function and solve my problem. But a warning arises at the line `if name not in self.groups:` as: `DeprecationWarning: elementwise comparison failed; this will raise an error in the future`. When the group contains nothing, I may assign `nan` or `0` to the corresponding bin. If it is dropped silently, then I need to find out which bin is missing its group. I like this PR #1027 by Ryan with a kwarg `drop_empty_bins` but not sure this option is eventually merged into master or not.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,607718350 https://github.com/pydata/xarray/issues/4011#issuecomment-620581409,https://api.github.com/repos/pydata/xarray/issues/4011,620581409,MDEyOklzc3VlQ29tbWVudDYyMDU4MTQwOQ==,9312831,2020-04-28T12:41:43Z,2020-04-28T12:41:43Z,NONE,"When I use `counts = grouped.count()`, I can get all the bins and counts in the correct order, and the empty bin just returns nan. But I don't want aggregation operations here. I need the samples in each group to index another array. Maybe this is not the best solution. But my case do need all the groups in the same order as the given bins, including possible empty ones.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,607718350 https://github.com/pydata/xarray/issues/3896#issuecomment-605456013,https://api.github.com/repos/pydata/xarray/issues/3896,605456013,MDEyOklzc3VlQ29tbWVudDYwNTQ1NjAxMw==,9312831,2020-03-28T14:39:06Z,2020-03-28T14:39:06Z,NONE,">Minor comment / nit: you don't really need the astype(np.float), the result should already be of dtype float since there are missing values after the rolling sum. You're right. That is used for debuging the intermediate results. Thanks again @keewis @max-sixty. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588126763 https://github.com/pydata/xarray/issues/3896#issuecomment-605395619,https://api.github.com/repos/pydata/xarray/issues/3896,605395619,MDEyOklzc3VlQ29tbWVudDYwNTM5NTYxOQ==,9312831,2020-03-28T05:02:59Z,2020-03-28T05:02:59Z,NONE,"Hi @keewis, this is really a smart way, using `rolling` twice. I've refactored the code slightly as: ```python def continuous_meet(cond, count, dim): """""" Continuously meet a given condition along a dimension. """""" _found = cond.rolling(dim={dim:count}, center=True).sum().fillna(0).astype(np.float) detected = ( _found.rolling(dim={dim:count}, center=True) .reduce(lambda a, axis: (a == count).any(axis=axis)) .fillna(False) .astype(bool) ) if count % 2 == 0: return detected.shift({dim:-1}).fillna(False) return detected sst = xr.DataArray( np.array( [0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 0., 0., 1., 0., 0., 1., 1., 1., 1., 1., 1., 0., 0., 0.] ), dims=""time"", coords={""time"": np.arange(24)}, name=""sst"", ) ElNino = continuous_meet(sst > 0.5, count=5, dim='time') sst.plot.step(linewidth=3) sst.where(ElNino).plot.step(linewidth=2) ``` Note that when `count` is a even number, truly centered `rolling` cannot be obtained. So we need to `shift` the result by -1. Is this perfect? I didn't check the performance.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588126763 https://github.com/pydata/xarray/issues/3896#issuecomment-604776072,https://api.github.com/repos/pydata/xarray/issues/3896,604776072,MDEyOklzc3VlQ29tbWVudDYwNDc3NjA3Mg==,9312831,2020-03-27T02:01:54Z,2020-03-27T02:01:54Z,NONE,"Hi @max-sixty, thanks for your kind help. But I found it works not as I expected. If the SST has the values `[..., 0, 0, 1, 1, 1, 1, 1, 0, 0, ...]`, then the method you suggested will give `[..., F, F, F, F, T, F, F, F, F, ...]`. That is only one `True` for a 5 consecutive 1s. But I would expect five `True` like `[..., F, F, T, T, T, T, T, F, F, ...]`. Any suggestion?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588126763