Function warning when sequence is all np.nan
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
When processing the data, even with the bottleneck package installed, there is still a Warning when the sequence is empty. is it because bottleneck can't handle the .quantile function and still ends up calling the numpy function?
bottleneck: speeds up NaN-skipping and rolling window aggregations by a large factor
import xarray as xr
import numpy as np
array = np.random.randn(3,5,5)
array[:,2,2]=np.nan
data = xr.DataArray(array,
coords={'time': np.arange(3),
'lon': np.arange(5),
'lat': np.arange(5)}
)
data.quantile(0.95,dim='time', method='median_unbiased')
/home/yu/miniconda3/envs/learn/lib/python3.11/site-packages/numpy/lib/nanfunctions.py:1563: RuntimeWarning: All-NaN slice encountered
return function_base._ureduce(a,
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 by reproducing the provided xarray DataArray example with the bottleneck package installed and confirm the RuntimeWarning from NumPy's nanfunctions.py. Trace the DataArray.quantile path to determine how all-NaN slices are handled; done means the intended quantile behavior is established and the warning behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100