• Download at any project and/or observed data on a climate or a meteorological variable. • Describe its spatiotemporal domain and dimension (2 points)
Data from: - Carbon Monoxide data: https://www.epa.gov/outdoor-air-quality-data/download-daily-data - Wildfire data: https://frap.fire.ca.gov/mapping/gis-data/
cali_co<- read_csv("california.2018.co.csv",
col_types = cols(Date = col_date(format = "%m/%d/%y")))
#CO data from California in 2018 (daily data)
wildfires<-st_read("/Users/katyhaller/Library/Mobile Documents/com~apple~CloudDocs/R Directory/EPH 727/EPH 727/Class Project/fire19_1_geojson.gdb/firep19_1.geojson", quiet = TRUE) %>%
st_transform(crs="+init=epsg:4326") %>% #adding projection info
ms_simplify(.) #cleaning up the file so it's isn't so big
#2018 wildfire data
names(st_geometry(wildfires)) = NULL
#ms_simplify adds names to Geometry -- this will impede visualization later.
#summary(wildfires) #found that YEAR_ is a character string - no good!
wildfires$YEAR_ <- as.numeric(wildfires$YEAR_) #changing from char to num
wildfires2018 <- filter(wildfires, YEAR_==2018) #the data has many years - I want the 2018 fire season
#summary(cali_co) #want to know geographic extent
#recoding the fire CAUSE information using metadata from https://frap.fire.ca.gov/frap-projects/fire-perimeters/
wildfires2018$CAUSE <- recode_factor(
wildfires2018$CAUSE,
`1` = "Lightning",
`2` = "Equipment Use",
`3` = "Smoking",
`4` = "Campfire",
`5` = "Debris",
`6` = "Railroad",
`7` = "Arson",
`8` = "Playing with Fire",
`9` = "Miscellaneous",
`10` = "Vehicle",
`11` = "Power Line",
`12` = "Firefighter Training",
`13` = "Non-Firefighter Training",
`14` = "Unknown/Unidentified",
`15` = "Structure",
`16` = "Aircraft",
`17` = "Volcanic",
`18` = "Escaped Prescribed Burn",
`19` = "Illegal Alien Campfire"
)
wildfires2018$FIRE_NAME <- str_to_title(wildfires2018$FIRE_NAME) #string was all caps, cleaning it up to look nicer when mapped
summary(wildfires2018) #says minimum alarm date is in the year 0208
## YEAR_ STATE AGENCY UNIT_ID
## Min. :2018 Length:213 Length:213 Length:213
## 1st Qu.:2018 Class :character Class :character Class :character
## Median :2018 Mode :character Mode :character Mode :character
## Mean :2018
## 3rd Qu.:2018
## Max. :2018
##
## FIRE_NAME INC_NUM ALARM_DATE
## Length:213 Length:213 Min. :0208-11-13 00:00:00
## Class :character Class :character 1st Qu.:2018-06-24 00:00:00
## Mode :character Mode :character Median :2018-07-19 12:00:00
## Mean :2010-01-10 22:08:11
## 3rd Qu.:2018-08-31 06:00:00
## Max. :2018-11-16 00:00:00
## NA's :1
## CONT_DATE CAUSE COMMENTS
## Min. :2018-02-24 19:00:00 Unknown/Unidentified:75 Length:213
## 1st Qu.:2018-06-28 20:00:00 Lightning :31 Class :character
## Median :2018-08-02 20:00:00 Miscellaneous :30 Mode :character
## Mean :2018-08-12 07:49:39 Equipment Use :23
## 3rd Qu.:2018-09-15 20:00:00 Power Line :14
## Max. :2019-08-18 20:00:00 (Other) :38
## NA's :4 NA's : 2
## REPORT_AC GIS_ACRES C_METHOD OBJECTIVE
## Min. : 0.0 Min. : 1.2 Min. :1.00 Min. :1
## 1st Qu.: 53.5 1st Qu.: 60.0 1st Qu.:1.00 1st Qu.:1
## Median : 117.0 Median : 171.9 Median :1.00 Median :1
## Mean : 7910.0 Mean : 7461.1 Mean :2.62 Mean :1
## 3rd Qu.: 672.9 3rd Qu.: 939.3 3rd Qu.:3.00 3rd Qu.:1
## Max. :410203.0 Max. :410202.5 Max. :8.00 Max. :1
## NA's :38
## FIRE_NUM Shape_Length Shape_Area geometry
## Length:213 Min. : 393 Min. :4.912e+03 MULTIPOLYGON :213
## Class :character 1st Qu.: 2761 1st Qu.:2.447e+05 epsg:NA : 0
## Mode :character Median : 5099 Median :7.022e+05 +proj=long...: 0
## Mean : 21012 Mean :3.020e+07
## 3rd Qu.: 12328 3rd Qu.:3.801e+06
## Max. :390421 Max. :1.660e+09
##
wildfires2018["36", "ALARM_DATE"] <- "2018-11-13 00:00:00" #editing the incorrect value
#summary(wildfires2018) looks better!
Spatial Domain Latitude domain: (32.68, 40.78) Longitude domain: (-124.2, -115.5)
Temporal domain: (January 1, 2018 - December 1, 2018) Resolution: Daily
Spatial Domain .gdb format – doesn’t have latitude/longitude listed data downloaded shouldn’t exceed the extent of the state of California
Temporal domain: Fire alarm date: (February 18, 2018 - November 16, 2018) Fire containment date: (February 24, 2018 - August 18, 2019) Resolution: For some fires, daily; for others, down to the second
• Generate basic statistical description of the variable you downloaded, draw graphs and provide description of its statistical distribution (such as a frequency histogram, its spatial and/or temporal distribution) (4 points)
#map of measurement sites
maps::map("state", fill = TRUE, col = "white", lty = 0, bg = "lightblue", xlim = c(-125, -114), ylim = c(32, 43))
maps::map("state", fill = FALSE, interior = TRUE, col = "grey", add = TRUE)
points(cali_co$SITE_LONGITUDE,cali_co$SITE_LATITUDE, pch=1, cex=.5, col="red")
title("Map of Carbon Monoxide Measurement Sites")
#histogram
hist(cali_co$`Daily Max 8-hour CO Concentration`,
main = "Daily Maximum 8-Hour CO Concentration",
xlab = "Concentration (ppm)") # shows all of the daily max data
#concentration by date and county
cali_co %>%
ggplot( aes(x=cali_co$Date, y=cali_co$`Daily Max 8-hour CO Concentration`,
group=cali_co$COUNTY, color=cali_co$COUNTY)) +
geom_line() +
theme_ipsum() +
scale_x_date(name="Date") +
scale_y_continuous(name="[Carbon Monoxide] (ppm)") +
geom_point(aes(color=cali_co$COUNTY)) +
labs(color = "County", title = "Outdoor CO Concentration", subtitle = "California, 8-Hour Maximum, 2018",caption = "Daily data from EPA.gov")
#agg_cali_co will the the aggregated CO data for california containing the mean and maximum 8-hr [CO] max
agg_cali_co <- aggregate(cbind(cali_co$SITE_LATITUDE,cali_co$SITE_LONGITUDE,cali_co$`Daily Max 8-hour CO Concentration`), by=list(cali_co$`Site Name`), FUN=mean, data=cali_co)
names(agg_cali_co) <- c("Site","Latitude","Longitude","mean_8hourmax")
#names(cali_co)
#max cali-co will temporarily be used to grab max data
max_cali_co <- aggregate(cali_co[,5], max, by=list(cali_co$`Site Name`))
names(max_cali_co) <- c("Site","max_8hourmax")
#merging so that agg_cali_co has the mean and maxes together in one object
agg_cali_co <- merge.data.frame(agg_cali_co, max_cali_co, by = "Site")
#creating a variable for radii of circles in the map
agg_cali_co <- mutate(agg_cali_co, meradius=2*(mean_8hourmax))
agg_cali_co <- mutate(agg_cali_co, mxradius=2*(max_8hourmax))
#HTML map
m <- leaflet() %>%
#centers the view at the mean latitude/longitude of my observations
setView(lng=-119.7, lat=35.82, zoom=6 ) %>%
#base maps
addProviderTiles("Esri.WorldImagery", group="Topographic") %>%
addTiles(options = providerTileOptions(noWrap = TRUE), group="Political") %>%
addMiniMap(toggleDisplay = TRUE, tiles = providers$Esri.WorldGrayCanvas,) %>%
# marker groups using HTML to format pop-ups
addPolygons(data = wildfires2018 %>% slice(1:nrow(wildfires2018)), fill = TRUE, stroke = TRUE, color = "orange", group = "2018 Wildfires", popup = ~paste("<b>",FIRE_NAME," Fire</b>","<br> Start Date:", ALARM_DATE,"<br> Containment Date:", CONT_DATE,"<br> Cause:", CAUSE, "<br><a href='https://www.fire.ca.gov/incidents/2018/' target='_blank'>Visit Cal Fire for more info</a></b>"), weight = 1, opacity = 1, fillOpacity = .8) %>%
addCircleMarkers(data=agg_cali_co, lng=~Longitude , lat=~Latitude, radius= ~meradius , color="black", weight = 1,
fillColor="yellow", stroke = TRUE, fillOpacity = 0.8, group="Mean 8-Hour Max", popup = ~paste("<b>", Site,"</b> [2018 Mean]","<br> 8-hour Maximum CO Concentration (ppm):", round(mean_8hourmax, 2), "<br><a href='https://www.epa.gov/outdoor-air-quality-data/download-daily-data' target='_blank'>Taken from EPA Data</a></b>")) %>%
addCircleMarkers(data=agg_cali_co, lng=~Longitude , lat=~Latitude, radius= ~mxradius , color="black", weight = 1,
fillColor="red", stroke = TRUE, fillOpacity = 0.8, group="Maximum 8-Hour Max", popup = ~paste("<b>", Site,"</b> [Yearly Max]","<br> 8-hour Maximum CO Concentration (ppm):", round(max_8hourmax, 2), "<br><a href='https://www.epa.gov/outdoor-air-quality-data/download-daily-data' target='_blank'>Taken from EPA Data</a></b>")) %>%
addLegend("bottomright", colors = c("yellow", "red", "orange"), labels = c("Yearly Mean CO (ppm)", "Yearly Maximum CO (ppm)", "Wildfire Perimeters"), title = "Legend") %>%
#control widget
addLayersControl(overlayGroups = c("Mean 8-Hour Max", "Maximum 8-Hour Max", "2018 Wildfires") , baseGroups = c("Topographic","Political"),
options = layersControlOptions(collapsed = TRUE))
m #shows m in Markdown
saveWidget(m, file=paste0("Map of CA CO Levels 2018.html")) #saving HTML widget
• Generate a map of this variable using data for one point in time and provide its interpretations (4 points).
cali_co_119 <- filter(cali_co, Date=="2018-11-09") #the data has many years - I want the 2018 fire season
wildfires119 <- filter(wildfires2018, ALARM_DATE <= "2018-11-09")
cali_co_119 <- mutate(cali_co_119, meradius=2*(`Daily Max 8-hour CO Concentration`))
I chose data from 11/9/2018 - this is the day with the largest observed 8-hour max CO concentration. I kept fires that started on or before 11/9/2018. Fires contained before 11/9/2018 were kept because there is not a “fire exterminated” date included in the data. A fire that is contained but still burning could still be releasing carbon monoxide and other air pollution that would impact human health.
#HTML map
n <- leaflet() %>%
#centers the view at the mean latitude/longitude of my observations
setView(lng=-119.7, lat=35.82, zoom=6 ) %>%
#base maps
addProviderTiles("Esri.WorldImagery", group="Topographic") %>%
addTiles(options = providerTileOptions(noWrap = TRUE), group="Political") %>%
addMiniMap(toggleDisplay = TRUE, tiles = providers$Esri.WorldGrayCanvas,) %>%
# marker groups using HTML to format pop-ups
addPolygons(data = wildfires119 %>% slice(1:nrow(wildfires2018)), fill = TRUE, stroke = TRUE, color = "orange", group = "Wildfires", popup = ~paste("<b>",FIRE_NAME," Fire</b>","<br> Start Date:", ALARM_DATE,"<br> Containment Date:", CONT_DATE,"<br> Cause:", CAUSE, "<br><a href='https://www.fire.ca.gov/incidents/2018/' target='_blank'>Visit Cal Fire for more info</a></b>"), weight = 1, opacity = 1, fillOpacity = .8) %>%
addCircleMarkers(data=cali_co_119 , lng=~SITE_LONGITUDE , lat=~SITE_LATITUDE, radius= ~meradius , color="black", weight = 1,
fillColor="yellow", stroke = TRUE, fillOpacity = 0.8, group="Max 8-Hour CO Concentration", popup = ~paste("<b>", `Site Name`,"</b> [2018 Mean]","<br> 8-hour Maximum CO Concentration (ppm):", `Daily Max 8-hour CO Concentration`, "<br><a href='https://www.epa.gov/outdoor-air-quality-data/download-daily-data' target='_blank'>Taken from EPA Data</a></b>")) %>%
addLegend("bottomright", colors = c("yellow","orange"), labels = c("Max 8-hour CO Concentration (ppm)", "Wildfire Perimeters"), title = "Legend - 11/9/2018 Data") %>%
#control widget
addLayersControl(overlayGroups = c("Wildfires", "Max 8-Hour CO Concentration") , baseGroups = c("Topographic","Political"),
options = layersControlOptions(collapsed = TRUE))
n #shows m in Markdown
saveWidget(n, file=paste0("Map of CA CO Levels 11-9-2018.html")) #saving HTML widget
The largest concentration is seen at the Chico-East Avenue site. This site is very close to the Camp Fire (started by power line) that is reported as alarmed on 11/8/2018. It makes sense that the day after the fire starts, we see a spike in carbon monoxide concentration at the closest measurement site. Additionally, this fire occurred in a residential area – not the usual forestry of other wildfires. According to https://www.fire.ca.gov/incidents/2018/11/8/camp-fire/#incident-maps this fire had significant confirmed damage: 18,804 structures were destroyed, 3 people were injured, and 85 people died as a result of the fire. By 11/9/2018, this fire had consumed 102,985 acres of land. It is likely that in addition to significant carbon monoxide pollution, the residents of Butte county were exposed to significant amounts of fine (PM 2.5) and ultrafine (PM 0.1) particulate matter. This is significant for human health because this matter can reach deeply into the lungs, causing alveolar injury and potentially also participating in gas exchange. In addition to fire prevention efforts, individuals in at-risk areas should be educated on personal protection from outdoor air pollution. Local health providers also need to be prepared for a sudden influx in respiratory injuries, illnesses, and disease exacerbations.