This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | |
@prefix rel: <http://vocab.org/relationship/> . | |
@prefix wikipedia: <http://en.wikipedia.org/wiki/> . | |
@prefix dc: <http://purl.org/dc/elements/1.1/> . | |
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . | |
@prefix bio: <http://vocab.org/relationship/> . | |
<me> a foaf:PersonalProfileDocument ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INPUT := a.tif b.tif c.tif d.tif e.tif | |
# This is how you could use gdal_merge.py to combine all the input files | |
# BUT: gdal_merge.py loads them all into memory first, so it can exceed your system memory very easily! | |
.ONESHELL: | |
all.gdal_merge.tif : $(INPUT) | |
gdal_merge.py -o $@ -of GTiff -co TILED=YES -co COMPRESS=LZW -co TFW=YES -co BLOCKXSIZE=128 -co BLOCKYSIZE=128 -co NUM_THREADS=ALL_CPUS -ot UInt16 -n 0 $^ | |
# gdalwarp does not suffer from this limitation, but is a bit harder to use, so here's how I do it in a Makefile | |
all.gdalwarp.tif : $(INPUT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import warnings | |
from functools import wraps | |
def ignore_warnings(f): | |
@wraps(f) | |
def inner(*args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build/ESRI_Census_Based_2013_NZTM.zip: | |
mkdir -p $(dir $@) | |
curl -o $@ http://www3.stats.govt.nz/digitalboundaries/census/$(notdir $@) | |
build/ESRI_Census_Based_2013_NZTM.shp: build/ESRI_Census_Based_2013_NZTM.zip | |
unzip -od $(dir $@) $< | |
touch $@ | |
build/wards.geojson: build/ESRI\ shapefile\ Output/2013\ Digital\ Boundaries\ Generalised\ Clipped/WARD2013_GV_Clipped.shp | |
ogr2ogr -f GeoJSON build/wards.geojson build/ESRI\ shapefile\ Output/2013\ Digital\ Boundaries\ Generalised\ Clipped/WARD2013_GV_Clipped.shp -s_srs EPSG:2193 -t_srs EPSG:2193 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pint | |
ureg = pint.UnitRegistry() | |
def is_str_valid_pint_unit(unit): | |
try: | |
ureg(unit) | |
except pint.errors.UndefinedUnitError: | |
return False | |
return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pint | |
ur = pint.UnitRegistry() | |
Q = ur.Quantity | |
def convert(array, source, target): | |
''' | |
Convert a list in one unit to a list in another, using Pint. | |
Simple but saves me from writing this repeatedly in ipython. | |
<source> and <target> must be Pint units, e.g. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qgis.utils | |
import pycurl | |
import StringIO | |
import json | |
buffer = StringIO.StringIO() | |
c = pycurl.Curl() | |
c.setopt(c.URL, 'http://ipinfo.io/') | |
c.setopt(c.WRITEDATA, buffer) | |
c.perform() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from osgeo import gdal, osr | |
# Click on your layer in the TOC | |
alayer = qgis.utils.iface.activeLayer() | |
bag = gdal.Open(alayer.source()) | |
bag_gtrn = bag.GetGeoTransform() | |
bag_proj = bag.GetProjectionRef() | |
bag_srs = osr.SpatialReference(bag_proj) | |
geo_srs =bag_srs.CloneGeogCS() | |
transform = osr.CoordinateTransformation( bag_srs, geo_srs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: [email protected] | |
# | |
# License: BSD (3-clause) | |
# XXX clafify licensing | |
import numpy as np | |
from collections import namedtuple | |
from scipy.signal import detrend | |
from scipy import stats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Full | Abbreviation | |
---|---|---|
Access | Accs | |
Dune | Dune | |
Accessway | Accswy | |
Elm | Elm | |
Alley | Aly | |
End | End | |
Anchorage | Ancg | |
Entrance | Ent | |
Approach | App |