Appendix A4 to Rakhimberdiev, E., Senner, N. R., Verhoeven, M. A., Winkler, D. W., Bouten, W. and Piersma T. 2016 Comparing inferences of solar geolocation data against high-precision GPS data: annual movements of a double-tagged Black-Tailed Godwit. - Journal of Avian Biology 000: 000-000.
In order to run GeoLight ir FLightR over the light data we have to preselect twilights. *.lux in the directory is the original file you get from Migrate Technology Ltd. This file does not have defined twilights. There is plenty of ways to predefine twilights and here we will use BAStag package:
library(devtools) install_github("SWotherspoon/SGAT") install_github("SWotherspoon/BAStag") install_github("eldarrak/FLightR@0.3.6") # install this version if you want completely the same results as in the paper install_github("eldarrak/FLightR") # this will install latest version library(BAStag)
Download .lux file into your working directory and name it 'A2_raw_data.lux'.
download.file("https://raw.githubusercontent.com/eldarrak/FLightR/master/examples/Black-Tailed_Godwit_JAB_example/A2_raw_data.lux", "A2_raw_data.lux")
library(BAStag) d.lux<-readMTlux("A2_raw_data.lux") d.lux<- subset(d.lux,select=c("Date","Light"))
In the .lux files light values go very high, so we should log transform data before selecting twilights.
d.lux$Light<-log(d.lux$Light)
offset = 10 lightImage(d.lux, offset = offset, zlim = c(0, 12), dt = 300) # dt specifies the recording interval start <- as.POSIXct("2013-06-16", tz = "GMT") end <- as.POSIXct("2014-05-17", tz = "GMT") abline(v = c(start, end), lty = c(1,2), col = "orange", lwd = 2) d.lux <- subset(d.lux, Date>=start & Date<=end)
threshold=1.5 # better use 1.5 for Intigeo tags if no strong reason for other value twl <- preprocessLight(d.lux, threshold, offset = offset,lmax=12) # only needs to be done once
The idea of preprocessLight()
function is that you go through twilights one by one and delete ones that have obvious non random change in the shading in +/- 24 points around twilight (2 hours for 5 minute logging interval). For example twilight should be deleted if in the beginning birds was in hig vegetation and after it immediately flew to the open space. Or other way around - there is nice pattern of rising sun and in the middle bird goes to high vegetation and stays there...
library(FLightR) TAGS.twilights.raw<-BAStag2TAGS(d.lux, twl, threshold=threshold) TAGS.twilights.raw$datetime<-format(TAGS.twilights.raw$datetime, format="%Y-%m-%dT%T.000Z") write.csv(TAGS.twilights.raw, file="tmp.csv", quote=FALSE, row.names=FALSE)
Now you can read these data by GeoLight or FLightR.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.