start new:
tmux
start new with session name:
tmux new -s myname
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf | |
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/ | |
def getJenksBreaks( dataList, numClass ): | |
dataList.sort() | |
mat1 = [] | |
for i in range(0,len(dataList)+1): | |
temp = [] | |
for j in range(0,numClass+1): | |
temp.append(0) |
# -*- coding: utf-8 -*- | |
# -*- mode: python -*- | |
# Adapted from mpl_toolkits.axes_grid1 | |
# LICENSE: Python Software Foundation (http://docs.python.org/license.html) | |
from matplotlib.offsetbox import AnchoredOffsetbox | |
class AnchoredScaleBar(AnchoredOffsetbox): | |
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4, | |
pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None, | |
**kwargs): |
#!/usr/bin/env python | |
import wx | |
from wx import EVT_CLOSE | |
import wx.grid as gridlib | |
EVEN_ROW_COLOUR = '#CCE6FF' | |
GRID_LINE_COLOUR = '#ccc' | |
class PandasTable(wx.Frame): |
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/HL.r | |
### Function to pick out high and low tides from a dataset of tidal water levels | |
### | |
### Arguments: |
--- | |
version: 1 | |
disable_existing_loggers: False | |
formatters: | |
simple: | |
format: "%(name)-20s%(levelname)-8s%(message)s" | |
handlers: | |
console: | |
class: logging.StreamHandler | |
level: DEBUG |
import matplotlib.pyplot as plt | |
import numpy as np | |
from shapely.geometry import LineString | |
from shapely.ops import triangulate | |
def uniform_sample(poly, n=100): | |
""" | |
Uniformly sample the Delaunay triangulation of a polygon. If the polygon | |
is convex, this will uniformly sample its area. |
Detailed walk through of building extraction using postgis
First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.
LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele
This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.