windeval.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:POWER 作者: pennelise 项目源码 文件源码
def hourly_wind_speed(wind_speeds, times):
    """Average wind speed over hours and return a 1x24 numpy array.

    Arguments:
    wind_speeds -- a np array of all wind speeds
    times -- a np array of all times with indexes corresponding to wind_speeds
    """
    avg_hourly_ws = []
    new_times = []
    hours = np.array([t.hour for t in times]) #Make an array of just the hours.
    for i in range(24):
        avg_hourly_ws.append(np.nanmean(wind_speeds[hours == i]))
        new_times.append(i)
    return np.array(new_times), np.array(avg_hourly_ws) #Return the wind speeds and their corresponding times as a NumPy array

#Gets average wind dir for each hour of the day (returns 24h averaged over multiple days)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号