| polarFreq | R Documentation |
polarFreq primarily plots wind speed-direction frequencies in
‘bins’. Each bin is colour-coded depending on the frequency of
measurements. Bins can also be used to show the concentration of pollutants
using a range of commonly used statistics.
polarFreq(
mydata,
pollutant = NULL,
ws = "ws",
wd = "wd",
statistic = "frequency",
ws.int = 1,
wd.nint = 36,
grid.line = 5,
limits = NULL,
breaks = NULL,
trans = "sqrt",
cols = "default",
type = "default",
min.bin = 1,
ws.upper = NA,
angle.scale = 45,
offset = 10,
border.col = "transparent",
key.title = paste(statistic, pollutant, sep = " "),
key.position = "right",
auto.text = TRUE,
plot = TRUE,
key = NULL,
...
)
mydata |
A data frame minimally containing a wind speed, a decimal wind
direction, and |
pollutant |
Mandatory. A pollutant name corresponding to a variable in a
data frame should be supplied e.g. |
ws |
The name of the column in |
wd |
The name of the column in |
statistic |
The statistic that should be applied to each wind speed/direction bin. Can be one of:
Note that for options other than |
ws.int |
Wind speed interval assumed. In some cases e.g. a low met mast, an interval of 0.5 may be more appropriate. |
wd.nint |
Number of intervals of wind direction. |
grid.line |
Radial spacing of grid lines. |
limits |
The limits of the colour scale, in the form |
breaks |
|
trans |
Should a transformation be applied to the colour scale? If the distribution of data is skewed, the default scale may be dominated by a few high values, so a log or square-root transform may mean the whole colour scale is better presented on the plot. Can be:
|
cols |
Colours to use for plotting. Can be a pre-set palette (e.g.,
|
type |
Character string(s) defining how data should be split/conditioned
before plotting.
Most |
min.bin |
The minimum number of points allowed in a wind speed/wind
direction bin. The default is 1. A value of two requires at least 2 valid
records in each bin an so on; bins with less than 2 valid records are set
to NA. Care should be taken when using a value > 1 because of the risk of
removing real data points. It is recommended to consider your data with
care. Also, the |
ws.upper |
A user-defined upper wind speed to use. This is useful for
ensuring a consistent scale between different plots. For example, to always
ensure that wind speeds are displayed between 1-10, set |
angle.scale |
In radial plots (e.g., |
offset |
|
border.col |
The colour of the boundary of each wind speed/direction bin. The default is transparent. Another useful choice sometimes is "white". |
key.title |
Used to set the title of the legend. The legend title is
passed to |
key.position |
Location where the legend is to be placed. Allowed
arguments include |
auto.text |
Either |
plot |
When |
key |
Deprecated; please use |
... |
Addition options are passed on to
|
polarFreq is its default use provides details of wind speed and direction
frequencies. In this respect it is similar to windRose(), but considers
wind direction intervals of 10 degrees and a user-specified wind speed
interval. The frequency of wind speeds/directions formed by these
‘bins’ is represented on a colour scale.
The polarFreq function is more flexible than either windRose() or
polarPlot(). It can, for example, also consider pollutant concentrations
(see examples below). Instead of the number of data points in each bin, the
concentration can be shown. Further, a range of statistics can be used to
describe each bin - see statistic above. Plotting mean concentrations is
useful for source identification and is the same as polarPlot() but without
smoothing, which may be preferable for some data. Plotting with statistic = "weighted.mean" is particularly useful for understanding the relative
importance of different source contributions. For example, high mean
concentrations may be observed for high wind speed conditions, but the
weighted mean concentration may well show that the contribution to overall
concentrations is very low.
polarFreq also offers great flexibility with the scale used and the user
has fine control over both the range, interval and colour.
an openair object
David Carslaw
Other polar directional analysis functions:
percentileRose(),
polarAnnulus(),
polarCluster(),
polarDiff(),
polarPlot(),
pollutionRose(),
windRose()
# basic wind frequency plot
polarFreq(mydata)
# wind frequencies by year
## Not run:
polarFreq(mydata, type = "year")
## End(Not run)
# mean SO2 by year, showing only bins with at least 2 points
## Not run:
polarFreq(mydata, pollutant = "so2", type = "year", statistic = "mean", min.bin = 2)
## End(Not run)
# weighted mean SO2 by year, showing only bins with at least 2 points
## Not run:
polarFreq(mydata,
pollutant = "so2", type = "year", statistic = "weighted.mean",
min.bin = 2
)
## End(Not run)
# windRose for just 2000 and 2003 with different colours
## Not run:
polarFreq(subset(mydata, format(date, "%Y") %in% c(2000, 2003)),
type = "year", cols = "turbo"
)
## End(Not run)
# user defined breaks from 0-700 in intervals of 100 (note linear scale)
## Not run:
polarFreq(mydata, breaks = seq(0, 700, 100))
## End(Not run)
# more complicated user-defined breaks - useful for highlighting bins
# with a certain number of data points
## Not run:
polarFreq(mydata, breaks = c(0, 10, 50, 100, 250, 500, 700))
## End(Not run)
# source contribution plot and use of offset option
## Not run:
polarFreq(
mydata,
pollutant = "pm25",
statistic = "weighted.mean",
offset = 50,
ws.int = 25,
trans = FALSE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.