variables:
FM100 is a matrix of columns: year, day (all years set to 366 days), region
1, region 2... region N
columnID<- region # +2
numberFires is the number of fires that occurred in the region (the code
assures there are more than 0 fires)
years is a vector of fire years as pertains to each fire counted in
numberFires
explanatory.variables$DOY is a vector of Day-of-Year for each fires start
day
code:
#Read FM100 file
if (REGION_SCALE ==
"psa"){FM100<-read.csv("climaggregates/fm100_psa.csv",
header=FALSE,col.names=c("year","day",psa$OBJECTID))}
if (REGION_SCALE ==
"ecosection"){FM100<-read.csv("climaggregates/fm100_ecp.csv",
header=FALSE,col.names=c("year","day",ecosection$OBJECTID))}
for (i in 1:numberFires){
index_yr<-which(FM100$year==years[i])
# file default 366 days/year w/ Feb 29 set to NAN, but DOY accounts
for leap years when
# assigning Day-of-year for mm-dd-yyyy
if (years[i]%%4 != 0) {index_day<-explanatory.variables$DOY[i]+1}
if (years[i]%%4 == 0) {index_day<-explanatory.variables$DOY[i]}
index<-index_yr[index_day]
# 10 day antecedent FM100 average
explanatory.variables$FM100[i]<-mean(FM100[(index-9):index,columnID])
}
rm(FM100)
print("FM100 variables created")
What's in each variable:
6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969
6970 6971 6972 6973 6974 6975 6976 6977 .... [index: 346] 7300 7301 7302
7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317
7318 7319 7320
FM100[(index-9):index,columnID]