Skip to content

Instantly share code, notes, and snippets.

View jsta's full-sized avatar
🐻‍❄️
...

Jemma Stachelek jsta

🐻‍❄️
...
View GitHub Profile
@jsta
jsta / curate_dropbox.R
Last active September 7, 2020 22:44
Curate Dropbox - List file and folder sizes to identify deletion targets
library(rdrop2) # devtools::install_github("karthik/rdrop2")
library(dplyr)
top_level_path <- function(x){
stringr::str_extract(x, "^(.+?)(\\/)")
}
rdrop2::drop_auth()
file_list_raw <- drop_dir(recursive = TRUE)
@jsta
jsta / README.md
Created August 26, 2020 12:23
Setup local instance of mediagoblin
@jsta
jsta / README.md
Last active August 19, 2026 15:37
Explore the two dams associated with the 2020 Midland, MI flooding
@jsta
jsta / zenodo.R
Created March 11, 2019 00:46
Download files from Zenodo record id
#' Download files from Zenodo record id
#'
#' @param record_id record id
#' @param dest_folder destination folder for file downloads
#' @param token API key
#'
#' @details https://github.com/zenodo/zenodo/issues/1629#issuecomment-435062462
#'
#' @importFrom httr GET content
#' @importFrom jsonlite fromJSON
@jsta
jsta / elevatr_rayshade.R
Created June 8, 2018 18:10
Pull elevation data with the elevatr package and rayshade with rayshader package
library(raster)
library(elevatr)
library(rayshader)
library(reshape2)
library(ggplot2)
data(lake)
x <- get_elev_raster(lake, z = 12)
x_mat <- as.matrix(x)
x_rsh <- rayshader::rayshade(x_mat,
@jsta
jsta / ice_cover-erie.R
Last active January 4, 2018 19:24
Download Lake Erie Ice Cover Data
library(rvest)
library(ggplot2)
url <- "https://coastwatch.glerl.noaa.gov/statistic/statistic.html"
html <- read_html(url)
data_links <- html_attr(html_nodes(html, "table:nth-child(3) td a"), "href")
table_header <- readLines(paste0(gsub(basename(url), "", url),
data_links)[1])[6]
table_header <- unlist(strsplit(strsplit(table_header, " ")[[1]], " "))
@jsta
jsta / gleon-lakes_wikipedia.R
Last active December 7, 2017 14:31
Counting the number of GLEON lake sites that resolve to a Wikipedia page
# GLEON lakes according to Wikipedia
library(rvest)
library(wikilake)
library(sf)
library(maps)
# get data ####
gleon_lakes <- read_html("http://gleon.org/lakes")
gleon_lakes <- html_nodes(gleon_lakes, ".views-field")
@jsta
jsta / loch-ness_world-population.R
Created November 24, 2017 21:18
How many times over can Loch Ness hold the volume of the world population?
library(wikilake)
library(wbstats)
library(dplyr)
dt <- lake_wiki("Loch Ness")
loch_volume <- as.numeric(substring(dt$`Water volume`, 0, 3))
pop_data <- wb(indicator = "SP.POP.TOTL", startdate = 2016, enddate = 2017)
pop_data <- filter(pop_data, country == "World")