Jump to content
Ornithology Exchange
  • 0
HETHnerd

FLightR-only one calibration period

Question

Hi there!

The orignal code is designed as 

Calibration.periods<-data.frame(calibration.start = as.POSIXct(c(NA, "2014-05-05")),   
                                calibration.stop = as.POSIXct(c("2013-08-23", NA)),
                                lon = CapLocs[1], 
                                lat = CapLocs[2]) 

but my tags died before the birds returned so I can only calibrate from the deploy time/location. I want to calibrate from a couple days after my deploy date of July 6, 2014 until August 1, 2014 so I tried removing calibration.start :

Calibration.periods<-data.frame(calibration.stop = as.POSIXct(c("2014-08-01", NA)),
                                lon = CapLocs[1], 
                                lat = CapLocs[2])

but got this error:

Error in as.POSIXct.numeric(Calibration.periods[, 2], tz = "gmt") : 
  'origin' must be supplied

How should I edit my text to reflect just one calibration window? Many thanks. Nubie here. Plain English appreciated! :)

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Try format:

Calibration.periods <- data.frame(calibration.start = as.POSIXct("2014-05-05"),   

                                calibration.stop = as.POSIXct("2013-08-23"),
                                lon = CapLocs[1], 
                                lat = CapLocs[2]) 

 

Stop date should not be before start date though.

Share this post


Link to post
Share on other sites
  • 0

Depending on why you only have one calibration period (e.g. the tag died half way through, but you still recaptured the bird and retrieved the tag), you have to make some additional changes to the FlightR script: in the run.particle.filter function you may need to change  "known.last=TRUE" to "known.last=FALSE"  (because you won't know where the tag has died) and when you only have one calibration period, you also have to remove the model aging part in the make.calibration function: Calibration<-make.calibration(Proc.data, Calibration.periods, model.ageing = TRUE)

I had the same issue as you did - don't have my note book with me here, but I have the correct script for you if the above doesn't work I can send it to you when I'm back in the office on Monday.

Share this post


Link to post
Share on other sites
  • 0


Thanks to both of you. I'm still working through the rest of the code so no results yet, but at least I haven't gotten an error message! Louise, I think I found you on line so I will email you and you can send me your script.

Share this post


Link to post
Share on other sites
  • 0

Hey!

Thanks again! Used the suggested changes and took LdeRaad's suggestion about changing model.ageing to TRUE. Output was as below but got Warning message below. 
Thoughts? Also please see notes below re map.

#CALIBRATION 
Calibration.periods <- data.frame(calibration.start = as.POSIXct("2014-07-06"),   
                                calibration.stop = as.POSIXct("2014-08-01"),
                                lon = CapLocs[1], 
                                lat = CapLocs[2]) 

#View results
    Calibration.periods

#create a calibration object 
    Calibration<-make.calibration(Proc.data = Light.Data, 
                              Calibration.periods = Calibration.periods,
                              model.ageing = TRUE,
                              plot.each = FALSE, 
                              plot.final = FALSE)


checking dawn 1  checking dawn 2  checking dawn 3  checking dawn 4  checking dawn 5  checking dawn 6  checking dawn 7  checking dawn 8  checking dawn 9  checking dawn 10  checking dawn 11  checking dawn 12  checking dawn 13  checking dawn 14 

#(etc, etc, I trimmed this)
calibration method used: parametric.slope 
likelihood correction switched to TRUE
 simulation:  0%  simulation:  1%  simulation:  1%  simulation:  1%  simulation:  2%  simulation:  2%  simulation:  2%  simulation:  3%  simulation:  
#(etc etc, I trimmed this)

Warning message:
In get.calibration.parameters(Calibration.periods, Proc.data, model.ageing = model.ageing,  :
  you have only one calibration period ageing estimation is unreliable and should be turned ot F!!!

#re MAP
Also, when I tried to plot a simple map 


#Plot a simple map
map.FLightR.ggmap(Result)

got this error:
Error in f(...) : could not find function "viewport"

Looked this up at http://stat.ethz.ch/R-manual/R-devel/library/grid/html/viewport.html
but really wasn't sure what to do here. Any suggestions anyone?

Thanks gang!

Share this post


Link to post
Share on other sites
  • 0

  This happens sometimes, no worries. Just do

library(grid)

before running this line.

   Cheers,

  Eldar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×