Dataset.resample() adds time dimension to independent variables
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Code Sample, a copy-pastable example if possible
ds = ds.resample(time='1D',keep_attrs=True).mean()
Problem description
I'm downsampling in time a dataset which also contains timeless variables.
I've noticed that resample adds the time dimension to the timeless variables.
One workaround is:
- Split the dataset in a timeless and a time-dependent dataset
- Resample the time-dependent dataset
- Merge the two datasets
This is not a big deal, but I was wondering if I'm missing some flag that avoids this behavior.
If not, is it something that can be easily implemented in resample?
It would be very useful for datasets with variables on staggered grids.
Output of xr.show_versions()
xarray: 0.10.3
pandas: 0.20.2
numpy: 1.12.1
scipy: 0.19.1
netCDF4: 1.2.4
h5netcdf: 0.5.1
h5py: 2.7.0
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.17.4
distributed: 1.21.8
matplotlib: 2.0.2
cartopy: 0.16.0
seaborn: 0.7.1
setuptools: 39.1.0
pip: 9.0.1
conda: 4.5.3
pytest: 3.1.2
IPython: 6.1.0
sphinx: 1.6.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Dataset.resample() entry point and reproduce the provided example with both time-dependent and timeless variables. Trace how resampling handles independent variables; done means timeless variables retain no time dimension while time-dependent variables are resampled as before.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100