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-1102803306,https://api.github.com/repos/pydata/xarray/issues/6493,1102803306,IC_kwDOAMm_X85Bu3Fq,35968931,2022-04-19T15:39:07Z,2022-04-19T15:39:07Z,MEMBER,"> On the xarray side, I think we should just recommend composing pad with diff or differentiate. This is essentially just what we're doing in xGCM. > We'll need to add a ""extrapolate"" option for the padded coordinate variables for this to work. We also ran into this, and would use it if there were an extrapolate option for xarray's pad.","{""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-1102801329,https://api.github.com/repos/pydata/xarray/issues/6493,1102801329,IC_kwDOAMm_X85Bu2mx,35968931,2022-04-19T15:37:11Z,2022-04-19T15:37:11Z,MEMBER,"> I am still worried about the metrics concept introduced by xgcm. I think this should be discussed over xgcm's repo. Please do raise an issue there! > 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. The new ""grid ufuncs"" functionality in xGCM (hopefully being released this week) allows you to write grid-aware functions that can do centered operations exactly like this. e.g. see here https://github.com/xgcm/xgcm/blob/cb7feccb9e4331e71da6f034cbee13f43c3de76d/xgcm/test/test_grid_ufunc.py#L614 > This is simpler and do not make heavy dependence of the third-party package like xgcm. I do sympathise with this though. > But some designs in xgcm also inspire me to make things much natural. If you tell us exactly what it is you're trying to do then there might be a neat solution. cc @jbusecke ","{""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-1101496021,https://api.github.com/repos/pydata/xarray/issues/6493,1101496021,IC_kwDOAMm_X85Bp37V,2448579,2022-04-18T15:24:53Z,2022-04-18T15:24:53Z,MEMBER,"+1 for xgcm. On the xarray side, I think we should just recommend composing `pad` with `diff` or `differentiate`. We'll need to add a ""extrapolate"" option for the padded coordinate variables for this to work.","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1206634329 https://github.com/pydata/xarray/issues/6493#issuecomment-1101480251,https://api.github.com/repos/pydata/xarray/issues/6493,1101480251,IC_kwDOAMm_X85Bp0E7,35968931,2022-04-18T15:07:10Z,2022-04-18T15:07:10Z,MEMBER,@miniufo have you seen [xGCM](https://github.com/xgcm/xgcm)? Your problem might be more easily solved using that library instead.,"{""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-1101150791,https://api.github.com/repos/pydata/xarray/issues/6493,1101150791,IC_kwDOAMm_X85BojpH,14371165,2022-04-18T06:49:29Z,2022-04-18T06:49:29Z,MEMBER,"`differentiate` relies on `np.gradient` which appears to not support this, https://numpy.org/doc/stable/reference/generated/numpy.gradient.html. https://github.com/pydata/xarray/blob/586992e8d2998751cb97b1cab4d3caa9dca116e0/xarray/core/dataset.py#L6606-L6611 https://github.com/pydata/xarray/blob/586992e8d2998751cb97b1cab4d3caa9dca116e0/xarray/core/duck_array_ops.py#L134-L137","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1206634329