-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCHM210_Assignment3-2022.rmd
More file actions
86 lines (51 loc) · 6.03 KB
/
CHM210_Assignment3-2022.rmd
File metadata and controls
86 lines (51 loc) · 6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: "CHM210 Assignment 3"
output:
html_document:
toc: false
number_sections: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
Fine inorganic particulate matter ($PM_{2.5}$) is an important environmental pollutant, and is considered by the WHO to be a major contributor to human mortality and morbidity. In this assignment, you will plot NAPS $PM_{2.5}$ geographically using `leaflet()` to examine geographical trends.
##Importing the required packages.
To complete this assignment, students are expected to need to utilize the `tidyverse` and `leaflet` packages. RStudio should provide a prompt for you to install any of the packages needed if not already installed, but you can run the following code to install those packages if needed.
```{r install-tidy, eval = FALSE}
install.packages("tidyverse")
install.packages("leaflet")
install.packages("readr")
```
If already installed, or once having been installed, students should load these packages in the code block below:
```{r load-tidy, message = FALSE, warning = FALSE}
x <- c("tidyverse", "leaflet", "readr")
lapply(x, library, character.only = TRUE)
```
\newpage
# Assignment Questions
1. Please submit your code in `.html` file format, generated using R Markdown, with text used in between code chunks to break up and explain different parts of the assignment, in addition to a copy of your code in the `.RMD` file format.
#PM2.5 Data Plotting
2. Record the year your data is from below, and upload a copy of your data file to MarkUs.
3. Using `leaflet()`, generate an interactive plot showing the 24-hour average concentrations of $PM_{2.5}$ across Canada from your assigned year. Using separate layers for your figure, plot the maximum and mean $PM_{2.5}$ levels. Your map should include:
Circle markers at each sampling location
The circle markers should be labelled with their $PM_{2.5}$ concentration
The circle markers should be colored in proportion to the measured concentrations. Students may either set the colours manually, or automatically, but should take care that the data is well represented by their colour range, without being unduly skewed by outliers. (If your points use just two shades to represent the data, that's bad.)
Define a function named pal for palette = "Blues", of domain PM_sol$Mean
Define a function named pal2 for palette = "Greens", of domain log(PM_sol$Maximum,10)
Your map should include a legend that can be used to enable or disable each layer of the plot.
Students are encouraged to review the Assignment 3 tutorial if any aspects of mapping with `leaflet()` is unclear to them. Note that you must output your R Markdown file in `.html` format in order for the plots to remain interactive after export. You will run into errors if you try to output the file in `.pdf` format, as this format is not compatible with maps generated by `leaflet`.
4. Calculate the minimum, maximum and median concentrations for the mean $PM_{2.5}$ column. Save them into variable names as following: PM_min, PM_max, PM_median.
5. Comment on the distribution of $PM_{2.5}$ concentrations across Canada. Are there any patterns in the distribution of high $PM_{2.5}$ concentrations? For the purpose of this question, you should consider any value that is a factor of 2 or greater than the median to be a "high" value. Some factors you may wish to consider are human (e.g. urban/rural), physical (e.g. coastal/continental) or jurisdictional (e.g. provincial borders) geography.
6. Report the minimum, maximum and median concentrations for the maximum $PM_{2.5}$ column. Approximately how much larger is the maximum concentration than the median concentration? (e.g. if the median was 10, and the maximum was 100, the maximum is 10x larger) How does this compare with the ratio between the maximum and median concentrations you reported in question 5?
7. Comment on the distribution of the maximum $PM_{2.5}$ concentrations across Canada. Are there any patterns in the distribution of high $PM_{2.5}$ concentrations? For the purposes of this question, you may consider any value that is a factor of 2 or greater than the median to be a "high" value, but if there are any locations that are much higher than most of the sites in your dataset, you should focus on those sites instead. As in question 6, you may wish to consider human, physical or jurisdictional geography in answering this question.
##Wildfire plotting
8. Import the wildfire data provided to you on Quercus, assign it to a variable, and filter (subset) that data to the year that matches your $PM_{2.5}$ data, and contains only fires that burned 200+ hectares of land. (i.e. `SIZE_HA`) Note that you can use the code snippet below to import the fires data from the the provided .zip file.
```{r}
Fires <- read_csv(unzip("NFDB_point_20210916.zip","NFDB_point_20210916.txt"))
```
9. With the same criteria and techniques used in question 3, add the reported wildfires to your $PM_2.5$ map. The final product should have variably coloured circle labels for the mean and maximum $PM_{2.5}$, as well as the reported wildfires, each of which can be selected for displaying using the `leaflet` layer tool.
Hint: Define a function called pal3 using palette = "Reds", of domain of the log of Fires2016_sol$SIZE_HA,10
10. Do you observe any relationship between either the number of fires or the fire size and the mean $PM_{2.5}$ values on your map? If so, what is the relationship?
11. Do you observe any relationship between either the number of fires or the fire size and the maximum $PM_{2.5}$ values on your map? If so, what is the relationship?
12. The regulatory policy of the government of Canada sets limits for $PM_{2.5}$ that provinces are responsible for meeting. However, there is a controversial policy that provinces are permitted to disregard violations of the air quality standards if the air responsible has been influenced by wildfires. Considering the map you created in this assignment, as well as your answers to questions 10 and 11, make an argument for why this is, or is not, a good policy for Environment Canada to have.