Plot a ppi on a Stamen Maps, OpenStreetMap, Google Maps or Naver Map base layer map using ggmap.

map(x, ...)

# S3 method for ppi
map(
  x,
  map,
  param,
  alpha = 0.7,
  xlim,
  ylim,
  zlim = c(-20, 20),
  ratio,
  radar_size = 3,
  radar_color = "red",
  n_color = 1000,
  radar.size = 3,
  radar.color = "red",
  n.color = 1000,
  palette = NA,
  ...
)

Arguments

x

An object of class ppi.

...

Arguments passed to low level ggmap function.

map

The basemap to use, result of a call to download_basemap.

param

The scan parameter to plot.

alpha

Transparency of the data, value between 0 and 1.

xlim

Range of x values to plot (degrees longitude), as atomic vector of length 2.

ylim

Range of y values to plot (degrees latitude), as an atomic vector of length 2.

zlim

The range of values to plot.

ratio

Aspect ratio between x and y scale, by default \(1/cos(latitude radar * pi/180)\).

radar_size

Size of the symbol indicating the radar position.

radar_color

Color of the symbol indicating the radar position.

n_color

The number of colors (>=1) to be in the palette.

radar.size

Deprecated argument, use radar_size instead.

radar.color

Deprecated argument, use radar_color instead.

n.color

Deprecated argument, use n_color instead.

palette

(Optional) character vector of hexadecimal color values defining the plot color scale, e.g. output from viridis

Value

A ggmap object (a classed raster object with a bounding box attribute).

Details

Available scan parameters for mapping can by printed to screen by summary(x). Commonly available parameters are:

"DBZH", "DBZ"

(Logged) reflectivity factor (dBZ)

"TH", "T"

(Logged) uncorrected reflectivity factor (dBZ)

"VRADH", "VRAD"

Radial velocity (m/s). Radial velocities towards the radar are negative, while radial velocities away from the radar are positive

"RHOHV"

Correlation coefficient (unitless) Correlation between vertically polarized and horizontally polarized reflectivity factor

"PHIDP"

Differential phase (degrees)

"ZDR"

(Logged) differential reflectivity (dB)

The scan parameters are named according to the OPERA data information model (ODIM), see Table 16 in the ODIM specification.

Methods (by class)

  • map(ppi): plot a 'ppi' object on a map

Examples

# load an example scan:
data(example_scan)
# make ppi's for all scan parameters in the scan
ppi <- project_as_ppi(example_scan)
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
# \dontrun{
# grab a basemap that matches the extent of the ppi:
# using a gray-scale basemap:
basemap <- download_basemap(ppi, maptype = "toner-lite")
#> Downloading zoom = 9 ...
#> Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.

# map the radial velocity scan parameter onto the basemap:
map(ppi, map = basemap, param = "VRADH")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# extend the plotting range of velocities, from -50 to 50 m/s:
map(ppi, map = basemap, param = "VRADH", zlim = c(-50, 50))
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# map the reflectivity on a terrain basemap:
basemap <- download_basemap(ppi, maptype = "terrain")
#> Downloading zoom = 9 ...
#> Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
map(ppi, map = basemap, param = "DBZH")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# change the color palette, e.g. Viridis colors:
map(ppi, map = basemap, param = "DBZH", palette = viridis::viridis(100), zlim=c(-10,10))
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# give the data more transparency:
map(ppi, map = basemap, param = "DBZH", alpha = 0.3)
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# change the appearance of the symbol indicating the radar location:
map(ppi, map = basemap, radar_size = 5, radar_color = "blue")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html


# crop the map:
map(ppi, map = basemap, xlim = c(12.4, 13.2), ylim = c(56, 56.5))
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: Removed 1 rows containing missing values (geom_rect).

# }