Skip to content

Instantly share code, notes, and snippets.

@cboettig
Created April 25, 2022 21:58
Show Gist options
  • Save cboettig/4683cd0919527ca78551a7037a243198 to your computer and use it in GitHub Desktop.
Save cboettig/4683cd0919527ca78551a7037a243198 to your computer and use it in GitHub Desktop.
library(arrow)
library(dplyr)
library(terra)
path <- arrow::s3_bucket("ebird/observations", endpoint_override = "minio.carlboettiger.info")
obs <- arrow::open_dataset(path) |> to_duckdb()
df <- obs |> mutate(latitude = round(latitude, digits=1),
longitude = round(longitude, digits=1)) |>
count(longitude, latitude) |> collect() |>
mutate(n = log(n))
r <- rast(df, crs="epsg:4326")
y <- r; y[] <- 0; r <- cover(r,y) # NA fill
plot(r, col= viridisLite::viridis(100) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment