KevinSee / PITcleanr

Compress PIT tag capture histories for use in various analyses
https://kevinsee.github.io/PITcleanr/
Creative Commons Attribution 4.0 International
8 stars 6 forks source link

Calculate travel distance #57

Open KevinSee opened 2 months ago

KevinSee commented 2 months ago

Could the output of compress(), which already includes travel time, also include travel distance (e.g. distance from previous node to the current one)? Once travel time and distance are included, it would be straightforward to calculate travel speed as well.

KevinSee commented 2 months ago

I think it could be hard to compute the travel distance accurately with only rkm. And although rkm is available for most PTAGIS sites, it’s not necessarily a standard field. I recall running into problems trying to use rkm to set up a parent-child table for instance.

However, with a sf object of site locations, and a line layer of flowlines, I don’t see why one couldn’t compute the distance between sites, someone similar to calculating the parent-child relationships (following flowlines from one site to the next using downstream hydrosequence, and accumulate the distance to the next site), maybe called calcDistance(). I would suggest not including that as a standard output of compress, but an additional function that would take the output of compress() as an input, and a tibble of distances between sites (maybe an additional column to a parent-child table), and calculate that travel distance that way (and why not add travel speed while we’re at it).