Skip to contents

This function plots back trajectories on a leaflet map. This function requires that data are imported using the openair::importTraj() function.

Usage

trajLevelMap(
  data,
  longitude = "lon",
  latitude = "lat",
  pollutant,
  control = "default",
  smooth = FALSE,
  statistic = "frequency",
  percentile = 90,
  lon.inc = 1,
  lat.inc = 1,
  min.bin = 1,
  .combine = NA,
  sigma = 1.5,
  cols = "default",
  alpha = 0.5,
  tile.border = NA,
  provider = "OpenStreetMap"
)

Arguments

data

Data frame, the result of importing a trajectory file using openair::importTraj().

latitude, longitude

The decimal latitude/longitude.

pollutant

Pollutant to be plotted. By default the trajectory height is used.

control

Used for splitting the trajectories into different groups which can be selected between using a "layer control" menu. Passed to openair::cutData().

smooth

Should the trajectory surface be smoothed? Defaults to FALSE. Note that, when smooth = TRUE, no popup information will be available.

statistic

Statistic to use for trajLevel(). By default, the function will plot the trajectory frequencies (statistic = "frequency"). As an alternative way of viewing trajectory frequencies, the argument method = "hexbin" can be used. In this case hexagonal binning of the trajectory points (i.e., a point every three hours along each back trajectory). The plot then shows the trajectory frequencies uses hexagonal binning.

There are also various ways of plotting concentrations.

It is possible to set statistic = "difference". In this case trajectories where the associated concentration is greater than percentile are compared with the the full set of trajectories to understand the differences in frequencies of the origin of air masses. The comparison is made by comparing the percentage change in gridded frequencies. For example, such a plot could show that the top 10\ tend to originate from air-mass origins to the east.

If statistic = "pscf" then a Potential Source Contribution Function map is produced. This statistic method interacts with percentile.

If statistic = "cwt" then concentration weighted trajectories are plotted.

If statistic = "sqtba" then Simplified Quantitative Transport Bias Analysis is undertaken. This statistic method interacts with .combine and sigma.

percentile

The percentile concentration of pollutant against which the all trajectories are compared.

lon.inc, lat.inc

The longitude and latitude intervals to be used for binning data.

min.bin

The minimum number of unique points in a grid cell. Counts below min.bin are set as missing.

.combine

When statistic is "SQTBA" it is possible to combine lots of receptor locations to derive a single map. .combine identifies the column that differentiates different sites (commonly a column named "site"). Note that individual site maps are normalised first by dividing by their mean value.

sigma

For the SQTBA approach sigma determines the amount of back trajectory spread based on the Gaussian plume equation. Values in the literature suggest 5.4 km after one hour. However, testing suggests lower values reveal source regions more effectively while not introducing too much noise.

cols

Colours to be used for plotting. Options include "default", "increment", "heat", "turbo" and RColorBrewer colours — see the openair::openColours() function for more details. For user defined the user can supply a list of colour names recognised by R (type grDevices::colours() to see the full list). An example would be cols = c("yellow", "green", "blue").

alpha

Opacity of the tiles. Must be between 0 and 1.

tile.border

Colour to use for the border of binned tiles. Defaults to NA, which draws no border.

provider

The base map to be used. See http://leaflet-extras.github.io/leaflet-providers/preview/ for a list of all base maps that can be used.

Value

A leaflet object.

See also

the original openair::trajLevel()

trajLevelMapStatic() for the static ggplot2 equivalent of trajLevelMap()

Other interactive trajectory maps: trajMap()

Examples

if (FALSE) {
trajLevelMap(traj_data, pollutant = "pm2.5", statistic = "pscf", min.bin = 10)
}