flow.dispersion_int: Compute flow-based cost or conductance

View source: R/wind_functions2.R

flow.dispersion_intR Documentation

Compute flow-based cost or conductance

Description

flow.dispersion_int computes movement conductance through a flow such as sea or wind currents. Passive movement uses a restricted version of the formula described in Felícisimo et al. (2008):

Usage

flow.dispersion_int(
  stack,
  fun = cost.FMGS,
  output = "transitionLayer",
  type = c("passive", "active"),
  speed.scale = NULL,
  ...
)

Arguments

stack

A SpatRaster returned by wind2raster() with direction and speed layers. Legacy RasterStack objects are also accepted.

fun

A function to compute the cost to move between cells. The default is cost.FMGS from Felicísimo et al. (2008), see details.

output

This argument allows to select different kinds of output. "raw" mode creates a matrix (class "dgCMatrix") with transition costs between all cells in the raster. "transitionLayer" creates a TransitionLayer object with conductance values to be used with "gdistance" package.

type

Movement model: "passive" or "active".

speed.scale

Positive reference speed for the active model. If NULL, the median positive speed of the complete raster layer is used.

...

Further arguments passed to or from other methods.

Details

Cost=(1/Speed)*(HorizontalFactor)

where HorizontalFactor incrementally penalizes angular deviations from the flow direction and prevents passive movement at deviations of 90 degrees or more. Active movement instead uses the signed flow component parallel to the movement direction; supportive flow lowers cost and opposing flow raises it.

Value

With output = "transitionLayer", a gdistance::TransitionLayer whose sparse matrix stores directed conductances (1/cost) between the eight neighbouring cells. With output = "raw", a sparse matrix of class dgCMatrix containing edge costs. Rows index origins and columns index destinations. Each edge cost averages local costs at both cells and is multiplied by sqrt(2) for diagonal moves. In the raw matrix, Inf marks forbidden neighbouring moves; zeros represent absent edges, not free moves. In the conductance matrix, forbidden moves have zero conductance.

Note

Costs are relative per grid step. The diagonal correction assumes a square grid, but no correction is made for the changing physical distances of longitude/latitude cells. Results should not be interpreted as physical time, energy, or distance and should not be compared directly across grid resolutions or distant latitude ranges.

Note that for large data sets, it could take a while. For large study areas is strongly advised perform the analysis in a remote computer or a cluster.

Author(s)

Javier Fernández-López; Klaus Schliep; Yurena Arjona

References

Felicísimo, Á. M., Muñoz, J., & González-Solis, J. (2008). Ocean surface winds drive dynamics of transoceanic aerial movements. PLoS One, 3(8), e2928.

Jacob van Etten (2017). R Package gdistance: Distances and Routes on Geographical Grids. Journal of Statistical Software, 76(13), 1-21. doi:10.18637/jss.v076.i13

See Also

wind.dl, wind2raster

Examples


data(wind.data)
wind <- wind2raster(wind.data)
Conductance <- flow.dispersion(wind, type = "passive")
conductance_matrix <- gdistance::transitionMatrix(Conductance)
conductance_matrix[1:6, 1:6]
Matrix::image(conductance_matrix)

rWind documentation built on Oct. 18, 2026, 5:08 p.m.