View source: R/make_idw_stack.R
make_idw_stack | R Documentation |
This function can be used to make inverse-distance-weighted plots for the eastern Bering Sea and northern Bering Sea
make_idw_stack(
x = NA,
COMMON_NAME = NA,
LATITUDE = NA,
LONGITUDE = NA,
CPUE_KGHA = NA,
region = "bs.south",
extrap.box = NULL,
extrapolation.grid.type = "stars",
set.breaks = "jenks",
grouping.vars,
grid.cell = c(5000, 5000),
in.crs = "+proj=longlat",
out.crs = "EPSG:3338",
log.transform = FALSE,
idw.nmax = 4,
use.survey.bathymetry = TRUE
)
x |
Data frame which contains at minimum: CPUE, LATITUDE, and LONGITUDE. Can be passed as vectors instead (see below). Default value: |
COMMON_NAME |
Common name |
LATITUDE |
Latitude (degrees north) |
LONGITUDE |
Longitude (degrees east; Western hemisphere is negative) |
CPUE_KGHA |
Catch per unit effort in kilograms per hectare |
region |
Character vector indicating which plotting region to use. Options: bs.south, bs.north, bs.all |
extrap.box |
Optional. Vector specifying the dimensions of the extrapolation grid. Elements of the vector should be named to specify the minimum and maximum x and y values c(xmin, xmax, ymin, ymax). If not provided, the extrapolation area will be set to the extent of the survey.area bounding box with the output CRS. |
extrapolation.grid.type |
Type of object to use for the extrapolation grid, default = "stars". "stars" = returns a 'stars' object; "sf" = sf object with layer masked to survey area extent and converted to collection of sf POLYGON and MULTIPOLYGON geometries; "sf.simple" = same as "sf", but with polygons vertices smoothed using rmapshaper::ms_simplify |
set.breaks |
Either a numeric vector of breaks to use for plotting or a character vector indicating which classIntervals() algorithm to use for break selection. See Description for information about break selection. Users are strongly encouraged to specify their own numeric vector of breaks based on the properties of their data. |
grouping.vars |
Character vector indicating of columns in the input data frame to use for grouping input variable layers. |
grid.cell |
Numeric vector of length two specifying dimensions of grid cells for extrpolation grid, in units for the output CRS. Default = c(5000,5000) correponds with 5x5 km for EPSG:3338 |
in.crs |
Character vector containing the coordinate reference system for projecting the extrapolation grid. |
out.crs |
Character vector containing the coordinate reference system for projecting the extrapolation grid. The default is Alaska Albers Equal Area (EPSG:3338). |
log.transform |
Character vector indicating whether CPUE values should be log-transformed for IDW. Default = FALSE. |
idw.nmax |
Maximum number of adjacent stations to use for interpolation. Default = 8 |
use.survey.bathymetry |
Logical indicating if historical survey bathymetry should be used instead of continuous regional bathymetry. Default = TRUE |
This function include an argument for algorithmic break selection using the 'set.breaks' argument. However, algorithmic break selection is provided for convenience purposes and **users are strongly encouraged to select their own breaks based on the properties of their data**. No single algorithm in the package can be expected to perform well in all cases. See ?classInt::classIntervals for a algorithmic break selection method options.
Returns a list containing: (1) map_layers: Layer of shapefiles returned by akgfmaps::get_base_layers() (2) extrapolation.stack: a stack of extrapolated spatial objects with estimated values on a discrete scale as a 'stars' (when extrapolation.grid.type is "stars") or 'sf' (when extrapolation.grid.type is "sf" or "sf.simple") object; (3) continuous.grid: extrapolation grid with estimates on a continuous scale; (4) region: the region; (5) crs: coordinate reference system as a PROJ6 (WKT2:2019) string.
Sean Rohan sean.rohan@noaa.gov
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.