Skip to content

Buddy check

Cristian Lussana edited this page Mar 30, 2021 · 1 revision

Test based on the statistics of the deviations between observations and the spatial trend in a region.

Around each observation, two circular regions are considered. An outer circle and an inner circle, both centered on the centroid. The outer circle is used to compute the spatial trend. The inner circle is used to compute the statistics of deviations, which will be used in the test. Bad observations are those that deviate too much with respect to the statistics computed through the neighbours.

Returned values are: the p-vector of the quality flags

flag description
-999 missing flag (observation not checked)
0 good observation
1 bad observation
11 isolated observation, it is the only observation inside the inner circle
12 isolated observation, less than num_min_outer observations inside outer circle

The list of parameters is (type vector = it is possible to specify a sequence of buddy checks):

parameter description type
buddy do it, true or false logical
buddy.code code identifying bad observation flagged by the buddy check scalar
i.buddy number of repetitions of the entire sequence of buddy checks scalar
break.buddy break the loop over i.buddy if less than this number of observations has been flagged scalar
transf.buddy transform values before doing the buddy check scalar
doit.buddy specify on a provider basis if the observations have to be tested (0=no; 1=yes) M-vector
prio.buddy specify on a provider basis the priorities the observations have (the smaller the number, the higher the piority) M-vector
inner_radius.buddy radius (m) of the inner circle N-vector
outer_radius.buddy radius (m) of the outer circle N-vector
tpos.buddy threshold when the observed value is greater than the spatial trend (N*M)-vector
tneg.buddy threshold when the observed value is smaller than the spatial trend (N*M)-vector
background_elab_type.buddy background elaboration N-vector
num_min_outer.buddy minimum number of observations required inside the outer circle N-vector
num_max_outer.buddy maximum number of observations used N-vector
num_min_prof.buddy background elaboration N-vector
min_elev_diff.buddy background elaboration N-vector

Notes:

  • N-vectors. where N is the number of buddy checks composing the sequence of checks.
  • M-vectors. where M is the number of providers.
  • (N*M)-vectors. for each buddy check in the sequence and for each provider, specify one value.
  • doit.buddy. one value for each provider. If only one value is specified, it is assumed it is the same for all providers.
  • prio.buddy. one value for each provider. If only one value is specified, it is assumed it is the same for all providers.
  • tpos(tneg).buddy. one value for each pair provider/test. If only one value is specified, it is assumed it is the same for all providers.
  • other vectors, if just one scalar value is passed, then it is usually recycled for all elements.

R-example

system("export TITANR_PATH=$HOME/projects/titanlab/R/functions; ../titan.r --input.files data/observation_test_ta_prid01_p02000_pGE020percent.txt data/observation_test_ta_prid02_p00100_pGE003percent.txt --output.file data/out.txt --config.files ini/ta_test_titan.ini ini/ta_buddy.ini")
conf <- list(
# M = 2 observation providers
# N = 3 buddy (2 over fg_lab1, 1 over fg_lab2)
# B = 2 background fields: 
#     1 deterministic (fg_lab=1); 1 ensemble (9 members) (fg_lab=2)
#------------------------------------------------------------------------------
             buddy = T,
             code.buddy=10,
             i.buddy = 10,
             break.buddy = 0, 
             transf.buddy = F, 
# M vectors
             doit.buddy = 1, 
             prio.buddy = 1,
# N = 2 buddy checks (either 1 value or N)
             inner_radius.buddy = c( 10000, 20000),
             outer_radius.buddy = c( 30000, 60000),
             background_elab_type.buddy = "VerticalProfileTheilSen",
             num_min_outer.buddy = 3,
             num_max_outer.buddy = 50,
             num_min_prof.buddy = 5,
             min_elev_diff.buddy = 10,
# M * N (either 1 value or M*N)
             tpos.buddy = 2,
             tneg.buddy = 2
            )