1 Merge the US & Canada Fire-start Data

Load the U.S. (merged) & Canada (trimmed) data sets

load("e:/Projects/fire/DailyFireStarts/data/RData/us_1986-2013.RData")
load("e:/Projects/fire/DailyFireStarts/data/RData/can_1986-2013.RData")
options(width=100)
str(us_merged)
## 'data.frame':    1849052 obs. of  14 variables:
##  $ datasource    : Factor w/ 2 levels "fpafod","nifc": 1 1 1 1 1 1 1 1 1 1 ...
##  $ sourceid      : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ latitude      : num  40 38.9 39 38.6 38.6 ...
##  $ longitude     : num  -121 -120 -121 -120 -120 ...
##  $ year          : num  2005 2004 2004 2004 2004 ...
##  $ mon           : num  2 5 5 6 6 6 7 3 3 7 ...
##  $ day           : num  2 12 31 28 28 30 1 8 15 1 ...
##  $ daynum        : num  33 133 152 180 180 182 183 67 74 183 ...
##  $ area_ha       : num  0.0405 0.1012 0.0405 0.0405 0.0405 ...
##  $ cause_original: num  9 1 5 1 1 1 1 5 5 1 ...
##  $ cause1        : num  2 1 2 1 1 1 1 2 2 1 ...
##  $ cause2        : num  8 1 5 1 1 1 1 5 5 1 ...
##  $ stateprov     : Factor w/ 52 levels "AK","AL","AR",..: 5 5 5 5 5 5 5 5 5 5 ...
##  $ agency        : Factor w/ 12 levels "BIA","BLM","BOR",..: 6 6 6 6 6 6 6 6 6 6 ...
str(can)
## 'data.frame':    234813 obs. of  14 variables:
##  $ datasource    : Factor w/ 1 level "cnfdb": 1 1 1 1 1 1 1 1 1 1 ...
##  $ sourceid      : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ latitude      : num  53.3 47.8 47.4 47 49 ...
##  $ longitude     : num  -63.4 -54.5 -52.7 -55.5 -55.7 ...
##  $ year          : int  1993 1999 1986 1986 1986 1986 1986 1986 1986 1986 ...
##  $ mon           : int  6 5 5 5 5 5 5 5 5 5 ...
##  $ day           : int  19 19 16 16 14 15 15 16 16 17 ...
##  $ daynum        : num  170 139 136 136 134 135 135 136 136 137 ...
##  $ area_ha       : num  1300 380 731 456 19472 ...
##  $ cause_original: num  3 1 1 1 1 1 1 1 1 1 ...
##  $ cause1        : num  1 2 2 2 2 2 2 2 2 2 ...
##  $ cause2        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ stateprov     : Factor w/ 56 levels "AB","BC","MB",..: 5 5 5 5 5 5 5 5 5 5 ...
##  $ agency        : Factor w/ 56 levels "AB","BC","MB",..: 5 5 5 5 5 5 5 5 5 5 ...
summary(us_merged)
##   datasource         sourceid            latitude       longitude            year           mon    
##  fpafod:1727476   Min.   :        1   Min.   :17.94   Min.   :-178.80   Min.   :1986   Min.   : 1  
##  nifc  : 121576   1st Qu.:   359278   1st Qu.:32.99   1st Qu.:-111.48   1st Qu.:1996   1st Qu.: 4  
##                   Median :   908962   Median :35.62   Median : -92.91   Median :2002   Median : 6  
##                   Mean   : 30072960   Mean   :37.01   Mean   : -96.31   Mean   :2002   Mean   : 6  
##                   3rd Qu.:  1663336   3rd Qu.:41.05   3rd Qu.: -82.54   3rd Qu.:2008   3rd Qu.: 8  
##                   Max.   :201940182   Max.   :70.14   Max.   : -65.26   Max.   :2013   Max.   :12  
##                                                                                                    
##       day            daynum         area_ha          cause_original       cause1     
##  Min.   : 1.00   Min.   :  1.0   Min.   :     0.00   Min.   : 0.000   Min.   :1.000  
##  1st Qu.: 8.00   1st Qu.: 92.0   1st Qu.:     0.04   1st Qu.: 2.000   1st Qu.:2.000  
##  Median :15.00   Median :170.0   Median :     0.40   Median : 5.000   Median :2.000  
##  Mean   :15.52   Mean   :166.9   Mean   :    32.24   Mean   : 5.728   Mean   :1.935  
##  3rd Qu.:23.00   3rd Qu.:231.0   3rd Qu.:     1.29   3rd Qu.: 9.000   3rd Qu.:2.000  
##  Max.   :31.00   Max.   :366.0   Max.   :245622.14   Max.   :13.000   Max.   :3.000  
##                                                                                      
##      cause2         stateprov           agency       
##  Min.   : 0.000   CA     : 196976   ST/C&L :1254551  
##  1st Qu.: 3.000   GA     : 163298   FS     : 206731  
##  Median : 5.000   TX     : 126100   BIA    : 128871  
##  Mean   : 5.043   NC     : 105113   BLM    : 112063  
##  3rd Qu.: 8.000   FL     :  87589   USFS   :  71387  
##  Max.   :10.000   AZ     :  79969   NPS    :  28050  
##                   (Other):1090007   (Other):  47399
summary(can)
##  datasource        sourceid         latitude       longitude            year           mon        
##  cnfdb:234813   Min.   :     1   Min.   :41.92   Min.   :-141.00   Min.   :1986   Min.   : 1.000  
##                 1st Qu.: 58704   1st Qu.:49.16   1st Qu.:-120.15   1st Qu.:1992   1st Qu.: 6.000  
##                 Median :117407   Median :50.85   Median :-114.54   Median :1999   Median : 7.000  
##                 Mean   :117407   Mean   :51.80   Mean   :-104.60   Mean   :1999   Mean   : 6.697  
##                 3rd Qu.:176110   3rd Qu.:54.59   3rd Qu.: -89.31   3rd Qu.:2007   3rd Qu.: 8.000  
##                 Max.   :234813   Max.   :69.60   Max.   : -52.69   Max.   :2013   Max.   :12.000  
##                                                                                                   
##       day            daynum         area_ha         cause_original      cause1         cause2 
##  Min.   : 1.00   Min.   :  1.0   Min.   :     0.0   Min.   :0.000   Min.   :1.00   Min.   :0  
##  1st Qu.: 8.00   1st Qu.:152.0   1st Qu.:     0.0   1st Qu.:1.000   1st Qu.:1.00   1st Qu.:0  
##  Median :15.00   Median :193.0   Median :     0.1   Median :1.000   Median :2.00   Median :0  
##  Mean   :15.52   Mean   :187.9   Mean   :   279.2   Mean   :2.046   Mean   :1.63   Mean   :0  
##  3rd Qu.:23.00   3rd Qu.:221.0   3rd Qu.:     0.9   3rd Qu.:3.000   3rd Qu.:2.00   3rd Qu.:0  
##  Max.   :31.00   Max.   :366.0   Max.   :577646.8   Max.   :5.000   Max.   :3.00   Max.   :0  
##                                                                                               
##    stateprov         agency     
##  BC     :85833   BC     :85833  
##  ON     :38875   ON     :38875  
##  AB     :33239   AB     :33239  
##  SK     :17945   SK     :17945  
##  QC     :17180   QC     :17180  
##  MB     :11665   MB     :11665  
##  (Other):30076   (Other):30076

