Skip to content

Instantly share code, notes, and snippets.

View mdsumner's full-sized avatar

Michael Sumner mdsumner

View GitHub Profile

GOES-16 ABI-L2-MCMIPF data inconsistencies

A running log of every real-world anomaly we've hit while ingesting the s3://noaa-goes16/ABI-L2-MCMIPF/ archive into Icechunk via VirtualiZarr.

Each entry: what the file/day looks like, how it surfaced, how we handle it, and (when known) the most likely upstream cause.


@darrenwiens
darrenwiens / 3dep-tile-client
Created November 27, 2022 04:40
A client for consuming 3DEP tiles from Microsoft Planetary Computer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>3dep-tile-client</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js"></script>
<style>
@eliocamp
eliocamp / smooth2d.R
Last active August 10, 2022 16:57
Smooths a 2D field using Discrete Cosine Transform or SVD
#' Smooths a 2D field
#'
#' @param x,y Vector of x and y coordinates
#' @param value Vector of values
#' @param kx,ky Proportion of components to keep in the x and
#' y direction respectively. Lower values increased the smoothness.
#'
#' @examples
#' library(ggplot2)
#' # Creates a noisy version of the volcano dataset and applies the smooth
#anglr questions
# example...
library(gdalio)
library(rayshader)
library(topography)
library(gdalwebsrv)
library(anglr)
source(system.file("raster_format/raster_format.codeR", package = "gdalio", mustWork = TRUE))
#functions...
@coolbutuseless
coolbutuseless / ray-tracer.Rmd
Last active July 22, 2021 11:48
Simple ray tracer in Base R
MIT Licensed. Copyright (c) 2021 mikefc@coolbutuseless.com
Share and Enjoy.
## Introduction
This code was a personal challenge to write a simple ray-tracer in pure R.
Ray tracing is an example of something which is really silly to do in base R,
and I'd be interested to see how others would approach this problem.
library(rgl)
sl <- shapelist3d(cube3d(alpha = 1,
color = 'grey90',
specular = 'black',
lit = TRUE),
plot = FALSE)
create_next_level <- function(sl, level) {
@coolbutuseless
coolbutuseless / user-callbacks.R
Created September 8, 2020 04:32
mouse callbacks in rgl
library(rgl)
pan3d <- function(button, dev = rgl.cur(), subscene = currentSubscene3d(dev)) {
start <- list()
begin <- function(x, y) {
activeSubscene <- par3d("activeSubscene", dev = dev)
start$listeners <<- par3d("listeners", dev = dev, subscene = activeSubscene)
for (sub in start$listeners) {
@djnavarro
djnavarro / ff_b.cpp
Created August 22, 2020 10:30
fractal flame
#include <Rcpp.h>
using namespace Rcpp;
// turmite function to be called from R
// [[Rcpp::export]]
NumericMatrix flame(int iter, int layers) {
NumericMatrix points(iter, 3); // initially zero
NumericMatrix coeffs(9, layers);
@brodieG
brodieG / extruded-polygon-tests.R
Created May 2, 2020 21:15
Code used to test rayrender polygon extrusion patches
mk_name <- function(name=NULL) {
v <- as.character(packageVersion('rayrender'))
dir <- file.path('~', 'Downloads', 'rr-tests')
if(is.null(name)) {
name <- sprintf( 'a_%s.png', format(Sys.time(), "%Y-%m-%d_%H%M%S"))
} else {
name <- sprintf('%s.png', name)
}
file.path(dir, v, name)
}
@jamesgrecian
jamesgrecian / extract NSIDC.r
Last active June 12, 2018 15:08
Extract NSIDC geotiff data to points
############################################
### Extract NSIDC geotiff data to points ###
############################################
#Many thanks to mdsumner for help with this:
#https://github.com/mdsumner/extractNSIDC/blob/master/extract_script.R
#Load libraries
require(tidyverse)
require(lubridate)