Plots a traditional wind rose plot for wind direction and PM2.5.

sensor_pollutionRose(
  sensor = NULL,
  windData = NULL,
  statistic = "prop.count",
  key = TRUE,
  keyPosition = "right",
  annotate = TRUE,
  angle = 30,
  angleScale = 315,
  gridLine = NULL,
  breaks = 6,
  paddle = FALSE,
  seg = 0.9,
  normalize = FALSE,
  verbose = TRUE
)

Arguments

sensor

an 'airsensor' object

windData

a dataframe containing columns "date", "ws", and "wd".

statistic

The statistic to be applied to each data bin in the plot. Options currently include “prop.count”, “prop.mean” and “abs.count”. The default “prop.count” sizes bins according to the proportion of the frequency of measurements. Similarly, “prop.mean” sizes bins according to their relative contribution to the mean. “abs.count” provides the absolute count of measurements in each bin.

key

control of the scale key via drawOpenKey. See drawOpenKey for further details.

keyPosition

location where the scale key is to plotted. Allowed arguments currently include “top”, “right”, “bottom” and “left”.

annotate

If TRUE then the percentage calm and mean values are printed in each panel together with a description of the statistic below the plot. If " " then only the stastic is below the plot. Custom annotations may be added by setting value to c("annotation 1", "annotation 2").

angle

default angle of “spokes” is 30. Other potentially useful angles are 45 and 10. Note: the width of the wind speed interval may need adjusting using width.

angleScale

The wind speed scale is by default shown at a 315 degree angle. Sometimes the placement of the scale may interfere with an interesting feature. The user can therefore set angle.scale to another value (between 0 and 360 degrees) to mitigate such problems. For example angleScale = 45 will draw the scale heading in a NE direction.

gridLine

Grid line interval to use. If NULL, as in default, this is assigned by based on the available data range. However, it can also be forced to a specific value, e.g. gridLine = 10. grid.line can also be a list to control the interval, line type and colour. For example gridLine = list(value = 10, lty = 5, col = "purple").

breaks

the number of break points for wind speed in pollutant

paddle

Either TRUE (default) or FALSE. If TRUE plots rose using ‘paddle’ style spokes. If FALSE plots rose using ‘wedge’ style spokes.

seg

determines with width of the segments. For example, seg = 0.5 will produce segments 0.5 * angle.

normalize

if TRUE each wind direction segment is normalized to equal one. This is useful for showing how the concentrations (or other parameters) contribute to each wind sector when the proprtion of time the wind is from that direction is low. A line showing the probability that the wind.

verbose

Logical controlling the generation of progress and error messages.

Value

a plot or a dataframe

Examples

# \donttest{
# Fail gracefully if any resources are not available
try({

library(AirSensor)

# Set default location of pre-generated data files
setArchiveBaseUrl("https://airsensor.aqmd.gov/PurpleAir/v1")

pas <- pas_load(archival = TRUE)
pat <- pat_loadMonth(label = "SCBB_02", pas = pas, datestamp = 202005)
sensor <- pat_createAirSensor(pat)

# Load wind data from NOAA
windData <- worldmet::importNOAA(
  code = "722975-53141", 
  year = 2020
)
windData <- dplyr::select(windData, c("date", "wd", "ws"))

# Plot rose using mean binning
sensor_pollutionRose(sensor, windData, statistic = "prop.mean")

}, silent = FALSE)
#> ERROR [2023-04-03 16:31:36] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230403_archival.rda
#> ERROR [2023-04-03 16:31:36] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230402_archival.rda
#> ERROR [2023-04-03 16:31:36] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230401_archival.rda
#> ERROR [2023-04-03 16:31:36] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230331_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230330_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230329_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230328_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230327_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230326_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230325_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230324_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230323_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230322_archival.rda
#> ERROR [2023-04-03 16:31:37] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230321_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230320_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230319_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230318_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230317_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230316_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230315_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230314_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230313_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230312_archival.rda
#> ERROR [2023-04-03 16:31:38] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230311_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230310_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230309_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230308_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230307_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230306_archival.rda
#> ERROR [2023-04-03 16:31:39] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230305_archival.rda
#> Error : Data file could not be loaded after 30 tries
# }