Skip to content

Instantly share code, notes, and snippets.

@ateucher
ateucher / harmony_tempo.R
Created March 30, 2026 17:38 — forked from allanjust/harmony_tempo.R
Use harmony to subset TEMPO data from R
# demo of downloading a single spatially subset granule from TEMPO
# using harmony API
# Need dev version of earthdatalogin for edl_search() to work,
# install with:
# remotes::install_github("boettiger-lab/earthdatalogin")
library(earthdatalogin)
library(httr2)
# space-time bounds (API formatted strings)

following on from https://bsky.app/profile/jerry-shannon.bsky.social/post/3lcisatdppk2h

gdalinfo /vsigs/gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3
ERROR 15: No valid GCS credentials found. For authenticated requests, you need to set GS_SECRET_ACCESS_KEY, GS_ACCESS_KEY_ID, 
GS_OAUTH2_REFRESH_TOKEN, GOOGLE_APPLICATION_CREDENTIALS, or other configuration options, or create a /home/ubuntu/.boto file. Consult
https://gdal.org/en/stable/user/virtual_file_systems.html#vsigs-google-cloud-storage-files for more details. For unauthenticated requests
on public resources, set the GS_NO_SIGN_REQUEST configuration option to YES.
library(mapgl)
mapboxgl(
style = mapbox_style("streets"),
center = c(-87.61694, 41.86625),
zoom = 15.99,
pitch = 40,
bearing = 20,
antialias = TRUE
) |>
@Kodiologist
Kodiologist / example.parquet
Last active July 24, 2023 16:52
Example of writing and reading a Parquet file with XIS temperature predictions
# UPDATE: Instead of using this script, you should probably
# use http://web.archive.org/web/2021id_/https://modis.ornl.gov/files/modis_sin.kmz
#!/usr/bin/env python3
"""
Draw the shapes of tiles used by Moderate Resolution Imaging
Spectroradiometer (MODIS) satellite products. The output is a TSV file
with the shapes as well-known text (WKT) that can be read into QGIS.
"""
library(tidyterra)
library(tidyverse)
library(terra)
library(tigris)
library(sf)
library(mapboxapi)
# Get data from https://www.mrlc.gov/data/nlcd-2019-land-cover-conus
# Warning - it's big!
nlcd <- rast("~/data/nlcd_2019_land_cover_l48_20210604/nlcd_2019_land_cover_l48_20210604.img")
@grantmcdermott
grantmcdermott / bboot.R
Last active May 6, 2022 18:50
Bayesian bootstrap
# Context: https://twitter.com/grant_mcdermott/status/1487528757418102787
library(data.table)
library(fixest)
bboot =
function(object, reps = 100L, cluster = NULL, ...) {
fixest_obj = inherits(object, c('fixest', 'fixest_multi'))
@barronh
barronh / tempo_syntheticearlyadopters2.ipynb
Created November 10, 2021 15:37
tempo_syntheticearlyadopters2.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DavZim
DavZim / map_projections.R
Created January 20, 2021 10:37
Creates a gif of the world in different map projections
library(tidyverse)
library(sf)
library(spData)
library(gganimate)
data(world)
# see also: https://proj.org/operations/projections/index.html
projs <- list(
"Mercator" = "+proj=merc",
@mkiang
mkiang / 01_pull_data.R
Created December 10, 2020 22:35
Collaboration network 2020 version
## Visualizing authorship networks: code for this blog post:
## https://mathewkiang.com/2020/12/10/my-collaboration-network-for-2010-to-2020-other-plots
## Imports ----
library(scholar) # remotes::install_github("jkeirstead/scholar")
library(tidyverse)
library(fs)
library(here)
## Constants ----