【发布时间】:2020-03-11 08:24:57
【问题描述】:
我有以下名为 foo 的 xarray DataArray。
<xarray.DataArray (time: 4, lat: 3, lon: 2)>
array([[[0.061686, 0.434164],
[0.642003, 0.78744 ],
[0.068701, 0.526546]],
[[0.53612 , 0.549919],
[0.172044, 0.118106],
[0.381638, 0.736584]],
[[0.688589, 0.173351],
[0.03593 , 0.833743],
[0.667719, 0.890957]],
[[0.712785, 0.04725 ],
[0.132689, 0.938043],
[0.681481, 0.67986 ]]])
Coordinates:
* time (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 2000-01-04
* lat (lat) <U2 'IA' 'IL' 'IN'
* lon (lon) <U2 '00' '22'
在进行 48 小时重采样时,我需要沿 time 维度应用 scipy.stats.percentileofscore 函数。
from scipy import stats
foo.resample(time='48H').reduce(stats.percentileofscore, dim='time', score=0.1)
我收到以下错误:
\variable.py", line 1354, in reduce
axis=axis, **kwargs)
TypeError: percentileofscore() got an unexpected keyword argument 'axis'
【问题讨论】:
标签: numpy scipy python-xarray