ericpante/marmap

Penalize depth (rather than make impossible) with lc.dist()

Closed this issue · 2 comments

Greetings!

I'm working on a shark that is not found at depths >200m (-200m), and is typically found along continental margins. However, island populations do exist, and these islands are separated by depths much greater than 200m. Clearly dispersal over these depths is not impossible, though I suspect it's extremely rare.

Calculating the shortest overwater distance is very feasible, but is possibly unrealistic for this species.

Is there a way (using marmap) to calculate least-cost paths/distances that prioritize depths less than 200m, and minimize path distances across deeper stretches, rather than using max.depth() to set a hard boundary?

Many thanks,
Sean

besibo commented

Hi Sean,

Unfortunately, this is not possible by default. If you set a hard boundary (i.e. -200) and the path between two islands has to cross deeper waters, a distance is computed, but a huge penalty is applied and the resulting value is mostly unusable. This is not an option we can change easily: marmap::trans.mat() and marmap::lc.dist() both rely on functions from the gdistance package. So you might want to explore gdistance::transition(), gdistance::costDistance() or gdistance::shortestPath(). Maybe these functions allow the type of computations you need.

Sorry I couldn't give a better answer!
Best,
Benoit

Hi Benoit,

No worries, thanks for the prompt reply! Much appreciated.

Cheers,
Sean