Skip to content

Function warning when sequence is all np.nan #9870

@Breeze-Hu

Description

@Breeze-Hu

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,

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue that has not been reviewed by xarray team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions