Skip to content

Instantly share code, notes, and snippets.

# Code from https://www.uva.nl/en/profile/l/o/e.e.vanloon/e.e.vanloon.html
# Implementation of the MapCurves algorithm (DOI 10.1007/s10109-006-0025-x)
mapcurves <- function(A, B, plotGOF = TRUE) {
## R implementation of the mapcurves goodness of fit measure
## (Hargrove et al. 20006, see full reference below) for comparing
## two categorical maps
##
## usage:
@merriam
merriam / SensorFusion Emerging LIDAR.md
Created July 29, 2018 00:04
Sensor Fusion Meeting: Emerging LIDAR concepts and Sensor Technologies for AV
@scbrown86
scbrown86 / json_to_geopackage.R
Created June 11, 2018 11:58
geoJSON to multilayer geopackage R
# Convert a GeoJSON object to a geopackage
# Add a second geoJSON object in as a second layer
# https://gis.stackexchange.com/q/223240/24249
library(rgdal)
library(sf)
# Here I open a shapefile, but readOGR can be used to read geoJSON files
nc <- st_as_sf(readOGR(system.file("shape/nc.shp", package = "sf")))

This page is a curated collection of Jupyter/IPython notebooks that are notable for some reason. Feel free to add new content here, but please try to only include links to notebooks that include interesting visual or technical content; this should not simply be a dump of a Google search on every ipynb file out there.

Important contribution instructions: If you add new content, please ensure that for any notebook you link to, the link is to the rendered version using nbviewer, rather than the raw file. Simply paste the notebook URL in the nbviewer box and copy the resulting URL of the rendered version. This will make it much easier for visitors to be able to immediately access the new content.

Note that Matt Davis has conveniently written a set of bookmarklets and extensions to make it a one-click affair to load a Notebook URL into your browser of choice, directly opening into nbviewer.

@sgillies
sgillies / advanced_rasterio_features.ipynb
Last active October 19, 2024 17:20
Advanced Rasterio features notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scbrown86
scbrown86 / stratified.R
Last active February 16, 2021 15:29 — forked from mrdwab/stratified.R
Stratified random sampling from a `data.frame` in R
stratified <- function(df, group, size, select = NULL,
replace = TRUE, bothSets = FALSE) {
if (is.null(select)) {
df <- df
} else {
if (is.null(names(select))) stop("'select' must be a named list")
if (!all(names(select) %in% names(df)))
stop("Please verify your 'select' argument")
temp <- sapply(names(select),
function(x) df[[x]] %in% select[[x]])
@connormanning
connormanning / houston.md
Last active January 30, 2021 15:31
Houston LAZ files
@scbrown86
scbrown86 / ColoredQuant_ggplot2.R
Created August 30, 2017 04:00 — forked from Rekyt/ColoredQuant_ggplot2.R
Color Quantile from a density in ggplot2 with labeled quantiles
# Script from a density to color quantiles area
# Packages ---------------------------------------------------------------------
library(ggplot2)
library(dplyr)
# Data -------------------------------------------------------------------------
r_data = rnorm(100) # Computes 100 values
r_quant = quantile(r_data, probs = seq(0, 1, 0.1)) # Computes quantiles

This page is a curated collection of Jupyter/IPython notebooks that are notable for some reason. Feel free to add new content here, but please try to only include links to notebooks that include interesting visual or technical content; this should not simply be a dump of a Google search on every ipynb file out there.

Important contribution instructions: If you add new content, please ensure that for any notebook you link to, the link is to the rendered version using nbviewer, rather than the raw file. Simply paste the notebook URL in the nbviewer box and copy the resulting URL of the rendered version. This will make it much easier for visitors to be able to immediately access the new content.

Note that Matt Davis has conveniently written a set of bookmarklets and extensions to make it a one-click affair to load a Notebook URL into your browser of choice, directly opening into nbviewer.

@scbrown86
scbrown86 / diverge0.R
Created May 22, 2017 06:04 — forked from johnbaums/diverge0.R
Plot a rasterVis::levelplot with a colour ramp diverging around zero
diverge0 <- function(p, ramp) {
# p: a trellis object resulting from rasterVis::levelplot
# ramp: the name of an RColorBrewer palette (as character), a character
# vector of colour names to interpolate, or a colorRampPalette.
require(RColorBrewer)
require(rasterVis)
if(length(ramp)==1 && is.character(ramp) && ramp %in%
row.names(brewer.pal.info)) {
ramp <- suppressWarnings(colorRampPalette(brewer.pal(11, ramp)))
} else if(length(ramp) > 1 && is.character(ramp) && all(ramp %in% colors())) {