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)
评论列表
文章目录