Displaying 2 results from an estimated 2 matches for "mean_u".
Did you mean:
mean_
2023 May 13
2
aggregate wind direction data with wind speed required
...st users,
I have to aggregate wind direction data (wd) using a function that requires also a second input variable, wind speed (ws).
This is the function that I need to use:
my_fun <- function(wd1, ws1){
u_component <- -ws1*sin(2*pi*wd1/360)
v_component <- -ws1*cos(2*pi*wd1/360)
mean_u <- mean(u_component, na.rm=T)
mean_v <- mean(v_component, na.rm=T)
mean_wd <- (atan2(mean_u, mean_v) * 360/2/pi) + 180
result <- mean_wd
result
}
Does the aggregate function work only with functions with a single input variable (the one that I want to aggregate), or its use can...
2023 May 13
1
aggregate wind direction data with wind speed required
...ta (wd) using a function that requires also a second input variable, wind speed (ws).
>
> This is the function that I need to use:
>
>
> my_fun <- function(wd1, ws1){
>
> u_component <- -ws1*sin(2*pi*wd1/360)
> v_component <- -ws1*cos(2*pi*wd1/360)
> mean_u <- mean(u_component, na.rm=T)
> mean_v <- mean(v_component, na.rm=T)
> mean_wd <- (atan2(mean_u, mean_v) * 360/2/pi) + 180
> result <- mean_wd
> result
> }
>
> Does the aggregate function work only with functions with a single input variable (the one th...