home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1371397741

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1371397741 I_kwDOAMm_X85Rvd5t 7027 don't apply `weighted`, `groupby`, etc. to `DataArray` without `dims`? 10194086 open 0     1 2022-09-13T12:44:34Z 2023-08-26T19:13:39Z   MEMBER      

What is your issue?

Applying e.g. ds.weighted(weights).mean() applies the operation over all DataArray objects - even if they don't have the dimensions over which it is applied (or is a scalar variable). I don't think this is wanted.

```python import xarray as xr

air = xr.tutorial.open_dataset("air_temperature") air.attrs = {}

add variable without dims

air["foo"] = 5

print("resample") print(air.resample(time="MS").mean(dim="time").foo.dims)

print("groupby") print(air.groupby("time.year").mean(dim="time").foo.dims)

print("weighted") print(air.weighted(weights=air.time.dt.year).mean("lat").foo.dims)

print("where") print(air.where(air.air > 5).foo.dims) ```

Results resample ('time',) groupby ('year',) weighted ('time',)

Related #6952 - I am sure there are other issues, but couldn't find them quickly...

rolling and coarsen don't seem to do this.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7027/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.548ms · About: xarray-datasette