binarizer | R Documentation |
Convert a spatial field to a binary spatial field via thresholding.
binarizer(X, Xhat, threshold = NULL,
rule = c(">", "<", ">=", "<=", "<>", "><", "=<>",
"<>=", "=<>=", "=><", "><=", "=><="),
value = c("matrix", "owin"), ...)
X , Xhat |
matrix or “owin” objects. |
threshold |
single number, numeric vector of two numbers, or two-by-two matrix; depending on the value of rule. May be missing or null if both |
rule |
character giving the rule for identifying 1-valued grid squares. For example, if rule is the default (“>”), then threshold should either be a single numeric or a vector of length two. If the latter, it specifies a different threshold for |
value |
character telling whether the returned object be a list with two matrices or a list with two “owin” class objects. |
... |
Not used. |
The binary fields are created by assigning ones according to the rule: 1. ">": if X > threshold, assign 1, zero otherwise. 2. "<": if X < threshold, assign 1, zero otherwise. 3. ">=": if X >= threshold, assign 1, zero otherwise. 4. "<=": if X <= threshold, assign 1, zero otherwise. 5. "<>": if X < threshold[ 1 ] or X > threshold[ 2 ], assign 1, zero otherwise. 6. "><": if threshold[ 1 ] < X < threshold[ 2 ], assign 1, zero otherwise. 7. "=<>": if threshold[ 1 ] <= X or X > threshold[ 2 ], assign 1, zero otherwise. 8. "<>=": if threshold[ 1 ] < X or X >= threshold[ 2 ], assign 1, zero otherwise. 9. "=<>=": if X <= threshold[ 1 ] or X >= threshold[ 2 ], assign 1, zero otherwise. 10. "=><": if threshold[ 1 ] <= X < threshold[ 2 ], assign 1, zero otherwise. 11. "><=": if threshold[ 1 ] < X <= threshold[ 2 ], assign 1, zero otherwise. 12. "=><=": if threshold[ 1 ] <= X <= threshold[ 2 ], assign 1, zero otherwise.
A list object with two components is returned with the first component being the binary version of X and the second that for Xhat. These fields will either be matrices of the same dimension as X and Xhat or they will be owin objects depending on the value argument.
Eric Gilleland
thresholder
, im
, solutionset
data( "obs0601" )
data( "wrf4ncar0531" )
bin <- binarizer( X = obs0601, Xhat = wrf4ncar0531, threshold = 2.1 )
image.plot( bin[[ 1 ]] )
image.plot( bin[[ 2 ]] )
bin2 <- binarizer( X = obs0601, Xhat = wrf4ncar0531,
threshold = 2.1, value = "owin" )
plot( bin2[[ 1 ]] )
plot( bin2[[ 2 ]] )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.