View source: R/Quality_checking.R
extract_coded | R Documentation |
This function is called by extract_QC
and is not intended to be
used directly. Coded QC information for one or multiple variables stored in a
character vector of certain properties is extracted and interpreted.
extract_coded(
x,
name_out_SA = "SA",
name_out_GA = "GA",
name_out_SAGA = "SAGA",
name_out_ALL = "ALL",
prefix = "[8]",
split = "[/]",
sf = FALSE
)
x |
An atomic type. |
name_out_SA , name_out_GA , name_out_SAGA , name_out_ALL |
A character string. Name of the output column with QC related to SA, GA, SAGA or ALL. |
prefix |
Character string containing a |
split |
Character string containing a |
sf |
A logical value. Coded variable represents hard flag ( |
Each element of x
is expected to have the same structure according to
the format specified by units
attribute of x
. units
format string (e.g. "8u/v/w/ts/h2o/co2"
) starts with a prefix
("8"
) that is followed by variable names ("u", "v", "w", "ts",
"h2o", "co2"
) that are distinguished by a separator ("/"
). Elements
of x
thus consist of either seven components (prefix and six flags for
each variable) or one NA
value. Flags of coded variables can have
three values:
flag 0: measured variable passed the test.
flag 1: measured variable failed the test.
flag 9: flag could not
be obtained for the given variable (NA
).
The original flags are then interpreted within the QC scheme using QC flag range 0 - 2. Coded variable can represent either
hard flag
(suffix "_hf"
in EddyPro column name): flag 1 interpreted as flag 2.
soft flag (suffix "_sf"
in EddyPro column name): flag 1
interpreted as flag 1.
x
is interpreted in respect to instruments required to measure given
fluxes. SA is required for measurements of all fluxes and solely provides
data for computation of Tau and H fluxes. GA is used only for measurements of
LE and NEE. A combination of SA and GA (SAGA) is used for measurements of LE
and NEE. Filters where flags would be identical for both SA and GA have
prefix ALL (QC flags in a single column applicable to all fluxes). To confirm
the correct performance of SA, all variables "u", "v", "w", "ts"
must
have flag 0. In case of GA, all variables "co2", "h2o"
must have flag
0. In case of SAGA, all variables "u", "v", "w", "ts", "h2o", "co2"
must have flag 0.
A data frame with relevant column names defined by
name_out_SA
, name_out_GA
, name_out_SAGA
and
name_out_ALL
. Each column has attributes "varnames"
and
"units"
and length equal to that of x
.
QC: Quality Control
SA: Sonic Anemometer
GA: Gas Analyzer
Tau: Momentum flux [kg m-1 s-2]
H: Sensible heat flux [W m-2]
LE: Latent heat flux [W m-2]
NEE: Net ecosystem exchange [umol m-2 s-1]
u: Longitudinal wind speed component [m s-1]
v: Cross-wind wind speed component [m s-1]
w: Vertical wind speed component [m s-1]
ts: Sonic temperature [degC]
h2o: H2O concentration [mmol mol-1]
co2: CO2 concentration [umol mol-1]
.
extract_QC
.
set.seed(5)
xx <- replicate(10,
paste0(c("8", sample(c(0:1, 9), 6, c(0.7, 0.2, 0.1),
replace = TRUE)),
collapse = ""))
is.na(xx) <- c(2, 5)
units(xx) <- "8u/v/w/ts/h2o/co2"
cbind(xx, extract_coded(xx))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.