Intigeo tag on a Carribean Martin analysis example

Supplement to Perlut, N.G., Klak. K, Rakhimberdiev, E. 2017 Geolocator data reveals the migration route and wintering location of the Caribbean Martin. - Wilson Journal of Ornithology 000: 000-000.

Install packages

library(devtools)
install_github("SWotherspoon/SGAT")
install_github("SWotherspoon/BAStag")

# the latest FLightR:
install_github("eldarrak/FLightR")

# the version we used is here:
install_github("eldarrak/FLightR@0.4.5")

# CRAN version may be a couple of month out of date:
install.packages('FLightR')

library(BAStag)
library(FLightR)

Define twilights with BAStag package

download.file("https://git.io/vDfJl", "S1_Carribean_martin.lux")
d.lux<-luxTrans("S1_Carribean_martin.lux")
names(d.lux) <- c("Datetime", "Light")
d.lux$Light <- log(d.lux$Light)

threshold <- 1.5
offset = 15

lightImage(d.lux, offset = offset, zlim = c(0,12))

# Calibration Coordinates
lon.calib <- -61.2534
lat.calib <- 15.2417
start<-c(lon.calib, lat.calib)

twl <- preprocessLight(d.lux, threshold, offset = offset, lmax = 12)

library(FLightR)
TAGS.twilights.raw<-BAStag2TAGS(d.lux, twl, threshold=threshold, filename='tmp.csv')

Read data in FLightR

Now yo can TAGS.twiligths you have just created or download one we made

download.file("https://git.io/vDfe6", "S2_TAGS_format.csv")
Proc.data<-get.tags.data("S2_TAGS_format.csv")

Calibration

# search for calibration periods
plot_slopes_by_location(Proc.data, location=start)
abline(v=as.POSIXct("2012-05-10")) 
abline(v=as.POSIXct("2013-03-20")) 
abline(v=as.POSIXct("2012-08-05")) 
abline(v=as.POSIXct("2013-06-20")) 

# Calibrate tag 
Calibration.periods<-data.frame(calibration.start=as.POSIXct(c("2012-05-10", "2013-03-20")),
                                calibration.stop=as.POSIXct(c("2012-08-05","2013-06-20")),
                                lon=start[1], lat=start[2])

Calibration<-make.calibration(Proc.data, Calibration.periods, model.ageing=TRUE)

Spatial extent

Grid<-make.grid(left=-66, bottom=-20, right=-40, top=25,
   distance.from.land.allowed.to.use=c(-Inf, Inf),
   distance.from.land.allowed.to.stay=c(-Inf, 50))

Data preparation and main run

all.in<-make.prerun.object(Proc.data, Grid, start=start, Calibration=Calibration)

# ~ 45 mean run time
Result<-run.particle.filter(all.in, threads=6,
            nParticles=1e6, known.last=FALSE)
save(Result, file="Result.with.ageing.model.RData")

Plot results

map.FLightR.ggmap(Result, seasonal.donut.location = "bottomleft")
plot_lon_lat(Result)

Get summary on migration

stationary.migration.summary(Result) # takes ~ 10 minutes


eldarrak/FLightR documentation built on Nov. 10, 2023, 7:53 a.m.