This file contains 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
Site ID | X | Y | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | |
---|---|---|---|---|---|---|---|---|---|---|
1 | 463872 | 99874 | 42.54 | 41.9 | 42.57 | 44.33 | 43.52 | 38.8 | 42.92 | |
2 | 463705 | 99371 | 17.48 | 16.5 | 16.55 | 15.74 | 17.4 | 16.38 | 17.09 | |
3 | 463408 | 99460 | 26.63 | 22.1 | 25.67 | 24.07 | 25.75 | 23.7 | 24.13 | |
4 | 463190 | 100390 | 36.35 | 31.51 | 27.97 | 30.54 | 34.7 | 34.2 | 34.04 | |
5 | 464230 | 102194 | 28.62 | 27.49 | 28.93 | 27.53 | 29.52 | 24.48 | 28.08 | |
6 | 464331 | 102197 | 35.62 | 38.29 | 34.85 | 46.06 | 36.08 | 32.08 | 30.86 | |
7 | 464291 | 102279 | 29.78 | 30 | 26.53 | 26.05 | 28.09 | 27.32 | 27.74 | |
8 | 466690 | 104355 | 28.81 | 27.22 | 28.37 | 28.43 | 29.94 | 26.75 | 25.97 | |
9 | 465621 | 105528 | 35.07 | 31.95 | 33.88 | 34.98 | 40.86 | 37.06 | 36.7 |
This file contains 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 __future__ import unicode_literals | |
from __future__ import print_function | |
def SplitQuoted(inStr, delim=','): | |
if '"' in delim or '\\' in delim: | |
raise ValueError("Delimiter not supported") | |
l = len(inStr) |
This file contains 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
//By Tim Sheerman-Chase, released under CC0 | |
//Compile: g++ shapelib_example.cpp -lshp -o shapelib_example | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include "shapefil.h" | |
using namespace std; | |
int main(int argc, const char **argv) |
This file contains 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 pyo5m import OsmData | |
import requests | |
if __name__=="__main__": | |
# | |
osc = OsmData.OsmChange() | |
osc.LoadFromOscXml(open("bad_changeset.osc", "rb")) | |
refNodes, refWays, refRelations = set(), set(), set() |
This file contains 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
#Download osc diffs using custom pycrocosm api method | |
#Released under CC0 license | |
import requests | |
import datetime | |
import os | |
import gzip | |
def DownloadDiffs(epoch = datetime.date(2016, 9, 27), | |
dt=datetime.timedelta(1), |
This file contains 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 os | |
import requests | |
if __name__=="__main__": | |
interval = "day" | |
pth = "/home/tim/replicatefsm" | |
#Check what already exists | |
fiList = os.listdir(pth) |
This file contains 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 numpy as np | |
def EqualizeHistogram(a, bins): | |
a = np.array(a) | |
hist, bins2 = np.histogram(a, bins=bins) | |
#Compute CDF from histogram | |
cdf = np.cumsum(hist, dtype=np.float64) | |
cdf = np.hstack(([0], cdf)) | |
cdf = cdf / cdf[-1] |
This file contains 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 csv | |
# Filtering file https://data.gov.uk/dataset/7ec10db7-c8f4-4a40-8d82-8921935b4865/national-statistics-postcode-lookup-uk | |
if __name__=="__main__": | |
reader = csv.DictReader(open("/home/tim/Downloads/National_Statistics_Postcode_Lookup_UK.csv")) | |
out = csv.DictWriter(open("natstats-po-postcodes.csv", "wt"), reader.fieldnames) | |
out.writeheader() |
This file contains 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
#OS Codepoint file reader, by Tim Sheerman-Chase 2018 | |
#Released under the CC0 license. | |
import zipfile | |
import csv | |
import os | |
import io | |
#Get Code point open from https://www.ordnancesurvey.co.uk/business-and-government/products/code-point-open.html | |
def ReadCodePoint(fi, callback): |
This file contains 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
#To write: curl http://localhost:8000/ --upload-file test.xml | |
#and to read: curl http://localhost:8000/ | |
from __future__ import print_function | |
from __future__ import unicode_literals | |
import sys | |
if sys.version_info[0] >= 3: | |
import http.server as httpserver | |
import socketserver | |
else: | |
import BaseHTTPServer as httpserver |