knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

spotoroo

R-CMD-check Codecov test coverage

Overview

"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.

Installation

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")

Usage

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.

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")


TengMCing/hotspotcluster documentation built on Aug. 23, 2023, 12:47 p.m.