Description Usage Arguments Details Value See Also Examples
Spatially explicit and phenology driven validation scheme for cropland mapping.
1 | phenoCropVal(x, y, z)
|
x |
A matrix or data.frame. |
y |
A character vector. |
z |
A character vector. |
For each unique class in y, the function iterates through each unique element in z
and keeps it for validation. Then, it calls analyseTS
to derive reference profiles for each
unique class in y and uses them to classify the validation samples using phenoCropClass
.
The final output consists of:
sample.validation - A logical vector with the same length of x where TRUE means it was correctly classified.
predicted.class - A character vector with the predicted classes for each sample.
sample.count - A numeric vector with the number of non-NA used for validation per sample.
sample.r2 - A numeric vector with the r2 value between the target sample and the selected class profile.
class.accuracy - A data.frame with sample count per class, precision, recall and F1-scores per unique class in y.
A list containing a set of reference profiles for each unique class in y.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | {
require(raster)
require(fieldRS)
# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))
# read field data
data(fieldData)
# read reference profiles
data(referenceProfiles)
# read time series
data(fieldDataTS)
fieldDataTS <- as.data.frame(fieldDataTS$weighted.mean)
# read info. on sample spatial grouping
data(fieldDataCluster)
# derive validation results
cropVal <- phenoCropVal(fieldDataTS, fieldData$crop, fieldDataCluster$region.id)
# plot accuracy results
cropVal$accuracy.plot
# plot correctly classified polygons in red
plot(fieldData)
plot(fieldData[cropVal$sample.validation,], col="red", add=TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.