camrinbraun / tags2etuff

An R package for converting the hugely variable formats of animal tag data to a flat file format called eTUFF
Other
2 stars 2 forks source link

foieGras failure for Lotek #27

Open marosteg opened 2 years ago

marosteg commented 2 years ago

Stipulating 'fG = T' works for Wildlife Computers but not Lotek tags. Tested on multiple of each. Lotek failure example below:

> df <- get_3d(etuff, series=ts, fG=T) ## existing functionality to add spatial/location information to your series data
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: Etc/GMT+8."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Tijuana."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Los_Angeles."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Phoenix."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Mazatlan."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Hermosillo."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Boise."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: Etc/GMT+7; Etc/GMT+8."
[1] "No time zone specified. Detecting the time zone(s) from the tracking data: America/Iqaluit."

pre-filtering data...
Warning in prefilter(., vmax = vmax, ang = ang, distlim = distlim, spdf = spdf,  :

argosfilter::sdafilter produced an error on id 1 using argosfilter::vmask instead
Warning in prefilter(., vmax = vmax, ang = ang, distlim = distlim, spdf = spdf,  :

argosfilter::vmask also produced an error on id 1 can not apply speed filter prior to SSM filtering

fitting SSM...
Error: Problem with `mutate()` input `id`.
x $ operator is invalid for atomic vectors
ℹ Input `id` is `sapply(.$ssm, function(x) x$data$id[1])`.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning messages:
1: In tz_lookup_accurate.sf(ll_sf) :
  Some points are in areas with more than one time zone defined.These are often disputed areas and should be treated with care.
2: In lubridate::with_tz(tr$DateTime[i], tr$tz[i]) :
  Unrecognized time zone 'Etc/GMT+7; Etc/GMT+8'
3: In as.POSIXlt.POSIXct(x, tz = tz(x)) :
  unknown timezone 'Etc/GMT+7; Etc/GMT+8'
4: In lubridate::with_tz(tr$DateTime[i], tr$tz[i]) :
  Unrecognized time zone 'Etc/GMT+7; Etc/GMT+8'
5: In as.POSIXlt.POSIXct(x, tz = tz(x)) :
  unknown timezone 'Etc/GMT+7; Etc/GMT+8'
6: Problem with `mutate()` input `date`.
ℹ All formats failed to parse. No formats found.
ℹ Input `date` is `ymd_hms(date, tz = "GMT")`. 
camrinbraun commented 2 years ago

sessionInfo() ??

marosteg commented 2 years ago
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] trawllight_3.1.0  tags2etuff_1.0.0  data.table_1.12.8 dplyr_1.0.2      

loaded via a namespace (and not attached):
  [1] VGAM_1.1-1          minqa_1.2.4         colorspace_1.4-1    ellipsis_0.3.1     
  [5] class_7.3-15        rgdal_1.4-8         rprojroot_1.3-2     fs_1.3.1           
  [9] mc2d_0.1-21         rstudioapi_0.11     ICV_1.0             listenv_0.7.0      
 [13] furrr_0.1.0         farver_2.0.3        remotes_2.2.0       mvtnorm_1.0-11     
 [17] lubridate_1.7.9.2   codetools_0.2-16    splines_3.6.3       polyclip_1.10-0    
 [21] pkgload_1.1.0       spam_2.6-0          nloptr_1.2.1        foieGras_0.4.0     
 [25] ggforce_0.3.2       compiler_3.6.3      backports_1.1.8     assertthat_0.2.1   
 [29] Matrix_1.2-18       cli_2.3.1           tweenr_1.0.1        prettyunits_1.1.1  
 [33] tools_3.6.3         dotCall64_1.0-1     gtable_0.3.0        glue_1.4.2         
 [37] reshape2_1.4.4      maps_3.3.0          Rcpp_1.0.6          raster_3.4-5       
 [41] vctrs_0.3.6         nlme_3.1-150        argosfilter_0.63    stringr_1.4.0      
 [45] globals_0.12.4      ps_1.3.4            testthat_2.3.2      lme4_1.1-25        
 [49] lifecycle_1.0.0     fishmethods_1.11-2  devtools_2.3.2      statmod_1.4.32     
 [53] future_1.14.0       MASS_7.3-53         scales_1.1.1        parallel_3.6.3     
 [57] TMB_1.7.16          fields_11.6         memoise_1.1.0       gridExtra_2.3      
 [61] ggplot2_3.3.2       reshape_0.8.8       stringi_1.5.3       maptools_1.0-2     
 [65] desc_1.2.0          e1071_1.7-3         OSCV_1.0            boot_1.3-24        
 [69] pkgbuild_1.1.0      rlang_0.4.10        pkgconfig_2.0.3     moments_0.14       
 [73] pracma_2.2.9        lattice_0.20-41     purrr_0.3.4         sf_0.8-1           
 [77] labeling_0.3        kedd_1.0.3          processx_3.4.4      tidyselect_1.1.0   
 [81] fasttime_1.0-2      lutz_0.3.1          plyr_1.8.6          magrittr_2.0.1     
 [85] R6_2.5.0            generics_0.1.0      bootstrap_2019.6    DBI_1.1.0          
 [89] pillar_1.4.6        foreign_0.8-75      withr_2.3.0         mgcv_1.8-33        
 [93] units_0.6-5         sp_1.4-5            tibble_3.0.4        crayon_1.4.1       
 [97] KernSmooth_2.23-16  usethis_1.6.3       grid_3.6.3          callr_3.5.1        
[101] digest_0.6.27       classInt_0.4-2      tidyr_1.1.2         numDeriv_2016.8-1.1
[105] stats4_3.6.3        munsell_0.5.0       sessioninfo_1.1.1
camrinbraun commented 2 years ago

may not be the complete solution but you definitely should update foieGras to at least master if not dev. i'm running the current dev on my machine and working fine.

i'm sure the source of position info in the eTUFF files was also problematic (raw light) but those have almost all been replaced with HMMoce derived estimates

marosteg commented 2 years ago

I updated to master for foieGras, as well as another half dozen plus packages involved in this function call, and am down to these issues:

Error in validityMethod(object) : duplicated records within data
In addition: Warning message:
Problem with `mutate()` column `date`.
ℹ `date = ymd_hms(date, tz = "UTC")`.
ℹ All formats failed to parse. No formats found. 

Traceback below:

 Error in validityMethod(object) : duplicated records within data 
20.
stop("duplicated records within data") 
19.
validityMethod(object) 
18.
isTRUE(x) 
17.
anyStrings(validityMethod(object)) 
16.
validObject(.Object) 
15.
initialize(value, ...) 
14.
initialize(value, ...) 
13.
new("trip", obj, TORnames) 
12.
trip(d.tr, TORnames = c("date", "id"), correct_all = FALSE) 
11.
trip(d.tr, TORnames = c("date", "id"), correct_all = FALSE) 
10.
withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning")) 
9.
suppressWarnings(trip(d.tr, TORnames = c("date", "id"), correct_all = FALSE)) 
8.
prefilter(data = .x, vmax = vmax, ang = ang, distlim = distlim, 
    spdf = spdf, min.dt = min.dt, emf = emf) 
7.
.f(.x[[i]], ...) 
6.
map(., ~prefilter(data = .x, vmax = vmax, ang = ang, distlim = distlim, 
    spdf = spdf, min.dt = min.dt, emf = emf)) 
5.
d %>% split(., .$id) %>% map(~prefilter(data = .x, vmax = vmax, 
    ang = ang, distlim = distlim, spdf = spdf, min.dt = min.dt, 
    emf = emf)) 
4.
foieGras::fit_ssm(x, model = "crw", time.step = time_step, vmax = 10) at get_3d.r#35
3.
FUN(X[[i]], ...) 
2.
lapply(df.locs, function(x) foieGras::fit_ssm(x, model = "crw", 
    time.step = time_step, vmax = 10)) at get_3d.r#35
1.
get_3d(etuff, series = ts, fG = T)
camrinbraun commented 2 years ago

which tag does this occur on?

marosteg commented 2 years ago

Still Lotek-specific, I've been testing it on this fish: 172419_2003_A1246

camrinbraun commented 2 years ago

Working fine for me. Stop by later if you're able

Screen Shot 2021-10-29 at 10 04 33 AM .