Last chance! 50% off unlimited learning
Sale ends in
lc.dist
to compute least cost distances between locations.trans.mat(bathy,min.depth=0,max.depth=NULL)
bathy
.min.depth=0
and max.depth=NULL) indicates that the transition between cells of the grid is possible between 0 meters depth and the maximum depth of bathy<
trans.mat
can be time consumming for large bathymetric datasets. The function takes about one minute to compute a transition matrix for the hawaii
bathymetric data (bathymetric data of class bathy
with 599 rows and 419 columns, see hawaii
) on a MacBook Pro with a 2.66 GHz Intel Core i7 processor and 4 Go of RAM.trans.mat
creates a transition object usable by lc.dist
to computes least cost distances between a set of locations. trans.mat
rely on the function raster
from package raster
(Hijmans & van Etten, 2012. transition
from package gdistance
(van Etten, 2011. The transition object contains the probability of transition from one cell of a bathymetric grid to adjacent cells and depends on user defined parameters. trans.mat
is especially usefull when least cost distances need to be calculated between several locations at sea. The default values for min.depth
and max.depth
ensure that the path computed by lc.dist
will be the shortest path possible at sea avoiding land masses. The path can be constrained to a given depth range by setting manually min.depth
and max.depth
. For instance, it is possible to limit the possible paths to the continental shelf by setting max.depth=-200
. Inaccuracies of the bathymetric data can occasionally result in paths crossing land masses. Setting min.depth
to low negative values (e.g. -10 meters) can limit this problem.
trans.mat
takes also advantage of the function geoCorrection
from package gdistance
(van Etten, 2012.
lc.dist
, hawaii
# Load and plot bathymetry
data(hawaii)
summary(hawaii)
plot(hawaii)
# Compute transition object with no depth constraint
trans1 <- trans.mat(hawaii)
# Compute transition object with minimum depth constraint:
# path impossible in waters shallower than -200 meters depth
trans2 <- trans.mat(hawaii,min.depth=-200)
# Visualizing results
par(mfrow=c(1,2))
plot(raster(trans1), main="No depth constraint")
plot(raster(trans2), main="Constraint in shallow waters")
Run the code above in your browser using DataLab