|
29 | 29 | #' \item{\code{vir}}{Vertically Integrated Reflectivity in cm^2/km^2}
|
30 | 30 | #' \item{\code{mtr}}{Migration Traffic Rate in individuals/km/h}
|
31 | 31 | #' \item{\code{rtr}}{Reflectivity Traffic Rate in cm^2/km/h}
|
32 |
| -#' \item{\code{mt}}{Migration Traffic in individuals/km, cumulated from |
| 32 | +#' \item{\code{mt}}{Migration Traffic in individuals/km, cumulated from |
33 | 33 | #' the start of the time series up to \code{datetime}}
|
34 | 34 | #' \item{\code{rt}}{Reflectivity Traffic in cm^2/km, cumulated from
|
35 | 35 | #' the start of the time series up to \code{datetime}}
|
|
110 | 110 | #' @examples
|
111 | 111 | #' # MTR for a single vertical profile
|
112 | 112 | #' integrate_profile(example_vp)
|
113 |
| -#' |
| 113 | +#' |
114 | 114 | #' # MTRs for a list of vertical profiles
|
115 | 115 | #' integrate_profile(c(example_vp, example_vp))
|
116 |
| -#' |
| 116 | +#' |
117 | 117 | #' # MTRs for a time series of vertical profiles
|
118 | 118 | #' # load example data:
|
119 | 119 | #' data(example_vpts)
|
@@ -172,7 +172,9 @@ integrate_profile.vp <- function(x, alt_min = 0, alt_max = Inf, alpha = NA,
|
172 | 172 | v <- sum(get_quantity(x, "v")[index] * get_quantity(x, "dens")[index],
|
173 | 173 | na.rm = TRUE
|
174 | 174 | ) / sum(get_quantity(x, "dens")[index], na.rm = TRUE)
|
175 |
| - ff <- sqrt(u^2 + v^2) |
| 175 | + ff <- sum(get_quantity(x, "ff")[index] * get_quantity(x, "dens")[index], |
| 176 | + na.rm = TRUE |
| 177 | + ) / sum(get_quantity(x, "dens")[index], na.rm = TRUE) |
176 | 178 | dd <- (pi / 2 - atan2(v, u)) * 180 / pi
|
177 | 179 | # time-integrated measures not defined for a single profile:
|
178 | 180 | mt <- NA
|
@@ -267,7 +269,11 @@ integrate_profile.vpts <- function(x, alt_min = 0, alt_max = Inf,
|
267 | 269 | ) / colSums(get_quantity(x, "dens")[index, ],
|
268 | 270 | na.rm = TRUE
|
269 | 271 | )
|
270 |
| - ff <- sqrt(u^2 + v^2) |
| 272 | + ff <- colSums(get_quantity(x, "ff")[index, ] * get_quantity(x, "dens")[index, ], |
| 273 | + na.rm = TRUE |
| 274 | + ) / colSums(get_quantity(x, "dens")[index, ], |
| 275 | + na.rm = TRUE |
| 276 | + ) |
271 | 277 | dd <- (pi / 2 - atan2(v, u)) * 180 / pi
|
272 | 278 | # time-integrated measures:
|
273 | 279 | dt <- (c(0, x$timesteps) + c(x$timesteps, 0)) / 2
|
|
0 commit comments