xarray.DataArray.coarsen (original) (raw)

DataArray.coarsen(dim=None, boundary='exact', side='left', coord_func='mean', **window_kwargs)[source]#

Coarsen object for DataArrays.

Parameters:

Returns:

computation.rolling.DataArrayCoarsen

Examples

Coarsen the long time series by averaging over every three days.

da = xr.DataArray( ... np.linspace(0, 364, num=364), ... dims="time", ... coords={"time": pd.date_range("1999-12-15", periods=364)}, ... ) da # +doctest: ELLIPSIS <xarray.DataArray (time: 364)> Size: 3kB array([ 0. , 1.00275482, 2.00550964, 3.00826446, 4.01101928, 5.0137741 , 6.01652893, 7.01928375, 8.02203857, 9.02479339, 10.02754821, 11.03030303, 12.03305785, 13.03581267, 14.03856749, 15.04132231, 16.04407713, 17.04683196, 18.04958678, 19.0523416 , 20.05509642, 21.05785124, 22.06060606, 23.06336088, 24.0661157 , 25.06887052, 26.07162534, 27.07438017, 28.07713499, 29.07988981, 30.08264463, 31.08539945, 32.08815427, 33.09090909, 34.09366391, 35.09641873, 36.09917355, 37.10192837, 38.1046832 , 39.10743802, 40.11019284, 41.11294766, 42.11570248, 43.1184573 , 44.12121212, 45.12396694, 46.12672176, 47.12947658, 48.1322314 , 49.13498623, 50.13774105, 51.14049587, 52.14325069, 53.14600551, 54.14876033, 55.15151515, 56.15426997, 57.15702479, 58.15977961, 59.16253444, 60.16528926, 61.16804408, 62.1707989 , 63.17355372, 64.17630854, 65.17906336, 66.18181818, 67.184573 , 68.18732782, 69.19008264, 70.19283747, 71.19559229, 72.19834711, 73.20110193, 74.20385675, 75.20661157, 76.20936639, 77.21212121, 78.21487603, 79.21763085, ... 284.78236915, 285.78512397, 286.78787879, 287.79063361, 288.79338843, 289.79614325, 290.79889807, 291.80165289, 292.80440771, 293.80716253, 294.80991736, 295.81267218, 296.815427 , 297.81818182, 298.82093664, 299.82369146, 300.82644628, 301.8292011 , 302.83195592, 303.83471074, 304.83746556, 305.84022039, 306.84297521, 307.84573003, 308.84848485, 309.85123967, 310.85399449, 311.85674931, 312.85950413, 313.86225895, 314.86501377, 315.8677686 , 316.87052342, 317.87327824, 318.87603306, 319.87878788, 320.8815427 , 321.88429752, 322.88705234, 323.88980716, 324.89256198, 325.8953168 , 326.89807163, 327.90082645, 328.90358127, 329.90633609, 330.90909091, 331.91184573, 332.91460055, 333.91735537, 334.92011019, 335.92286501, 336.92561983, 337.92837466, 338.93112948, 339.9338843 , 340.93663912, 341.93939394, 342.94214876, 343.94490358, 344.9476584 , 345.95041322, 346.95316804, 347.95592287, 348.95867769, 349.96143251, 350.96418733, 351.96694215, 352.96969697, 353.97245179, 354.97520661, 355.97796143, 356.98071625, 357.98347107, 358.9862259 , 359.98898072, 360.99173554, 361.99449036, 362.99724518, 364. ]) Coordinates: