Skip to content

Instantly share code, notes, and snippets.

View mwtoews's full-sized avatar

Mike Taves mwtoews

View GitHub Profile
@mwtoews
mwtoews / ST_RedistributeVertices.sql
Created March 10, 2015 20:25
ST_RedistributeVertices
CREATE OR REPLACE FUNCTION ST_RedistributeVertices(
geom geometry,
distance double precision,
null_for_small boolean DEFAULT false)
RETURNS geometry AS $body$
DECLARE
perimeter numeric;
num_vert integer;
@mwtoews
mwtoews / osr_roundtrips.py
Last active August 29, 2015 14:17
OSR roundtrips
#!/usr/bin/env python
import os
import difflib
import subprocess
from osgeo import gdal
from osgeo import osr
from glob import glob
gdal.UseExceptions()
osr.UseExceptions()
opening /amp/gw/sw/share/gdal/cubewerx_extra.wkt
opening /amp/gw/sw/share/gdal/ecw_cs.wkt
opening /amp/gw/sw/share/gdal/epsg.wkt
including: /amp/gw/sw/share/gdal/esri_extra.wkt
opening /amp/gw/sw/share/gdal/esri_extra.wkt
including: /amp/gw/sw/share/gdal/cubewerx_extra.wkt
opening /amp/gw/sw/share/gdal/cubewerx_extra.wkt
opening /amp/gw/sw/share/gdal/esri_extra.wkt
opening /amp/gw/sw/share/gdal/esri_StatePlane_extra.wkt
opening /amp/gw/sw/share/gdal/esri_Wisconsin_extra.wkt
opening C:\Program Files\GDAL\gdal-data\cubewerx_extra.wkt
opening C:\Program Files\GDAL\gdal-data\ecw_cs.wkt
opening C:\Program Files\GDAL\gdal-data\epsg.wkt
including: C:\Program Files\GDAL\gdal-data\esri_extra.wkt
opening C:\Program Files\GDAL\gdal-data\esri_extra.wkt
including: C:\Program Files\GDAL\gdal-data\cubewerx_extra.wkt
opening C:\Program Files\GDAL\gdal-data\cubewerx_extra.wkt
opening C:\Program Files\GDAL\gdal-data\esri_extra.wkt
opening C:\Program Files\GDAL\gdal-data\esri_StatePlane_extra.wkt
opening C:\Program Files\GDAL\gdal-data\esri_Wisconsin_extra.wkt
# -*- coding: utf-8 -*-
import os
import re
re_fn = re.compile(r'(.+?\.)(f|for|f90|fpp)$')
# sdir = '/home/mwtoews/src/GWM-2005/src'
sdir = '.'
fn_lines = {}
@mwtoews
mwtoews / testlwrandom.out
Created January 31, 2019 10:26
output from testlwrandom.c
TEST10
R8_UNI computes pseudorandom values.
Two seeds, S1 and S2, are used.
R S1 S2
12345 34567
0.575025 493972830 1406600364
0.945577 390105768 506978341
@mwtoews
mwtoews / testlwrandom.c
Created January 31, 2019 10:28
test portability of PRNG
/**********************************************************************
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.net
*
* PostGIS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
/**********************************************************************
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.net
*
* PostGIS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
@mwtoews
mwtoews / NZHydSoc_2019_Mike_Toews_abstract.pdf
Last active December 11, 2019 04:02
NZHS 2019 - Toews & Hemmings - A surface water network method for generalising streams and rapid groundwater model development
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Download pest++ binaries, and install them in ./bin
"""
import os
import requests
import sys
import urllib