From 63f6a4a904cf0515ee0e299fd455034f154ec207 Mon Sep 17 00:00:00 2001 From: vwmaus Date: Mon, 5 Jun 2017 18:47:59 +0200 Subject: [PATCH] Update examples to show progress bar and to use new version of twdtwClassify --- man/twdtwApply.Rd | 16 ++++++++++------ man/twdtwApplyParallel.Rd | 16 ++++++++++------ man/twdtwAssess.Rd | 16 ++++++++++------ man/twdtwRaster-class.Rd | 2 +- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/man/twdtwApply.Rd b/man/twdtwApply.Rd index 6f9c76e..697a8a4 100644 --- a/man/twdtwApply.Rd +++ b/man/twdtwApply.Rd @@ -118,7 +118,7 @@ mat_list = mclapply(as.list(ts), mc.cores=2, FUN=twdtwApply, y=patt, weight.fun= mat2 = twdtwMatches(alignments=mat_list) } \dontrun{ - + # Example of TWDTW analysis using raster files library(dtwSat) library(caret) @@ -162,22 +162,22 @@ log_fun <- logisticWeight(-0.1, 50) # Run serial TWDTW analysis r_twdtw <- - twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') # or Run parallel TWDTW analysis -beginCluster(n = 4) +beginCluster() r_twdtw <- - twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') endCluster() # Plot TWDTW distances for the first year plot(r_twdtw, type = "distance", time.levels = 1) # Classify raster based on the TWDTW analysis -r_lucc <- twdtwClassify(r_twdtw, format = "GTiff", overwrite = TRUE) +r_lucc <- twdtwClassify(r_twdtw, progress = 'text') # Plot TWDTW classification results -plot(r_lucc, type = "classification") +plot(r_lucc, type = "map") # Assess classification twdtw_assess <- @@ -190,6 +190,9 @@ plot(twdtw_assess, type = "accuracy") # Plot area uncertainty plot(twdtw_assess, type = "area") +# Plot misclassified samples +plot(twdtw_assess, type = "map", samples = "incorrect") + # Get latex table with error matrix twdtwXtable(twdtw_assess, table.type = "matrix") @@ -200,6 +203,7 @@ twdtwXtable(twdtw_assess, table.type = "accuracy") twdtwXtable(twdtw_assess, table.type = "area") } + } \references{ [1] Maus V, Camara G, Cartaxo R, Sanchez A, Ramos FM, de Queiroz, GR. diff --git a/man/twdtwApplyParallel.Rd b/man/twdtwApplyParallel.Rd index 2fe9b41..cfb58fe 100644 --- a/man/twdtwApplyParallel.Rd +++ b/man/twdtwApplyParallel.Rd @@ -97,7 +97,7 @@ See [1] for details about the method. } \examples{ \dontrun{ - + # Example of TWDTW analysis using raster files library(dtwSat) library(caret) @@ -141,22 +141,22 @@ log_fun <- logisticWeight(-0.1, 50) # Run serial TWDTW analysis r_twdtw <- - twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') # or Run parallel TWDTW analysis -beginCluster(n = 4) +beginCluster() r_twdtw <- - twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') endCluster() # Plot TWDTW distances for the first year plot(r_twdtw, type = "distance", time.levels = 1) # Classify raster based on the TWDTW analysis -r_lucc <- twdtwClassify(r_twdtw, format = "GTiff", overwrite = TRUE) +r_lucc <- twdtwClassify(r_twdtw, progress = 'text') # Plot TWDTW classification results -plot(r_lucc, type = "classification") +plot(r_lucc, type = "map") # Assess classification twdtw_assess <- @@ -169,6 +169,9 @@ plot(twdtw_assess, type = "accuracy") # Plot area uncertainty plot(twdtw_assess, type = "area") +# Plot misclassified samples +plot(twdtw_assess, type = "map", samples = "incorrect") + # Get latex table with error matrix twdtwXtable(twdtw_assess, table.type = "matrix") @@ -179,6 +182,7 @@ twdtwXtable(twdtw_assess, table.type = "accuracy") twdtwXtable(twdtw_assess, table.type = "area") } + } \references{ [1] Maus V, Camara G, Cartaxo R, Sanchez A, Ramos FM, de Queiroz, GR. diff --git a/man/twdtwAssess.Rd b/man/twdtwAssess.Rd index 282fdd6..3f008f7 100644 --- a/man/twdtwAssess.Rd +++ b/man/twdtwAssess.Rd @@ -75,7 +75,7 @@ for each time interval and a summary considering all classified intervals. } \examples{ \dontrun{ - + # Example of TWDTW analysis using raster files library(dtwSat) library(caret) @@ -119,22 +119,22 @@ log_fun <- logisticWeight(-0.1, 50) # Run serial TWDTW analysis r_twdtw <- - twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApply(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') # or Run parallel TWDTW analysis -beginCluster(n = 4) +beginCluster() r_twdtw <- - twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'test') + twdtwApplyParallel(x = rts, y = temporal_patterns, weight.fun = log_fun, progress = 'text') endCluster() # Plot TWDTW distances for the first year plot(r_twdtw, type = "distance", time.levels = 1) # Classify raster based on the TWDTW analysis -r_lucc <- twdtwClassify(r_twdtw, format = "GTiff", overwrite = TRUE) +r_lucc <- twdtwClassify(r_twdtw, progress = 'text') # Plot TWDTW classification results -plot(r_lucc, type = "classification") +plot(r_lucc, type = "map") # Assess classification twdtw_assess <- @@ -147,6 +147,9 @@ plot(twdtw_assess, type = "accuracy") # Plot area uncertainty plot(twdtw_assess, type = "area") +# Plot misclassified samples +plot(twdtw_assess, type = "map", samples = "incorrect") + # Get latex table with error matrix twdtwXtable(twdtw_assess, table.type = "matrix") @@ -158,6 +161,7 @@ twdtwXtable(twdtw_assess, table.type = "area") } + # Total mapped area by class. Data from [1] area = c(A = 22353, B = 1122543, C = 610228) diff --git a/man/twdtwRaster-class.Rd b/man/twdtwRaster-class.Rd index 2c17405..3169f36 100644 --- a/man/twdtwRaster-class.Rd +++ b/man/twdtwRaster-class.Rd @@ -37,7 +37,7 @@ \title{class "twdtwRaster"} \usage{ \S4method{twdtwRaster}{ANY}(..., timeline, doy = NULL, layers = NULL, - labels = NULL, levels = NULL, filepath = "") + labels = NULL, levels = NULL, filepath = NULL) \S4method{dim}{twdtwRaster}(x)