We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cut.trip does most of the work, but it seems to add in a stray day with the walrus data.
library(trip) data(walrus818) prj <- "+proj=laea +lon_0=-165 +lat_0=90 +ellps=WGS84" walrus <- spTransform(walrus818, prj) grid <- rasterize(walrus) #grid <- rasterize(tr[[1]], method = "density") tr <- cut(walrus, "1 day") library(raster) library(tibble) library(dplyr) tib1 <- function(x) { bind_cols(as_tibble(as.data.frame(x)), tibble(cell = seq(ncell(x)))) %>% filter(z > 0) } st <- bind_rows(lapply(tr, function(x) tib1(rasterize(x, grid = grid))), .id = "interval") sum(st$z) [1] 45500400 > cellStats(gg, sum) [1] 44640000
Somewhere here is integration with splat/SGAT and tabularaster.
The text was updated successfully, but these errors were encountered:
this works, but a bit slow still
library(trip) library(dplyr) library(furrr) x <- trip(readr::read_csv("inst/extdata/MI_albatross_sub10.csv") %>% dplyr::select(lon, lat, gmt, tag_ID)) x <- spTransform(x, "+proj=laea +lat_0=-90") r <- raster(x, res = 50000) spx <- explode(x) plan(multiprocess) l <- furrr::future_map_dfr(split(spx, 1:nrow(spx)), function(a) tibble(cell = unlist(cellFromLine(r, a) )), .id = "segment") l$dur <- spx$timedur[as.integer(l$segment)] dd <- l %>% group_by(segment) %>% mutate(dur = dur/n()) %>% ungroup() %>% group_by(cell) %>% summarize(dur = sum(dur)) r[] <- 0 r[dd$cell] <- dd$dur plot(r) cellStats(r, sum) [1] 1286139971 > sum(spx$timedur) [1] 1286139971
Sorry, something went wrong.
No branches or pull requests
cut.trip does most of the work, but it seems to add in a stray day with the walrus data.
Somewhere here is integration with splat/SGAT and tabularaster.
The text was updated successfully, but these errors were encountered: