issues: 506914634
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
506914634 | MDU6SXNzdWU1MDY5MTQ2MzQ= | 3398 | Mean called on groupby object adds dimensions to undesired variables | 22488770 | closed | 0 | 3 | 2019-10-14T23:03:04Z | 2019-10-16T14:30:38Z | 2019-10-16T14:30:38Z | CONTRIBUTOR | MCVE Code Sample```python import numpy as np import xarray as xr import cftime create time coordinatetdays = np.arange(0, 730) time = cftime.num2date(tdays, 'days since 0001-01-01 00:00:00', calendar='noleap') create spatial coordinatelev = np.arange(100) Create dummy datax = np.random.rand(time.size, lev.size) y = np.random.rand(lev.size) Create sample Datasetds = xr.Dataset({'sample_data': (['time', 'lev'], x), 'independent_data': (['lev'], y)}, coords={'time': (['time'], time), 'lev': (['lev'], lev)}) Perform groupby and meands2 = ds.groupby('time.month').mean(dim='time') ``` Actual Output
Expected Output
Problem DescriptionThe variable independent_data above initially has no time dimension but, after performing groupby('time.month').mean(dim='time') on the Dataset, it now has a month dimension that is meaningless. Preferably, it should leave the independent_data variable untouched. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3398/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |