I hereby claim:
- I am scw on github.
- I am scw (https://keybase.io/scw) on keybase.
- I have a public key whose fingerprint is DC95 4D84 4B97 617D 62FC 4498 F3E7 6E7C 03E8 FB6A
To claim this, I am signing this object:
import arcpy | |
import os | |
def create_path(path): | |
if not os.path.exists(path): | |
print "Creating directory {}".format(path) | |
os.makedirs(path) | |
# default application data dir; e.g. c:\Users\scw\AppData\Roaming |
import arcpy | |
class Toolbox(object): | |
def __init__(self): | |
self.label = u'Example_Toolbox' | |
self.alias = '' | |
self.tools = [FirstTool, SecondTool, ThirdTool] | |
class FirstTool(object): |
import arcpy | |
import binascii | |
line = arcpy.FromWKT('LINESTRING (30 10, 10 30, 40 40)') | |
print binascii.hexlify(line.WKB) | |
# produces: | |
# 0102000000030000000000000000003e40000000000000244000000000000024400000000000003e4000000000000044400000000000004440 |
# this test should be run after a fresh run of makeaddin to rebuild the .esriaddin file. | |
class TestAddin(unittest.TestCase): | |
def setUp(self): | |
self.addin_path = os.sep.join([local_path, '..', '..', 'btm.esriaddin']) | |
self.addin_zip = zipfile.ZipFile(self.addin_path, 'r') | |
def testToolboxIsPresent(self): | |
toolbox_path = 'Install/toolbox/btm.pyt' | |
self.assertTrue(toolbox_path in self.addin_zip.namelist()) |
import pyproj | |
import arcpy | |
# ArcMap result (meters): | |
# 306,414.514 854,124.573 | |
x = -70.216908 | |
y = 41.930268 | |
# perform projection using pyproj (PROJ.4) |
I hereby claim:
To claim this, I am signing this object:
# I've added this to my ~/.bash_profile to use it, you could also create a stand-alone shell script. | |
# Usage: pipx install cython | |
function pipx() { | |
# Many Python packages don't install correctly with clang, as mentioned here: | |
# https://gist.github.com/goldsmith/7262122 | |
# This wrapper forces gcc for pip installations: | |
export CFLAGS="-arch i386 -arch x86_64" | |
export FFLAGS="-m32 -m64" |
def time_in_min(time_string): | |
# assumes 24h times | |
(hour, minutes) = [int(t) for t in time_string.split(":")] | |
return hour * 60 + minutes | |
def min_to_time(time_min): | |
minutes = time_min % 60 | |
hours = (time_min - minutes) / 60 | |
# return hour:minutes with leading zero | |
return "{0}:{1:02d}".format(hours,minutes) |
def jaro_cost(inputs, weight=1): | |
min_score = 1.0 | |
for a,b in list(itertools.combinations(inputs, 2)): | |
jaro_score = jellyfish.jaro_distance(a, b) | |
if jaro_score < min_score: | |
min_score = jaro_score | |
return (1 - min_score)*weight | |
def attr_score(attribute): |
SPAGeDi 1.4c (build 17-07-2013) - a program for Spatial Pattern Analysis of Genetic Diversity | |
Written by Olivier Hardy & Xavier Vekemans | |
Contributions by Reed Cartwright | |
Input file : "C:\Users\shau7031\AppData\Roaming\geneGIS\spagedi_data.txt" | |
Results file : "Z:\data\arcgis\addins\genegis\tests\data\tmxr.txt" | |
1318 individuals | |
2 categories: CA-OR, Cent_Am | |
Latitude-longitude coordinates (assumed to be in degrees; used to compute distances in km), Latitude, Longitude |