Terraflux Terraflux
Download

Animal movement

27 operators. Inputs marked required must be connected or given; the others have defaults.

move.aeqd_crs#

An azimuthal equidistant projection centred on the tracks (move2's mt_aeqd_crs): distances and directions from the centre are true in it, a local metric projection for tracks anywhere; and the tracks in it. The centre: the centroid of the locations (on the sphere for longitude / latitude), the middle of their longitude and latitude ranges (center), or [longitude, latitude]. move2 takes the centroid to EPSG:4236 (Hu Tzu Shan) where WGS84 is meant, about a kilometre off; here it stays in WGS84, as landschaft's.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
crstextthe projection, a PROJ string (for vector.reproject's crs)
tracksvectorthe tracks in it
tabletabletheir attributes that are numbers
SettingTypeWhat it is
centeranycentroid (default), center or [longitude, latitude]
unitstextm (default) or km

move.as_tracks#

Tracks from points or a table of locations (move2's mt_as_move2, landschaft's as_tracks): ordered by track and time (stable), the tracks in the order they first appear, as every move node needs. The time is a column of datetimes as text (ISO 8601, UTC) or of numbers; the track one of names or numbers. A table's x and y columns become points in the coordinate system given.

InputTypeWhat it is
vectorvectorpoints, one per location
tabletableor a table with a column of x and one of y
OutputTypeWhat it is
tracksvectorthe locations, ordered
tabletabletheir attributes that are numbers
SettingTypeWhat it is
xtexta table's column of the x or longitude (x)
ytexta table's column of the y or latitude (y)
crstexta table's coordinate system: EPSG:4326, a WKT...
sortboolorder by track and time (true)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.azimuth#

The direction of each step, clockwise from north (move2's mt_azimuth): the geodesic azimuth on the coordinate system's ellipsoid in longitude / latitude (lwgeom's st_geod_azimuth, GeographicLib, the same numbers), in (-pi, pi]; the direction on the grid, atan2(dx, dy), in a projected system or without one. NaN at the last location of each track and where a location repeats the previous.

InputTypeWhat it is
tracksrequiredvectorthe tracks: points ordered by track and time
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unitstextrad (default) or deg
columntextthe column given (azimuth)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.distance#

The distance from each location to the next of its track (move2's mt_distance, the same numbers): on the sphere of S2 (radius 6 371 010 m, as sf::st_distance with s2) in longitude / latitude, the straight line in the coordinate system's units otherwise. NaN at the last location of each track.

InputTypeWhat it is
tracksrequiredvectorthe tracks: points ordered by track and time
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unitstextm (the default in longitude / latitude) or km; none keeps metres or the CRS's units
columntextthe column given (distance)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.distribution#

A distribution of step lengths or turn angles (amt's make_distribution): gamma (shape, and scale or rate), exp (rate), lnorm (meanlog, sdlog), hnorm (sd) for step lengths; vonmises (kappa, mu 0) or unif (min, max) for turn angles. The parameters not given take amt's defaults (gamma 1, 1; exp 1; lnorm 0, 1; hnorm 1; unif -pi, pi; von Mises 1, 0).

OutputTypeWhat it is
distributionstep_distributionthe distribution
tabletableits parameters
SettingTypeWhat it is
namerequiredtextgamma, exp, lnorm, hnorm, vonmises or unif
shapenumberthe parameter shape (of the distributions that have it)
scalenumberthe parameter scale (of the distributions that have it)
ratenumberthe parameter rate (of the distributions that have it)
meanlognumberthe parameter meanlog (of the distributions that have it)
sdlognumberthe parameter sdlog (of the distributions that have it)
sdnumberthe parameter sd (of the distributions that have it)
minnumberthe parameter min (of the distributions that have it)
maxnumberthe parameter max (of the distributions that have it)
kappanumberthe parameter kappa (of the distributions that have it)
munumberthe parameter mu (of the distributions that have it)

move.extract_covariates#

The values of rasters at locations, or at the ends or starts of steps (amt's extract_covariates): the value of the cell holding each point (terra's extract: a point on the edge between two cells takes the cell to its right / below), none outside the raster or on no data. Connect the rasters as inputs of any names (forest, elev...): a column each, named by its input (a stack's layers input_layer). The points are taken to each raster's coordinate system.

InputTypeWhat it is
tracksrequiredvectortracks, their steps (move.steps) or random steps
OutputTypeWhat it is
tracksvectorthe features with a column per raster (or layer)
tabletabletheir attributes that are numbers
SettingTypeWhat it is
wheretextsteps: at their end (default), start or both (columns suffixed _start and _end)

Takes any other inputs by name (any).

move.filter_min_n_burst#

The bursts (move.resample) of at least min_n locations (amt's filter_min_n_burst).

InputTypeWhat it is
tracksrequiredvectorthe tracks in bursts
OutputTypeWhat it is
tracksvectorthe bursts kept
tabletabletheir attributes that are numbers
SettingTypeWhat it is
min_nintegerthe least locations of a burst (3)
tracktextthe column of the track (default: the usual names)

move.filter_movebank_visible#

The tracks without the locations Movebank hides (move2's mt_filter_movebank_visible): those of the column visible when there is one; otherwise the records not marked as outliers (manually, by an algorithm or on import), and those marked valid by hand.

InputTypeWhat it is
tracksrequiredvectorthe tracks (move.read_tracks)
OutputTypeWhat it is
tracksvectorthe locations Movebank shows
tabletabletheir attributes that are numbers

move.filter_per_interval#

One location per time interval of each track (move2's mt_filter_per_interval): the intervals of lubridate's floor_date, multiples counted from the start of the next larger unit (minutes within the hour, hours within the day, days within the month), weeks from Sunday; the first, the last or one at random (R's sample.int after set.seed(seed), move2's picks). The times must be datetimes.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectora location per interval
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unittextthe interval: hour (default), 15 mins, 2 hours, day, week, month, year...
criteriontextfirst (default), last or random
seedintegerrandom: the seed of R's generator (1)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.filter_unique#

The tracks without duplicated times within a track (move2's mt_filter_unique and mt_unique). criterion subsets (default): of the records of a track with the same time, those that only repeat another or hold less (each value equal to the other's or missing) are dropped, with a warning when some remain; subsets_equal the same with numbers equal within R's all.equal (1.5e-8); first, last: the first or last record of each time; sample: one at random (R's sample.int after set.seed(seed), move2's picks).

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectorthe records kept
tabletabletheir attributes that are numbers
SettingTypeWhat it is
criteriontextsubsets (default), subsets_equal, first, last or sample
columns_alsoanymore columns whose values must also match for records to be duplicates (a list)
seedintegersample: the seed of R's generator (1)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.fit_distribution#

A distribution fitted to step lengths or turn angles (amt's fit_distr, the same numbers): gamma by maximum likelihood with R's Nelder-Mead from the closed-form estimates (fitdistrplus' fitdist; steps of length 0 take the smallest other length); exp the maximum likelihood rate 1 / mean(x) (amt fits it by BFGS, which fails for rates under 0.001); lnorm by Nelder-Mead; hnorm sqrt(mean(x^2)); unif the smallest and largest value; vonmises kappa by maximum likelihood (circular's mle.vonmises), mu 0. The missing values are left out.

InputTypeWhat it is
valuesrequiredanythe steps (move.steps) or a table
OutputTypeWhat it is
distributionstep_distributionthe distribution fitted
tabletableits parameters
SettingTypeWhat it is
namerequiredtextgamma, exp, lnorm, hnorm, vonmises or unif
columntextthe column of the values (sl_ for gamma, exp, lnorm and hnorm; ta_ for vonmises and unif)

move.interpolate#

Locations at given times between the recorded ones (move2's mt_interpolate). Without times, the records without a location (empty points) get one between the locations before and after them. With times (a list, or a unit such as 1 hour or 15 mins for a regular sequence from the first to the last time), a record is added for each time within the span of each track that the track does not have, and located. A location is placed on the great circle between its neighbours in proportion to the time (in longitude / latitude, and through it in a projected system, as move2 does with s2), on the straight line without a coordinate system. Gaps longer than max_time_lag are left empty. Ordered by track and time.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectorthe tracks with the locations interpolated
tabletabletheir attributes that are numbers
SettingTypeWhat it is
timesanythe times: a list (datetimes as text, or numbers), or a unit (1 hour, 15 mins, day...)
max_time_lagnumbergaps longer than this (seconds) left empty
omitboolkeep only the records at the times (false)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.nsd#

The net squared displacement: the squared distance of each location from the first of its track (amt's nsd), in the units of the coordinates (squared degrees in longitude / latitude, as amt).

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
columntextthe column given (nsd)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.random_numbers#

Draws of a distribution of steps (amt's random_numbers), from R's generator after set.seed(seed): amt's numbers. Turn angles of a von Mises distribution are wrapped to (-pi, pi].

InputTypeWhat it is
distributionrequiredstep_distributionthe distribution
OutputTypeWhat it is
tabletablethe draws (value)
SettingTypeWhat it is
nintegerhow many (100)
seedintegerthe seed of R's generator (1)

move.random_steps#

Each observed step with n_control random steps from its start (amt's random_steps, the same steps): the data of a step selection function. For each step but the first of a track (or of a burst), the observed step (case_ 1) and n_control steps from the same start (case_ 0) whose lengths and turn angles are drawn from sl_distr and ta_distr (default: a gamma and a von Mises distribution fitted to each track's steps), turned from the direction of the previous step; step_id_ names the stratum. As amt, n_draws numbers are drawn from each distribution once per track and each random step takes one of them at random. Bursts of fewer than 3 steps are left out. R's generator after set.seed(seed), the tracks in turn. The steps must be in a projected coordinate system (move.aeqd_crs).

InputTypeWhat it is
stepsrequiredvectorthe steps (move.steps), projected
sl_distrstep_distributionthe distribution of the step lengths
ta_distrstep_distributionthe distribution of the turn angles
OutputTypeWhat it is
stepsvectorthe observed and random steps (case_, step_id_)
tabletabletheir attributes that are numbers
distributionsvectorthe distributions of each track (sl_distr, ta_distr and their parameters), without geometries
SettingTypeWhat it is
n_controlintegerrandom steps per observed step (10)
n_drawsintegernumbers drawn from each distribution per track (100000)
seedintegerthe seed of R's generator (1)
tracktextthe column of the track (default: the usual names)

move.read_tracks#

Animal tracks from a Movebank file (move2's mt_read, landschaft's load_tracks): the CSV files Movebank exports (also .csv.gz) and the zip files of Env-DATA (the CSV inside), as points in EPSG:4326, one per record. The time is timestamp (UTC), the track the individual (individual-local-identifier; when an individual carried several tags, the individual and the tag, in a new individual-tag-local-identifier column, as move2 does); the outlier flags are numbers 1 and 0. Records without coordinates (other sensors) keep an empty location. Ordered by track and time (stable), as every move node needs.

OutputTypeWhat it is
tracksvectorthe locations: points with the file's columns
tabletabletheir attributes that are numbers
SettingTypeWhat it is
pathrequiredtextthe file (.csv, .csv.gz, .zip), relative to the model's folder
sortboolorder by track and time (true; move2 keeps the file's order)

move.resample#

Locations at a regular rate, in bursts (amt's track_resample, the same locations and bursts): from the location start of each track, the next location kept is the first at least rate - tolerance later, in the same burst when it is at most rate + tolerance later, else it starts a new burst; the locations in between are dropped. Each location kept gets its burst (1, 2... within its track) in the column burst_, which move.steps and move.random_steps follow.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectorthe locations kept, with burst_
tabletabletheir attributes that are numbers
SettingTypeWhat it is
raterequiredanythe rate: seconds, or a text such as 2h or 15min
tolerancerequiredanythe tolerance: seconds, or a text such as 15min
startintegerthe location (0-based, in each track) to start at (0)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.segments#

The step from each location to the next of its track as a line (move2's mt_segments): one feature per location with its attributes, a two-point line per step and the location itself (a point) at the last location of each track.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
segmentsvectora line per step
tabletabletheir attributes that are numbers
SettingTypeWhat it is
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.simulate_brownian#

Tracks of Brownian motion (move2's mt_sim_brownian_motion): each step moves by normal draws of standard deviation sqrt(sigma^2 dt) along x and along y, from the start. R's generator after set.seed(seed): the same tracks as move2 (the tracks one after the other, x before y). Columns time and track, points without a coordinate system.

OutputTypeWhat it is
tracksvectorthe locations
tabletabletime and track of each
SettingTypeWhat it is
tanythe times (numbers; default 1 to 10): one list for every track, or a list of one per track
sigmaanythe diffusion: a number or one per step, for every track, or a list of one per track (1)
tracksanyhow many tracks (ids 1, 2...) or their ids (2)
startanythe first location [x, y], or a list of one per track ([0, 0])
seedintegerthe seed of R's generator (1)

move.speed#

The speed of each step: the distance over the time lag (move2's mt_speed). Locations of a track must not share their time (move.filter_unique drops them). NaN at the last location of each track.

InputTypeWhat it is
tracksrequiredvectorthe tracks: points ordered by track and time
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unitstextm/s, km/h, m/h or km/d (default: metres, or the CRS's units, per second)
columntextthe column given (speed)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.steps#

The steps between consecutive locations of each track (amt's steps and steps_by_burst, the same numbers), of each burst when the tracks have move.resample's burst_: a line per step, with its track, burst_, start and end (x1_, x2_, y1_, y2_), length sl_, direction direction_p (anticlockwise from east, in (-pi, pi]), turn angle ta_ from the previous step (NaN at the first step of each track or burst and after a step of length 0), the times t1_, t2_ and dt_ (seconds). In longitude / latitude the lengths are great-circle distances in metres (sf::st_distance) and the directions geodesic bearings turned into angles from east: amt reads the bearing, clockwise from north, as if it were that angle; here it is converted, pi / 2 - bearing.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
stepsvectora line per step
tabletabletheir attributes that are numbers
SettingTypeWhat it is
lonlatboollengths and directions on the sphere (default: when the coordinate system is geographic)
keep_colstextthe tracks' other columns kept: start (of the location a step starts at), end, both (suffixes _start and _end) or none
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.time_lags#

The time from each location to the next of its track (move2's mt_time_lags), exact between datetimes (differences of nanoseconds). NaN at the last location of each track.

InputTypeWhat it is
tracksrequiredvectorthe tracks: points ordered by track and time
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unitstexts (default), min, h or d
columntextthe column given (time_lag)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.time_of_day#

Day or night at each location, or at the end or start of each step (amt's time_of_day): sunrise and sunset of the location's date (UTC) as suncalc computes them (the sun's upper edge at -0.833 degrees), and with include_crepuscule dawn and dusk (the sun at -6 degrees, civil twilight). A column of day, night (and dawn, dusk); empty where the sun does not rise or set that day. suncalc takes the noon of the machine's time zone; here, the noon of UTC.

InputTypeWhat it is
tracksrequiredvectortracks (with a coordinate system) or their steps
OutputTypeWhat it is
tracksvectorthe tracks or steps with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
include_crepusculeboolalso dawn and dusk (false)
wheretextsteps: at their end (default) or start
columntextthe column given (tod)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.track_data#

One row per track (in the order they appear) with the columns whose value does not change within a track (move2's mt_track_data): the animal's, the tag's, the study's... as features without a geometry.

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectora feature per track, without a geometry
tabletabletheir attributes that are numbers
SettingTypeWhat it is
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.track_lines#

Each track as a line through its locations in time order (move2's mt_track_lines): one feature per track, its id, the number of locations (n_locations) and the columns whose value does not change within a track (move.track_data's). Empty locations are left out; a track with a single location gets no line (an empty geometry).

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
linesvectora line per track
tabletabletheir attributes that are numbers
SettingTypeWhat it is
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.track_summary#

amt's summaries of each track, a line per track (move.track_lines's, with n_locations and the track's data): cum_dist (the sum of its steps, metres in longitude / latitude), tot_dist (from the first to the last location), straightness (tot_dist / cum_dist), msd (the mean squared distance of the locations from their centre), sinuosity (Benhamou 2004, the turn angles in radians: amt takes them as degrees; NaN under two steps) and tac (the turn angle correlation, Dray et al. 2010).

InputTypeWhat it is
tracksrequiredvectorthe tracks
OutputTypeWhat it is
tracksvectora line per track with its summaries
tabletabletheir attributes that are numbers
SettingTypeWhat it is
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)

move.turn_angle#

The change of direction at each location, in [-pi, pi) (move2's mt_turnangle): the azimuth of the step leaving it minus that of the step arriving, positive to the right. NaN at the first and last location of each track.

InputTypeWhat it is
tracksrequiredvectorthe tracks: points ordered by track and time
OutputTypeWhat it is
tracksvectorthe tracks with the column
tabletabletheir attributes that are numbers
SettingTypeWhat it is
unitstextrad (default) or deg
columntextthe column given (turn_angle)
timetextthe column of the time (default: timestamp, time, datetime, date_time or t)
tracktextthe column of the track (default: individual-tag-local-identifier, individual-local-identifier, track, track_id, id, individual or animal)