ctmm-initiative / ctmm

Continuous-Time Movement Modeling. Functions for identifying, fitting, and applying continuous-space, continuous-time stochastic movement models to animal tracking data.
http://biology.umd.edu/movement.html
47 stars 12 forks source link

In as.telemetry.: No MoveBank identification found #39

Closed bjpadilla closed 3 years ago

bjpadilla commented 3 years ago

Hello.

I see that there was a similar bug was reported as fixed in 2018. This week while re-analyzing some data with identical R script and data set I am again getting a very similar error. I had not gotten this error when previously analyzing this data with the same script.

The previous closed issue report is here: https://github.com/ctmm-initiative/ctmm/issues/22

Thanks!

`## Both 2018 AND 2019  ####
> trk <- make_track(etib,Longitude..deg.,Latitude..deg.,  # All years (2018 and 2019)
+                   date_time, id = Collar.ID,year = year, month = month,sex=sex,season = seas, crs = crs(sgl), sex = sex) %>%  
+   transform_coords(crs(trug))
.t found, creating `track_xyt`.
> elks <- trk %>% nest(data = -c(id, year,season)) %>% 
+   mutate(n = map_int(data, nrow)) %>% 
+   filter(n > 20)
> elks1 <- elks %>%
+   mutate(
+     "hr_od_ou" = map(data, ~ hr_od(., model = fit_ctmm(., "ou"))),
+     "hr_od_50" = map(data, ~ hr_od(., model = fit_ctmm(., "ou"), levels = c(0.5)))
+   )
Minimum sampling interval of 4.46 hours in unknown
Error: Problem with `mutate()` input `hr_od_ou`.
x NA
ℹ Input `hr_od_ou` is `map(data, ~hr_od(., model = fit_ctmm(., "ou")))`.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning messages:
1: Problem with `mutate()` input `hr_od_ou`.
ℹ No MoveBank identification found. Assuming data corresponds to one indiviudal.
ℹ Input `hr_od_ou` is `map(data, ~hr_od(., model = fit_ctmm(., "ou")))`. 
2: In as.telemetry.data.frame(data.frame(lon = x$x_, lat = x$y_, timestamp = x$t_)) :
  No MoveBank identification found. Assuming data corresponds to one indiviudal.`
chfleming commented 3 years ago

Can you provide a dataset that I can reproduce the error with? The dataset in the other issue is working for me.

bjpadilla commented 3 years ago

Sure,

Attached here is the track object in ‘trk_data.Rdata’ and a portion of the script.

-- Benjamin Padilla Ph.D Postdoctoral Researcher | Spatial Ecology Indiana University of Pennsylvania Twitter: @bpdilla ~ Web: www.benpadilla.weebly.com On Dec 29, 2020, 12:36 PM -0500, Christen H. Fleming notifications@github.com, wrote:

Can you provide a dataset that I can reproduce the error with? The dataset in the other issue is working for me. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

chfleming commented 3 years ago

Maybe I am missing something? I don't see an attachment, here or in my email.

bjpadilla commented 3 years ago

Odd, I'll try again (good timing on my part, I just opened this page a minute before you replied!)

trk_data.zip

chfleming commented 3 years ago

Would you mind producing a minimal working example of a ctmm command that returns an error? This is running ctmm commands inside amt commands inside tidy commands, and I'm not fluent in tidy. I also don't recognize the error as specific to ctmm. No MoveBank identification found. Assuming data corresponds to one indiviudal. is just a ctmm warning when providing location data without an identity column.

bjpadilla commented 3 years ago

Hmm, I have been trying to do that, but it seems that the errors that stop the function from continuing actually come during the data prep stage for the ctmm functions the amt package uses. Specifically the as_telemetry function. What is odd is that it works with some datasets in the nested tibble but not others.

This is the first data row

tmp <- ctmm.guess(as_telemetry(elks$data[[1]]), interactive = F)
summary(ctmm.fit(as_telemetry(elks$data[[1]]),
         ctmm(tau = tmp$tau[1])))
Minimum sampling interval of 4.46 hours in unknown
$name
[1] "OU anisotropic"

$DOF
    mean     area    speed 
35.01822 61.30018  0.00000 

$CI
                               low        est       high
area (square centimeters) 171.2998 223.787443 283.182468
τ[position] (days)          1.3281   1.819918   2.493864

Warning message:
In as.telemetry.data.frame(data.frame(lon = x$x_, lat = x$y_, timestamp = x$t_)) :
  No MoveBank identification found. Assuming data corresponds to one indiviudal.

However the second gives the following error.

tmp <- ctmm.guess(as_telemetry(elks$data[[2]]), interactive = F)
Minimum sampling interval of 13 hours in unknown
Error in sp::CRS(proj) : NA
In addition: Warning message:
In as.telemetry.data.frame(data.frame(lon = x$x_, lat = x$y_, timestamp = x$t_)) :
  No MoveBank identification found. Assuming data corresponds to one indiviudal.

So I guess the real issue is with sp::CRS(proj) which really isnt any issue of yours at all, so thanks for taking the time! Some folks using amt thought the issue was likely with the ctmm package being wrapped, but I guess not. Thanks again

Ben