Make the merged file

uscan <- rbind(us_merged,can)
summary(uscan)
##   datasource         sourceid            latitude       longitude            year     
##  fpafod:1727476   Min.   :        1   Min.   :17.94   Min.   :-178.80   Min.   :1986  
##  nifc  : 121576   1st Qu.:   222557   1st Qu.:33.33   1st Qu.:-113.58   1st Qu.:1996  
##  cnfdb : 234813   Median :   762762   Median :36.62   Median : -94.14   Median :2002  
##                   Mean   : 26697523   Mean   :38.68   Mean   : -97.25   Mean   :2002  
##                   3rd Qu.:  1456633   3rd Qu.:43.94   3rd Qu.: -82.63   3rd Qu.:2007  
##                   Max.   :201940182   Max.   :70.14   Max.   : -52.69   Max.   :2013  
##                                                                                       
##       mon              day            daynum         area_ha         cause_original       cause1   
##  Min.   : 1.000   Min.   : 1.00   Min.   :  1.0   Min.   :     0.0   Min.   : 0.000   Min.   :1.0  
##  1st Qu.: 4.000   1st Qu.: 8.00   1st Qu.: 99.0   1st Qu.:     0.0   1st Qu.: 2.000   1st Qu.:2.0  
##  Median : 6.000   Median :15.00   Median :175.0   Median :     0.3   Median : 5.000   Median :2.0  
##  Mean   : 6.079   Mean   :15.52   Mean   :169.2   Mean   :    60.1   Mean   : 5.313   Mean   :1.9  
##  3rd Qu.: 8.000   3rd Qu.:23.00   3rd Qu.:228.0   3rd Qu.:     1.2   3rd Qu.: 8.000   3rd Qu.:2.0  
##  Max.   :12.000   Max.   :31.00   Max.   :366.0   Max.   :577646.8   Max.   :13.000   Max.   :3.0  
##                                                                                                    
##      cause2         stateprov           agency       
##  Min.   : 0.000   CA     : 196976   ST/C&L :1254551  
##  1st Qu.: 2.000   GA     : 163298   FS     : 206731  
##  Median : 5.000   TX     : 126100   BIA    : 128871  
##  Mean   : 4.475   NC     : 105113   BLM    : 112063  
##  3rd Qu.: 7.000   FL     :  87589   BC     :  85833  
##  Max.   :10.000   BC     :  85833   USFS   :  71387  
##                   (Other):1318956   (Other): 224429

