Skip to contents

This function takes a spotoroo object to produce a data frame which contains information about the fire.

Usage

extract_fire(result, cluster = "all", noise = FALSE)

Arguments

result

spotoroo object. A result of a call to hotspot_cluster().

cluster

Character/Integer. If "all", extract all clusters. If an integer vector is given, extract corresponding clusters.

noise

Logical. Whether or not to include noise.

Value

A data.frame. The fire information

  • lon : Longitude.

  • lat : Latitude.

  • obsTime : Observed time.

  • timeID : Time indexes.

  • membership : Membership labels.

  • noise : Whether it is a noise point.

  • distToIgnition : Distance to the ignition location.

  • distToIgnitionUnit : Unit of distance to the ignition location.

  • timeFromIgnition : Time from ignition.

  • timeFromIgnitionUnit : Unit of time from ignition.

  • type : Type of the entry, either "hotspot", "noise" or "ignition"

  • obsInCluster : Number of observations in the cluster.

  • clusterTimeLen : Length of time of the cluster.

  • clusterTimeLenUnit : Unit of length of time of the cluster.

Examples

# \donttest{

  # Time consuming functions (>5 seconds)


  # Get clustering results
  result <- hotspot_cluster(hotspots,
                          lon = "lon",
                          lat = "lat",
                          obsTime = "obsTime",
                          activeTime = 24,
                          adjDist = 3000,
                          minPts = 4,
                          minTime = 3,
                          ignitionCenter = "mean",
                          timeUnit = "h",
                          timeStep = 1)
#> 
#> ──────────────────────────────── SPOTOROO 0.1.6 ────────────────────────────────
#> 
#> ── Calling Core Function : `hotspot_cluster()` ──
#> 
#> ── "1" time index = 1 hour 
#>  Transform observed timetime indexes
#>  970 time indexes found
#> 
#> ── activeTime = 24 time indexes | adjDist = 3000 meters 
#>  Cluster
#>  16 clusters found (including noise)
#> 
#> ── minPts = 4 hot spots | minTime = 3 time indexes 
#>  Handle noise
#>  6 clusters left
#>  noise proportion : 0.935 %
#> 
#> ── ignitionCenter = "mean" 
#>  Compute ignition points for clusters
#>  average hot spots : 176.7
#>  average duration : 131.9 hours
#> 
#> ── Time taken = 0 mins 1 sec for 1070 hot spots 
#>  0.001 secs per hot spot
#> 
#> ────────────────────────────────────────────────────────────────────────────────


  # Extract all fires
  all_fires <- extract_fire(result)
  head(all_fires, 3)
#>      lon       lat             obsTime timeID membership noise distToIgnition
#> 1 149.30 -37.75999 2019-12-29 13:10:00      1          1 FALSE       1111.885
#> 2 149.30 -37.78000 2019-12-29 13:10:00      1          1 FALSE       1111.885
#> 3 149.32 -37.78000 2019-12-29 13:30:00      1          1 FALSE       2080.914
#>   distToIgnitionUnit timeFromIgnition timeFromIgnitionUnit    type obsInCluster
#> 1                  m  0.0000000 hours                    h hotspot          146
#> 2                  m  0.0000000 hours                    h hotspot          146
#> 3                  m  0.3333333 hours                    h hotspot          146
#>   clusterTimeLen clusterTimeLenUnit
#> 1 116.1667 hours                  h
#> 2 116.1667 hours                  h
#> 3 116.1667 hours                  h

  # Extract cluster 4
  fire_4 <- extract_fire(result, 4)
  head(fire_4, 3)
#>      lon       lat             obsTime timeID membership noise distToIgnition
#> 1 149.16 -37.25999 2020-01-10 04:10:00    280          4 FALSE       3334.822
#> 2 149.16 -37.28000 2020-01-10 04:10:00    280          4 FALSE       1111.052
#> 3 149.16 -37.30000 2020-01-10 04:10:00    280          4 FALSE       1111.607
#>   distToIgnitionUnit timeFromIgnition timeFromIgnitionUnit    type obsInCluster
#> 1                  m          0 hours                    h hotspot          256
#> 2                  m          0 hours                    h hotspot          256
#> 3                  m          0 hours                    h hotspot          256
#>   clusterTimeLen clusterTimeLenUnit
#> 1 124.1667 hours                  h
#> 2 124.1667 hours                  h
#> 3 124.1667 hours                  h
# }