Skip to content

Instantly share code, notes, and snippets.

View danhammer's full-sized avatar

Dan danhammer

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import requests
import multiprocessing
from datetime import datetime
ALERT_URL = 'http://forma-cs-validation.elasticbeanstalk.com/api/alerts'
def _screener(x):
try:
not_cached = x['cached'] is not True
import scipy
from scipy import ndimage
import copy
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import numpy as np
from spaceknow.horik import tools
@danhammer
danhammer / gist:109a3789bc811d29abab
Created September 25, 2014 17:39
scrape spaceapps
from bs4 import BeautifulSoup
import requests
import urllib
import pandas
import json
import itertools
import os
BASE = "https://2014.spaceappschallenge.org/awards/#globalnom"
GOOGLE_GEOCODE_URL = 'https://maps.googleapis.com/maps/api/geocode/json'
@danhammer
danhammer / gist:7d844482de9a42aba185
Last active August 29, 2015 14:15
quick script to show earth imagery in python
import requests
from StringIO import StringIO
from pprint import pprint
from PIL import Image
from numpy import array
base = "https://api.data.gov/nasa/planetary/earth"
payload = {
"lon": -122.066133,
import requests
import urllib
BASE = "http://beta.gfw-apis.appspot.com/forest-change/forma-alerts"
period = "2008-01-01,2012-09-24"
sample_area = {
"geometry": {
"type": "Polygon",
"coordinates": [
@danhammer
danhammer / map.geojson
Created April 15, 2015 15:18
kalimantan sample region
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danhammer
danhammer / vegetation_grab.py
Last active August 29, 2015 14:25
Demonstration of vegetation score extraction
# Sample code to demonstrate the vegetation extraction from satellite imagery.
# The example region is a small plot in the central valley:
# https://gist.github.com/danhammer/47590518ece27c2ef0ab
# Specifically, this reports the mean and standard deviation EVI score for all
# 30m pixels within the supplied polygon. To install the requests package on a
# Mac, type `sudo pip install requests` or visit this page for more comprehensive
# install instructions:
# Sample code to identify buildings withing a supplied bounding box.
import requests
def grabber(bbox, residential=True):
BASE = "http://wolak.enviro-service.appspot.com/buildings"
payload = bbox
payload['residential'] = residential
res = requests.get(BASE, params=payload).json()
return res
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.