pydata / pydata/xarray

scipy skewnorm function doesnt work with xarray rolling window?

Open
#3,184 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-documentation topic-rolling
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

MCVE Code Sample
loc,scale,shape = da.rolling(time=59).reduce(scipy.stats.skewnorm)


Expected Output
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/xarray/core/rolling.py", line 217, in reduce
    result = windows.reduce(func, dim=rolling_dim, **kwargs)
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/xarray/core/dataarray.py", line 1636, in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, **kwargs)
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/xarray/core/variable.py", line 1371, in reduce
    data = func(input_data, axis=axis, **kwargs)
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py", line 770, in __call__
    return self.freeze(*args, **kwds)
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py", line 767, in freeze
    return rv_frozen(self, *args, **kwds)
  File "/Users/mada0007/anaconda3/envs/modes/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py", line 435, in __init__
    shapes, _, _ = self.dist._parse_args(*args, **kwds)
TypeError: _parse_args() got an unexpected keyword argument 'axis'
Output of ``ommit: None

python: 3.7.2 (default, Dec 29 2018, 00:00:04)
[Clang 4.0.1 (tags/RELEASE_401/final)]
python-bits: 64
OS: Darwin
OS-release: 18.2.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: en_AU.UTF-8
libhdf5: 1.10.4
libnetcdf: 4.6.2
xarray: 0.12.1
pandas: 0.24.2
numpy: 1.15.4
scipy: 1.2.1
netCDF4: 1.5.1.2
pydap: installed
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
nc_time_axis: None
PseudonetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 1.2.2
distributed: 1.28.1
matplotlib: 3.0.3
cartopy: 0.17.0
seaborn: 0.9.0
setuptools: 40.8.0
pip: 19.0.3
conda: None
pytest: None
IPython: None
sphinx: None``

How can I please make this code work?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the MCVE with xarray's rolling reduce path, starting in xarray/core/rolling.py and following the calls into dataarray.py and variable.py. Compare the axis passed to scipy.stats.skewnorm with the traceback, and verify that the intended rolling reduction works without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.