SamAct SamAct - 2 years ago 109
R Question

Sector wise mean wind speed and directions in R

I am trying to get mean wind speeds of a data-set based on its mean direction within a sector. It is fairly simple and the below program does the trick. I, however, am unable to automate it, meaning I have to manually input the values of

every time. Also, the output is not where I would like. Please tell me a better way or help me on improving this one.

##Dummy Wind Speed and Directional Data.


fsector<-22.5 ##Starting point
esector<-45 ##End point

wind <-,wd))
wind$test<- ifelse(wind$wd > fsector & wind$wd < esector,'mean','greater')

It would be great if i can choose the number of sectors and automatically generate the list of mean wind speeds and mean direction. Thanks.

Answer Source

Actually I'm working with the same data. First I do a wind rose like this: enter image description here

And then, depending the direction, I put the data:

max(Windspeed[direc >=11.25 & direc <= 33.75])
min(Windspeed[direc >=11.25 & direc <= 33.75])
mean(Windspeed[direc >=11.25 & direc <= 33.75])

I put he direccion in degrees. If you don't search that, I will be here waiting for help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download