Skip to content

Instantly share code, notes, and snippets.

K. Arthur Endsley arthur-e

Block or report user

Report or block arthur-e

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arthur-e
arthur-e / temperature.py
Created May 18, 2017
An example Python script for the Software Carpentry Python lesson (https://github.com/arthur-e/swc-workshop/tree/master/python-climate)
View temperature.py
'''
Reports the min and max July temperatures for each file
that matches the given filename pattern.
'''
import csv
import os
import sys
import glob
@arthur-e
arthur-e / raster_learning.py
Created Mar 10, 2017
An example Python script of using scikit-learn to learn water from non-water pixels
View raster_learning.py
'''
A module for machine learning on Landsat data; implemented and tested,
specifically, for learning water areas on an image. Performance so far:
Gaussian naive Bayes (where validation data chosen by the hydro mask):
Mean precision: Not water=0.9997, Water=0.3090
Mean recall: Not water=0.9787, Water=0.9763
Gaussian naive Bayes (where validation data inspected in Google Earth):
Mean precision: Not water=0.9675, Water=1.0000
@arthur-e
arthur-e / aggregation.Rmd
Last active Aug 6, 2016
A comparison of aggregation methods in R using the Gapminder data from Data Carpentry
View aggregation.Rmd
---
title: "Aggregation in R"
author: "K. Arthur Endsley"
date: "August 4, 2016"
output: html_document
---
Let's explore multiple ways to aggregate data in R.
We'll do this to answer two questions:
@arthur-e
arthur-e / graham_hull.py
Last active Jul 17, 2019 — forked from tixxit/hull.py
Graham's scan convex hull algorithm, updated for Python 3.x
View graham_hull.py
def convex_hull_graham(points):
'''
Returns points on convex hull in CCW order according to Graham's scan algorithm.
By Tom Switzer <thomas.switzer@gmail.com>.
'''
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def cmp(a, b):
return (a > b) - (a < b)
@arthur-e
arthur-e / deaths_malaria.txt
Last active Jan 12, 2016
Prevalence of current tobacco use among adults (>=15 years) (%) both sexes, columns are: country name, 2002 prevalence (%), 2005 prevalence (%); all data from GapMinder.org
View deaths_malaria.txt
country 2000 2001 2002 2003 2004 2005 2006
Algeria 0 0 0
Angola 96 66 98 254 80 86 62
Benin 10 6 9 7 11 4 16
Botswana 2 2 1 1 1 1 2
Burkina Faso 23 35 32 37 31 37 56
Burundi 9 6 7 6 9 25 5
Cameroon 5 5
Cape Verde 0 0 0 0 0 1
Central African Republic 14 10 21 16 20
@arthur-e
arthur-e / LEDAPS_build_from_source.sh
Created May 6, 2015
A walkthrough for building LEDAPS 2.2.0 and its dependencies from source on Ubuntu GNU/Linux 14.04
View LEDAPS_build_from_source.sh
USERNAME=heyyouguys
# NOTE: Could not determine which jpeg library should be installed; it's probably installed by default
sudo apt-get install libtiff5 libtiff5-dev libgeotiff2 libgeotiff-dev libxml2 libxml2-dev
# http://www.hdfgroup.org/release4/obtainsrc.html
sudo mkdir /usr/local/hdf4 && sudo chown $USERNAME /usr/local/hdf4 && cd /usr/local/hdf4
wget http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/hdf-4.2.11.tar.gz
tar -xzvf hdf-4.2.11.tar.gz
cd hdf-4.2.11
@arthur-e
arthur-e / notes.md
Last active May 25, 2019
Ubuntu for GIS Installation and Setup
View notes.md

Post-Installation Fixes and Setup

# Install compilers and linking tools; other tools
sudo apt-get install g++ swig curl build-essential python-all-dev

# Install package manager
sudo apt-get install synaptic

# Install Unity customization tool
sudo apt-get install unity-tweak-tool
@arthur-e
arthur-e / colorBrewer.js
Created Apr 10, 2014
Generates higher-contrast sequential or diverging color palettes based on Cynthia Brewer's colors; outputs the same format as d3/lib/colorbrewer but colors are higher-contrast.
View colorBrewer.js
chroma = require('./node_modules/chroma-js/chroma.min.js');
function generatePalettes (type, reversed) {
var n, m;
var paletteNames;
var palettes = {};
if (type === 'sequential') {
paletteNames = [
'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu',
@arthur-e
arthur-e / seedrecovery.py
Last active Aug 29, 2015
Tool(s) to recover the Markdown contents from an older Springseed *.note file.
View seedrecovery.py
'''
Recover the Markdown content of an older Springseed note (*.note) file. Output
*.md file names will be the name of the Note file prepended by the Notebook
name, if available.
'''
import sys
import os
import re
import json
@arthur-e
arthur-e / Django_CSV_Loader.py
Created Feb 17, 2014
An example Django command (through the django-admin.py or manage.py interface) for loading in generic CSV data; a design pattern that should apply well to just about any delimited data.
View Django_CSV_Loader.py
import csv
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db.models.fields import FieldDoesNotExist
from scour_server.nbi.models import Bridge
class Command(BaseCommand):
args = '<path>'
help = ''
You can’t perform that action at this time.