Skip to content

Instantly share code, notes, and snippets.

@dbaston
Created July 30, 2020 00:28
Show Gist options
  • Save dbaston/26e8b739dd2549cf1a4c9718981354d3 to your computer and use it in GitHub Desktop.
Save dbaston/26e8b739dd2549cf1a4c9718981354d3 to your computer and use it in GitHub Desktop.
crude exactextractr benchmark
time ./exactextract -r "pop:/home/dan/data/gpw_v4_population_count_rev11_2020_30_sec.tif" -p /home/dan/data/gadm36_level_0.gpkg -f GID_0 --stat "sum(pop)" -o /tmp/country_pop.csv
# 37.42s user 5.62s system 98% cpu 43.520 total
time R -q -e 'r <- raster::raster("/home/dan/data/gpw_v4_population_count_rev11_2020_30_sec.tif"); p <- sf::st_read("/home/dan/data/gadm36_level_0.gpkg"); country_pop <- cbind(p$GID_0, exactextractr::exact_extract(r, p, "sum")); write.csv(country_pop, "/tmp/country_pop_r.csv", row.names=FALSE, quote=FALSE)'
# 69.44s user 10.54s system 99% cpu 1:20.01 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment