Skip to content

Instantly share code, notes, and snippets.

View chryss's full-sized avatar

Chris Waigl chryss

View GitHub Profile
import argparse
import collections
# Let's define a global dispatch table for the 8 different possible neighbors
# clockwise starting top-left: tl, t, tr, r, br, b, bl, l.
# The target index only depends on the number of rows and the start index jj
# As we won't know beforehand which functions to use for a given start index,
# we make them all dependent on both jj and n
neighbordispatch = {
import argparse
def dosomething(someinput):
pass
def main():
parser = argparse.ArgumentParser()
parser.add_argument("infilepath")
args = parser.parse_args()
#!/usr/bin/env python
# encoding: utf-8
"""
evaluatehfdi_debug.py
Debugging scikit-learn Gaussian Mixture Model parameter choice.
Created by Chris Waigl on 2014-05-13.
Copyright (c) 2014 Christine F. Waigl. MIT License.
"""
#!/usr/bin/env bash
#
# clip_usgs_to_shape.sh
# Clip individual band files from USGS-distributed remote-senisng images
# to extent of polygon provided in a shapefile, using the GDAL command line
# tools.
#
# Chris Waigl, 2014-04-15
#
# Input:
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
import numpy as np
from osgeo import gdal, gdal_array
typemap = {}
typenames = {}
for name in dir(np):
obj = getattr(np, name)
if hasattr(obj, 'dtype'):
try:
@chryss
chryss / puppyweights1.r
Last active January 1, 2016 04:29
The puppy code
require(RCurl)
require(reshape2)
require(ggplot2)
puppies <- getURL("https://docs.google.com/spreadsheet/pub?key=0AtKrmILNPprEdEY4MFA5SWt5THRyYlB4cnhUNkxuOVE&single=true&gid=3&output=csv")
puppydat <- read.csv(textConnection(puppies), header=TRUE)
puppyflat <- melt(puppydat)
p <- ggplot(puppyflat, aes(X, value, color=factor(variable), group=variable))
@chryss
chryss / gist:7815051
Created December 5, 2013 22:20
Knik 200 Dog Sled Race Trail GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / gist:7638837
Last active December 29, 2015 07:49
Python 3 testbed
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{