knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
"spotoroo" stands for spatiotemporal clustering in R of hot spot data. It is an algorithm to cluster satellite hot spots, detect ignition points and reconstruct fire movement.
You can install the released version of spotoroo from CRAN with:
install.packages("spotoroo")
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("TengMCing/spotoroo")
library(spotoroo)
The below examples use the built-in dataset hotspots
. The hot spot data needs to has at least three columns: the longitude, the latitude, and the observed time.
str(hotspots)
Perform spatiotemporal clustering on this dataset. You need to specify which columns correspond to the spatial variables ("lon", "lat"), and which to observed time ("obsTime").
There is a choice of options for the algorithm.
"activeTime" sets the time to consider that a fire can be active, and longer than this between hot spots will create a new cluster
"adjDist" sets the maximum intra-cluster spatial distance between nearest hot spots beyond which they would be considered part of a different cluster
"minPts" sets the minimum number of hot spots in a cluster
"minTime" sets the minimum length of time of a cluster
"ignitionCenter" sets the method to calculate the ignition points
"timeUnit" and "timeStep" set the length of time between successive time indexes
result <- hotspot_cluster(hotspots, lon = "lon", lat = "lat", obsTime = "obsTime", activeTime = 24, adjDist = 3000, minPts = 4, minTime = 3, ignitionCenter = "mean", timeUnit = "h", timeStep = 1) result
You can make a summary of the clustering results.
summary(result)
You can extract a subset of clusters from the results.
fire_1_and_2 <- extract_fire(result, 1:2) head(fire_1_and_2, 2)
Plot of the result. In this example, there is a total of 6 clusters, so all can be displayed.
plot(result, bg = plot_vic_map())
You can also choose a subset of clusters, and this will plot without a map, so that you can see a zoomed in view of the hot spot clusters and their ignition points.
plot(result, cluster = c(1,2,3,4))
To examine the fire movements, use the option "mov", and the movement will be shown as connected lines between centroids at each time step, for each cluster.
plot(result, type = "mov", cluster = 1:3, step = 6, bg = plot_vic_map())
To examine the time line of clusters and learn about the intensity of fire periods, use the option "timeline".
plot(result, "timeline", dateLabel = "%b %d", mainBreak = "1 week")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.