Skip to content

Commit

Permalink
Merge pull request #483 from adokter/wind_speed
Browse files Browse the repository at this point in the history
add ff_wind, u_wind, v_wind as integrated quantities (cont.)
  • Loading branch information
adokter authored Oct 25, 2021
2 parents d13b841 + a592ee2 commit c901cab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/integrate_profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ integrate_profile.vp <- function(x, alt_min = 0, alt_max = Inf, alpha = NA,
airspeed_v <- get_quantity(x, "v") - get_quantity(x, "v_wind")
output$airspeed <- weighted.mean(sqrt(airspeed_u^2 + airspeed_v^2), weight_densdh, na.rm = TRUE)
output$heading <- weighted.mean((pi / 2 - atan2(airspeed_v, airspeed_u)) * 180 / pi, weight_densdh, na.rm = TRUE)
output$ff_wind <- weighted.mean(sqrt(u_wind^2 + v_wind^2), weight_densdh, na.rm = TRUE)
output$dd_wind <- weighted.mean((pi / 2 - atan2(v_wind, u_wind)) * 180 / pi, weight_densdh, na.rm = TRUE)
output$airspeed_u <- weighted.mean(airspeed_u, weight_densdh, na.rm = TRUE)
output$airspeed_v <- weighted.mean(airspeed_u, weight_densdh, na.rm = TRUE)
output$ff_wind <- weighted.mean(sqrt(u_wind^2 + v_wind^2), weight_densdh, na.rm = TRUE)
output$u_wind <- weighted.mean(u_wind, weight_densdh, na.rm = TRUE)
output$v_wind <- weighted.mean(v_wind, weight_densdh, na.rm = TRUE)
}

class(output) <- c("vpi", "data.frame")
Expand Down Expand Up @@ -372,6 +373,9 @@ integrate_profile.vpts <- function(x, alt_min = 0, alt_max = Inf,
output$heading <- colSums(((pi / 2 - atan2(airspeed_v, airspeed_u)) * 180 / pi) * weight_densdh, na.rm = TRUE)
output$airspeed_u <- colSums(airspeed_u * weight_densdh, na.rm = TRUE)
output$airspeed_v <- colSums(airspeed_v * weight_densdh, na.rm = TRUE)
output$ff_wind <- colSums(sqrt(get_quantity(x,"u_wind")^2 + get_quantity(x,"v_wind")^2) * weight_densdh, na.rm = TRUE)
output$u_wind <- colSums(get_quantity(x,"u_wind") * weight_densdh, na.rm = TRUE)
output$v_wind <- colSums(get_quantity(x,"v_wind") * weight_densdh, na.rm = TRUE)
}

class(output) <- c("vpi", "data.frame")
Expand Down

0 comments on commit c901cab

Please sign in to comment.