ConScape / ConScapeR

Other
3 stars 1 forks source link

Argument `vec` in `vec2mat` #2

Open bniebuhr opened 4 months ago

bniebuhr commented 4 months ago

Just thinking we should not describe the argument vect in the function vec2mat as a vector, since (in R) I guess this is a matrix? What is the best way to describe it between R and Julia terminologies?

ninbrm commented 4 months ago

There are two functions: (1) mat2rast and (2) vec2mat, which can be nested/piped to produce a raster from a vector. (1) mat2rast takes a matrix (corresponding to the grid) and converts it to a spatial raster simply by setting the extent and projection, most ConScape functions in Julia can return a matrix. (2) vec2mat projects a vector of node values onto the grid (or matrix).

Internally, ConScape.jl uses an aspatial network representation for most computations. It is the Grid-structure that stores the link between the nodes on the network and their location in space on a spatial grid. ConScape can handle both grid networks (most of our use-cases so far) and general networks. Node values on the grid can be represented as a matrix or as a raster, whereas for the general network the node values are represented as a vector. Most functions can return a matrix, if nodes have only a single value. However, when nodes have multiple values (such as pair-wise distances between nodes), then the matrix of such pairwise distances is returned, and a single column (or row) can be converted to a matrix (and raster) to obtain a distance map corresponding to that specific target (or source) node.