Skip to contents

The plotBehaviour() function allows plotting spatial statistics generated using the spatialBehaviour() function and stored in SpatRaster objects.

Usage

plotBehaviour(
  sts,
  rasterProduct,
  colorPalette = NULL,
  main = NULL,
  xlim = NULL,
  ylim = NULL,
  labels = FALSE,
  by = 8,
  pos = 3,
  legends = "topright",
  dynamicPlot = FALSE
)

Arguments

sts

StormsList object.

rasterProduct

layer name in a SpatRaster object. The names of the layers follow the following terminology:

  • for "MSW" or "PDI", the name of the storm in capital letters and the name of the statistic separated by underscores (e.g., "PAM_MSW", "PAM_PDI"),

  • for duration of exposure, the name of the storm in capital letters, "Exposure", and the threshold value separated by underscores (e.g., "PAM_Exposure_18", "PAM_Exposure_33", ...).

  • for wind profiles, the name of the storm in capital letters, "Speed" or "Direction", and the indices of the observation separated by underscores (e.g., "PAM_Speed_41", "PAM_Direction_41",...).

colorPalette

character vector. The color palette used to plot the raster layer. If colorPalette=NULL (default setting), the default color palette is used.

main

character. Title of the plot. If main=NULL (default setting), a default title is generated based on the name of the layer.

xlim

numeric vector. The x limits of the plot.

ylim

numeric vector. The y limits of the plot.

labels

logical. Whether (TRUE) or not (FALSE, default setting) to add labels with the name of the storm and the indices and ISO times of the observation.

by

numeric. If labels=TRUE, defines the frequency at which labels are plotted. Default value is set to 8 which corresponds to a 24h (or 48h) time interval between the labelled observations when observations are made every 3 (or 6) hours.

pos

numeric. If labels=TRUE, defines the position of the labels, 1 (above the observation), 2 (on the left), 3 (below, default setting), and 4 (on the right).

legends

character. Indicates where to plot the legend, "topright"(default setting), "topleft", "bottomleft", "bottomright", or "none" (legend not plotted).

dynamicPlot

logical. Whether (FALSE, default setting) or (TRUE) to plot the data dynamicaly using leaflet library

Value

A plot of the storm track data with the raster layer.

Examples

# \donttest{
# Creating a stormsDataset
sds <- defStormsDataset()
#> Warning: No basin argument specified. StormR will work as expected
#>              but cannot use basin filtering for speed-up when collecting data
#> === Loading data  ===
#> Open database... /home/runner/work/_temp/Library/StormR/extdata/test_dataset.nc opened
#> Collecting data ...
#> === DONE ===

# Getting storm track data for tropical cyclone Pam (2015)
pam <- defStormsList(sds = sds, loi = "Vanuatu", names = "PAM")
#> === Storms processing ... ===
#> 
#> -> Making buffer: Done
#> -> Searching for PAM storm ...
#>    -> Identifying Storms: Done
#> -> Gathering storm(s) ... 
#> 
#> === DONE with run time 0.478066 sec ===
#> 
#> SUMMARY:
#> (*) LOI: Vanuatu 
#> (*) Buffer size: 300 km
#> (*) Number of storms: 1 
#>         Name - Tropical season - Scale - Number of observation within buffer:
#>         PAM - 2015 - 6 - 20 
#> 

# Plotting maximum sustained wind speed for Pam (2015) near Vanuatu
pam.msw <- spatialBehaviour(pam, verbose = 0)
plotBehaviour(pam, pam.msw)


# dynamicPlot mode
plotBehaviour(pam, pam.msw, dynamicPlot = TRUE)
# Plotting 2D wind speed profile for Pam (2015) near Vanuatu pam.prof <- spatialBehaviour(pam, product = "Profiles", verbose = 0) plotBehaviour(pam, pam.prof$PAM_Speed_37, labels = TRUE, pos = 4) # }