每年在Xarray中按自定义期间组
我正在尝试将xarray.dataset
对象分组为一个自定义的5个月,从10月至1月1日,年度频率。这很复杂,因为这个时期越过新年。
我一直在尝试使用该方法
wb_start = temperature.sel(time=temperature.time.dt.month.isin([10,11,12,1]))
wb_start1 = wb_start.groupby('time.year')
,但是这可以预见,这是同一年的一月,而不是+1年。任何帮助将不胜感激!
I'm trying to group an xarray.Dataset
object into a custom 5-month period spanning from October-January with an annual frequency. This is complicated because the period crosses New Year.
I've been trying to use the approach
wb_start = temperature.sel(time=temperature.time.dt.month.isin([10,11,12,1]))
wb_start1 = wb_start.groupby('time.year')
But this predictably makes the January month of the same year, instead of +1 year. Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以一种有效的方式解决了这一点,尽管将一年的时间添加到一月份之后的几个月中。我的方法基本上将一年的月份增加了10,11,12个,而一年来的数据就适当,然后在重新索引时间数据上进行了一个groupby(年)实例。
I fixed this in a somewhat clunk albeit effective way by adding a year to the months after January. My method essentially moves the months 10,11,12 up one year while leaving the January data in place, and then does a groupby(year) instance on the reindexed time data.