@@ -10,7 +10,7 @@ pub struct BuddyCheckArgs {
10
10
/// Search radius in which buddies of an observation will be found. Unit: m
11
11
pub radii : SingleOrVec < f32 > ,
12
12
/// The minimum buddies an observation can have (lest it be flagged [`Flag::Isolated`])
13
- pub nums_min : SingleOrVec < u32 > ,
13
+ pub min_buddies : SingleOrVec < u32 > ,
14
14
/// The variance threshold for flagging a station. Unit: σ (standard deviations)
15
15
pub threshold : f32 ,
16
16
/// The maximum difference in elevation for a buddy (if negative will not check for height
@@ -30,7 +30,7 @@ pub struct BuddyCheckArgs {
30
30
///
31
31
/// The check looks for buddies of an observation (at index i) in a neighbourhood specified by
32
32
/// `radii[i]` \[m\], which is the radius of a circle around the observation to be checked. A minimum
33
- /// number of observations (`nums_min [i]`) is required to be available inside the circle and the
33
+ /// number of observations (`min_buddies [i]`) is required to be available inside the circle and the
34
34
/// range of elevations in the circle must not exceed `max_elev_diff` meters . The number of
35
35
/// iterations is set by `num_iterations`.
36
36
///
@@ -89,7 +89,7 @@ pub fn buddy_check(
89
89
90
90
let mut list_buddies: Vec < f32 > = Vec :: new ( ) ;
91
91
92
- if neighbours. len ( ) >= * args. nums_min . index ( i) as usize {
92
+ if neighbours. len ( ) >= * args. min_buddies . index ( i) as usize {
93
93
for neighbour in neighbours {
94
94
let ( _, _, neighbour_elev) = rtree. get_coords_at_index ( neighbour. data ) ;
95
95
@@ -115,7 +115,7 @@ pub fn buddy_check(
115
115
}
116
116
}
117
117
118
- if list_buddies. len ( ) >= * args. nums_min . index ( i) as usize {
118
+ if list_buddies. len ( ) >= * args. min_buddies . index ( i) as usize {
119
119
let mean: f32 = list_buddies. iter ( ) . sum :: < f32 > ( ) / list_buddies. len ( ) as f32 ;
120
120
let variance: f32 = ( list_buddies. iter ( ) . map ( |x| x. powi ( 2 ) ) . sum :: < f32 > ( )
121
121
/ list_buddies. len ( ) as f32 )
@@ -217,7 +217,7 @@ mod tests {
217
217
) ,
218
218
& BuddyCheckArgs {
219
219
radii: SingleOrVec :: Single ( 10000. ) ,
220
- nums_min : SingleOrVec :: Single ( 1 ) ,
220
+ min_buddies : SingleOrVec :: Single ( 1 ) ,
221
221
threshold: 1. ,
222
222
max_elev_diff: 200. ,
223
223
elev_gradient: -0.0065 ,
0 commit comments