search for: v_compon

Displaying 2 results from an estimated 2 matches for "v_compon".

Did you mean: __common
2023 May 13
2
aggregate wind direction data with wind speed required
Dear list 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...
2023 May 13
1
aggregate wind direction data with wind speed required
...> > 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 fun...