home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1176959116

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/6749#issuecomment-1176959116 https://api.github.com/repos/pydata/xarray/issues/6749 1176959116 IC_kwDOAMm_X85GJviM 2448579 2022-07-07T02:05:06Z 2022-07-07T02:05:06Z MEMBER

We discussed: 1. dropping variables without the dimension 2. Return ds.sizes["x"] by broadcasting b along x


For the other reductions

``` python import numpy as np import xarray as xr

from xarray.core.duck_array_ops import count

ds = xr.Dataset({"a": ("x", [1, 2, 3]), "b": ("y", [4, 5])})

for func in [np.nansum, np.nanprod, np.nanmean, np.nanvar, np.nanstd, count]: print(f"{func.name!s}({ds.b.data}, axis=()) = {func(ds.b.data, axis=())}") ```

gives nansum([4 5], axis=()) = [4 5] nanprod([4 5], axis=()) = [4 5] nanmean([4 5], axis=()) = [4. 5.] nanvar([4 5], axis=()) = [0. 0.] nanstd([4 5], axis=()) = [0. 0.] count([4 5], axis=()) = [1 1]

I guess the output for nansum, nanprod doesn't match what you would get by broadcasting along the absent dimension.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1292284929
Powered by Datasette · Queries took 0.571ms · About: xarray-datasette