plotPTI: Plot particle tracks from OSCURS model runs on a map for the...

View source: R/plotPTI.R

plotPTIR Documentation

Plot particle tracks from OSCURS model runs on a map for the PAPA Trajectory Index

Description

Function to plot particle tracks from OSCURS model runs on a map for the PAPA Trajectory Index.

Usage

plotPTI(
  tracks,
  trackID_col = "year",
  emphasizeID = as.character(max(as.numeric(tracks[[trackID_col]]))),
  addText = TRUE,
  text_col = "year",
  text_size = 1,
  strCRS = tmaptools::get_proj4(4326, output = "character"),
  basemap = wtsGIS::createBaseTMap(layer.land = wtsGIS::getPackagedLayer("Alaska"),
    layer.bathym = wtsGIS::getPackagedLayer("ShelfBathymetry"), strCRS.finl = strCRS),
  bounding_box = tmaptools::bb(xlim = c(-160, -130), ylim = c(46, 61), current.projection
    = tmaptools::get_proj4("longlat", output = "character"), projection = strCRS),
  gridLines = list(x = seq(from = -160, to = -130, by = 5), y = seq(from = 46, to = 60,
    by = 2), projection = tmaptools::get_proj4("longlat", output = "character")),
  style = NULL,
  color_lines = "blue",
  color_text = "blue",
  alpha_lines = 1,
  alpha_text = 1,
  palette = NULL,
  showMap = TRUE,
  verbose = FALSE
)

Arguments

tracks
  • a tibble with OSCURS tracks (e.g., the tracks list element from a call to convertOSCURStoTbl)

trackID_col
  • column with unique track id

emphasizeID
  • if not NULL, id of track to emphasize (default=as.character(max(as.numeric(tracks[[trackID_col]]))))

addText
  • flag (T/F) to add text in text_col to end point of each track

text_col
  • column for text labels

text_size
  • size for "year" label on last end point (others will be 0.8*text_size)

strCRS
  • character representation of coordinate reference system for final map (default is Alaska Albers EPSG=3338)

basemap
  • a base map for plotting the tracks (default is the EBS using CRS defined by strCRS)

bounding_box
  • bounding box for map (or NULL to calculate from track limits)

gridLines
  • list w/ info to plot grid lines on map (or NULL for no grid lines)

style
  • tmap style for map (default is NULL, which uses current tmap style)

color_lines
  • color for track lines (or column name)

color_text
  • color for track line text (or column name)

alpha_lines
  • transparency for track lines

alpha_text
  • transparency for track line text

palette
  • color palette for text

showMap
  • flag to show the map

verbose
  • flag to print diagnostic info

Details

The returned list has the following elements:

  • map - a tmap object

  • tracks - a sf tibble with tracks that span the IDL to "roll your own" map

  • startLocs - a sf tibble with starting track locations as points to "roll your own" map

  • endLocs - a sf tibble with ending track locations as points to "roll your own" map

  • basemap - a basemap to "roll your own" map

The map object is in the coordinate reference system given by strCRS.

Requires packages dplyr, magrittr, sf, tmap, wtsGIS.

Value

  • a list (see details)


wStockhausen/rOSCURS documentation built on April 29, 2023, 5:51 a.m.