Write out a .csv file

outfileuscan <- "uscan_1986-2013.csv"
write.table(uscan, outfileuscan, sep=",", row.names=FALSE)

Save the .RData file.

# write out merged data
outfilename <- "uscan_1986-2013.RData"
save(uscan,file=outfilename)

2 Basic characterization of the merged data

# Fire frequency
uscan_yearmon_count_all <- table(uscan$year, uscan$mon)
mosaicplot(uscan_yearmon_count_all, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, All Fires, All Agencies -- Fire Frequency")

uscan_yearmon_count_light <- table(uscan$year[uscan$cause1 == 1], uscan$mon[uscan$cause1 == 1])
mosaicplot(uscan_yearmon_count_light, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, Lightning Fires, All Agencies -- Fire Frequency")

uscan_yearmon_count_human <- table(uscan$year[uscan$cause1 == 2], uscan$mon[uscan$cause1 == 2])
mosaicplot(uscan_yearmon_count_human, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, Human Fires, All Agencies -- Fire Frequency")

# Area burned
uscan_yearmon_sum_all <- aggregate(uscan$area_ha, by=list(uscan$year, uscan$mon), sum)
uscan_yearmon_sum_all_mat <- matrix(uscan_yearmon_sum_all$x, nrow=28, ncol=12)
dimnames(uscan_yearmon_sum_all_mat) <- dimnames(uscan_yearmon_count_all)
mosaicplot(uscan_yearmon_sum_all_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, All Fires, All Agencies -- Area Burned")

uscan_yearmon_sum_light <- aggregate(uscan$area_ha[uscan$cause1 == 1], by=list(uscan$year[uscan$cause1 == 1], 
  uscan$mon[uscan$cause1 == 1]), sum)
uscan_yearmon_sum_light_mat <- matrix(uscan_yearmon_sum_light$x, nrow=28, ncol=12)
## Warning in matrix(uscan_yearmon_sum_light$x, nrow = 28, ncol = 12): data length [335] is not a sub-
## multiple or multiple of the number of rows [28]
dimnames(uscan_yearmon_sum_light_mat) <- dimnames(uscan_yearmon_count_light)
mosaicplot(uscan_yearmon_sum_light_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, Lightning Fires, All Agencies -- Area Burned")

uscan_yearmon_sum_human <- aggregate(uscan$area_ha[uscan$cause1 == 2], by=list(uscan$year[uscan$cause1 == 2], 
  uscan$mon[uscan$cause1 == 2]), sum)
uscan_yearmon_sum_human_mat <- matrix(uscan_yearmon_sum_human$x, nrow=28, ncol=12)
dimnames(uscan_yearmon_sum_human_mat) <- dimnames(uscan_yearmon_count_human)
mosaicplot(uscan_yearmon_sum_human_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main="US & Canada, Human Fires, All Agencies -- Area Burned")

2.1 Large fires only

cutsize <- 1.0
uscanlrg <- uscan[uscan$area_ha > cutsize,]
# Fire frequency
uscanlrg_yearmon_count_all <- table(uscanlrg$year, uscanlrg$mon)
mosaicplot(uscanlrg_yearmon_count_all, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, All Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

uscanlrg_yearmon_count_light <- table(uscanlrg$year[uscanlrg$cause1 == 1], uscanlrg$mon[uscanlrg$cause1 == 1])
mosaicplot(uscanlrg_yearmon_count_light, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Lightning Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

uscanlrg_yearmon_count_human <- table(uscanlrg$year[uscanlrg$cause1 == 2], uscanlrg$mon[uscanlrg$cause1 == 2])
mosaicplot(uscanlrg_yearmon_count_human, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Human Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

# Area burned
uscanlrg_yearmon_sum_all <- aggregate(uscanlrg$area_ha, by=list(uscanlrg$year, uscanlrg$mon), sum)
uscanlrg_yearmon_sum_all_mat <- matrix(uscanlrg_yearmon_sum_all$x, nrow=28, ncol=12)
dimnames(uscanlrg_yearmon_sum_all_mat) <- dimnames(uscanlrg_yearmon_count_all)
mosaicplot(uscanlrg_yearmon_sum_all_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, All Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))

uscanlrg_yearmon_sum_light <- aggregate(uscanlrg$area_ha[uscanlrg$cause1 == 1], by=list(uscanlrg$year[uscanlrg$cause1 == 1], 
  uscanlrg$mon[uscanlrg$cause1 == 1]), sum)


uscanlrg_yearmon_sum_light_mat <- matrix(0,nrow=28, ncol=12)
for (i in seq(1:length(uscanlrg_yearmon_sum_light$x))) {
  m <- uscanlrg_yearmon_sum_light$Group.2[i]
  n <- uscanlrg_yearmon_sum_light$Group.1[i]-1986+1
  uscanlrg_yearmon_sum_light_mat[n,m] <- uscanlrg_yearmon_sum_light$x[i]
}

dimnames(uscanlrg_yearmon_sum_light_mat) <- dimnames(uscanlrg_yearmon_count_light)
mosaicplot(uscanlrg_yearmon_sum_light_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Lightning Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))

uscanlrg_yearmon_sum_human <- aggregate(uscanlrg$area_ha[uscanlrg$cause1 == 2], by=list(uscanlrg$year[uscanlrg$cause1 == 2], 
  uscanlrg$mon[uscanlrg$cause1 == 2]), sum)
uscanlrg_yearmon_sum_human_mat <- matrix(uscanlrg_yearmon_sum_human$x, nrow=28, ncol=12)
dimnames(uscanlrg_yearmon_sum_human_mat) <- dimnames(uscanlrg_yearmon_count_human)
mosaicplot(uscanlrg_yearmon_sum_human_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Human Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))

2.2 Larger fires > 100 ha

cutsize <- 100.0
uscanlrg <- uscan[uscan$area_ha > cutsize,]
# Fire frequency
uscanlrg_yearmon_count_all <- table(uscanlrg$year, uscanlrg$mon)
mosaicplot(uscanlrg_yearmon_count_all, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, All Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

uscanlrg_yearmon_count_light <- table(uscanlrg$year[uscanlrg$cause1 == 1], uscanlrg$mon[uscanlrg$cause1 == 1])
mosaicplot(uscanlrg_yearmon_count_light, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Lightning Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

uscanlrg_yearmon_count_human <- table(uscanlrg$year[uscanlrg$cause1 == 2], uscanlrg$mon[uscanlrg$cause1 == 2])
mosaicplot(uscanlrg_yearmon_count_human, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Human Fires >",as.character(cutsize),"ha, All Agencies -- Fire Frequency"))

# Area burned
uscanlrg_yearmon_sum_all <- aggregate(uscanlrg$area_ha, by=list(uscanlrg$year, uscanlrg$mon), sum)
uscanlrg_yearmon_sum_all_mat <- matrix(uscanlrg_yearmon_sum_all$x, nrow=28, ncol=12)
dimnames(uscanlrg_yearmon_sum_all_mat) <- dimnames(uscanlrg_yearmon_count_all)
mosaicplot(uscanlrg_yearmon_sum_all_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, All Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))

uscanlrg_yearmon_sum_light <- aggregate(uscanlrg$area_ha[uscanlrg$cause1 == 1], by=list(uscanlrg$year[uscanlrg$cause1 == 1], 
  uscanlrg$mon[uscanlrg$cause1 == 1]), sum)
uscanlrg_yearmon_sum_light_mat <- matrix(uscanlrg_yearmon_sum_light$x, nrow=28, ncol=12)
## Warning in matrix(uscanlrg_yearmon_sum_light$x, nrow = 28, ncol = 12): data length [241] is not a
## sub-multiple or multiple of the number of rows [28]
uscanlrg_yearmon_sum_light_mat <- matrix(0,nrow=28, ncol=12)
for (i in seq(1:length(uscanlrg_yearmon_sum_light$x))) {
  m <- uscanlrg_yearmon_sum_light$Group.2[i]
  n <- uscanlrg_yearmon_sum_light$Group.1[i]-1986+1
  uscanlrg_yearmon_sum_light_mat[n,m] <- uscanlrg_yearmon_sum_light$x[i]
}

dimnames(uscanlrg_yearmon_sum_light_mat) <- dimnames(uscanlrg_yearmon_count_light)
mosaicplot(uscanlrg_yearmon_sum_light_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Lightning Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))

uscanlrg_yearmon_sum_human <- aggregate(uscanlrg$area_ha[uscanlrg$cause1 == 2], by=list(uscanlrg$year[uscanlrg$cause1 == 2], 
  uscanlrg$mon[uscanlrg$cause1 == 2]), sum)

uscanlrg_yearmon_sum_human_mat <- matrix(0,nrow=28, ncol=12)
for (i in seq(1:length(uscanlrg_yearmon_sum_human$x))) {
  m <- uscanlrg_yearmon_sum_human$Group.2[i]
  n <- uscanlrg_yearmon_sum_human$Group.1[i]-1986+1
  uscanlrg_yearmon_sum_human_mat[n,m] <- uscanlrg_yearmon_sum_human$x[i]
}

dimnames(uscanlrg_yearmon_sum_human_mat) <- dimnames(uscanlrg_yearmon_count_human)
mosaicplot(uscanlrg_yearmon_sum_human_mat, color=monthcolors, cex.axis=0.6, las=3, 
  main=paste("US & Canada, Human Fires >",as.character(cutsize),"ha, All Agencies -- Area Burned"))