A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K....
Transcript of A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K....
![Page 1: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/1.jpg)
A Python Workshop@
GIS in Action 2009by K. Urner
4D Studios: Other Tomorrow Project
![Page 2: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/2.jpg)
In memory of Russell Towle, a place-based geometer
http://home.inreach.com/rtowle/Towle.html
http://rememberingrusselltowle.blogspot.com/
![Page 3: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/3.jpg)
![Page 4: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/4.jpg)
Action: A screen shot Another example: A screen recording... then distribution media.
![Page 5: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/5.jpg)
Place based curriculum: the GUI “desktop” is a place too (a geography, requires navigation)
![Page 6: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/6.jpg)
Where I've Just Been...
![Page 7: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/7.jpg)
Lars @ Mozilla Corporation, uses Python on the serverhand painted Tshirt by Oregon artist
![Page 8: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/8.jpg)
Steve Holden PSF chairman
Ian BensonTizard / Stanford
Welcome to Rivendale... (see Blip TV)
![Page 9: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/9.jpg)
Pycon 2009: top geeks, geek guitars
![Page 10: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/10.jpg)
So What's New in Python Nation?
![Page 11: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/11.jpg)
But first (since this is a GIS conference)...
![Page 12: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/12.jpg)
Where is Python Nation?
... right next to the Republic of Perl
Note Netherlands, quite near
Guido: BDFL
![Page 13: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/13.jpg)
http://www.perl.com/lpt/a/956
![Page 14: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/14.jpg)
FOSS boss
Webus Vancouverous
Embedded in a FOSS context...
![Page 15: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/15.jpg)
Internals:● Python artwork protected by PSF● Class of '09 inducted● “EduPython” grows a longer tail● VM summit meeting● Release strategy (2.7, 3to2...)● python.org saga: cvs, svn, hg
![Page 16: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/16.jpg)
So whassup with Python?
![Page 17: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/17.jpg)
Google App Engine
![Page 18: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/18.jpg)
Python 3K(like Y2k but more fun)
![Page 19: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/19.jpg)
![Page 20: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/20.jpg)
![Page 21: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/21.jpg)
The __future__ is now● 3/2 == 1.5● no more classic classes● print(“me”) - a function● unicode source
![Page 22: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/22.jpg)
![Page 23: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/23.jpg)
EduPython Track
● Edu-Sig to André Roberge● Dr. Chuck at U Mich● Vern Ceder as Watcher● Crunchy, PyWhip, XO projects● Viennese Turtles (Gregor & Co.)● AlgebraFirst (Gattegno et al)
![Page 24: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/24.jpg)
OLPC.XO.pippy includes Fibonacci's and Pascal's
![Page 25: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/25.jpg)
![Page 26: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/26.jpg)
But what about Portlandia?
![Page 27: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/27.jpg)
She has a boyfriend in Gothenberg (Goth capital)
Lotsa FOSS bosses
EuroPython @ Chalmers 2005
Nano Tech (bucky tubes 'n balls)
HP4E (a meme campaign)
Guido's earlier CP4E (DARPA)
P4E (= programming + theater)
Shuttleworth Summit (London)
EuroPython @ CERN: Alan Kay
EuroPython @ Vilnius: more dots
Pycon @ Chicago (Bucky exhibit)
![Page 28: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/28.jpg)
Track A (lexical)
●Permutations (ascii / unicode)●prime / composite●gcd, lcd ●“modulo numbers”●totative / totients●finite groups, fields (algebra!)●euler's theorem, RSA
![Page 29: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/29.jpg)
29
Fermat’s Little Theorem
def gcd(a,b): """Euclidean Algorithm""" while b: a, b = b, a % b return abs(a)
if isprime(p) and gcd(b,p) == 1: try: assert pow(b, p - 1, p) == 1 except: raise \ Exception, 'Houston, we’ve got a problem.'
![Page 30: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/30.jpg)
30
Euler’s Theoremdef tots(n): return [i for i in range(1,n) if gcd(i, n)==1]
def phi(n): return len(tots(n))
if gcd(b,n) == 1: try: assert pow(b, phi(n), n) == 1 except: raise \ Exception, 'Houston, we’ve got a problem.'
![Page 31: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/31.jpg)
31
RSAdef demo(): """ Abbreviated from more complete version at: http://www.4dsolutions.net/satacad/sa6299/rsa.py""" plaintext = "hello world" m = txt2n(plaintext) p,q = getf(20), getf(20) # two big primes N = p*q phiN = (p-1)*(q-1) e = 3 s,t,g = eea(e, phiN) # Extended Euclidean Algorithm d = s % phiN c = encrypt(m,N) # pow(m, e, N) w/ booster newm = decrypt(c,d,N) # pow(c, e*d, N) plaintext = n2txt(newm) return plaintext
![Page 32: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/32.jpg)
32
Math Objects:grab from the library and/or build your own
>>> mypoly = Poly([ (7,0), (2,1), (3,3), (-4,10) ] )>>> mypoly(7) + (2*x) + (3*x**3) + (-4*x**10)
>>> int1, int2 = M(3, 12), M(5, 12) # used in crypto>>> int1 * int2 # operator overloading3>>> int1 – int210
>>> tetra = rbf.Tetra()>>> bigtetra = tetra * 3 # volume increases 27-fold>>> bigtetra.render()
![Page 33: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/33.jpg)
Track B (graphical)
● animals, shapes, polymorphism ● figurate / polytopal numbers● sphere packing● vectors, trig, XYZ, lat/long etc.● polyhedra as objects
![Page 34: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/34.jpg)
34
Sequence Generators
>>> def tritet(): term = trinum = tetranum = 1 while True: yield (term, trinum, tetranum) term += 1 trinum += term tetranum += trinum
>>> gen = tritet()>>> [gen.next() for i in range(6)][(1, 1, 1), (2, 3, 4), (3, 6, 10), (4, 10, 20), (5, 15, 35), (6, 21, 56)]
from Synergetics
by RBF w/ EJA
![Page 35: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/35.jpg)
35
Polyhedral Numbers
Animation: growing cuboctahedron
>>> gen = cubocta()>>> [gen.next() for i in range(6)][(1, 1, 1), (2, 12, 13), (3, 42, 55), (4, 92, 147), (5, 162, 309), (6, 252, 561)]
![Page 36: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/36.jpg)
36
Python + POVRay
![Page 37: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/37.jpg)
37
Functions and Figurate Numbers
def tri(n): return n * (n + 1) // 2
>>> [tri(x) for x in range(1, 10)][1, 3, 6, 10, 15, 21, 28, 36, 45]
Front cover:The Book of Numbersby Conway & Guy
![Page 38: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/38.jpg)
38
Python + VPython
![Page 39: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/39.jpg)
3939
Python + Tk
Cellular Automata ala Wolfram generated using graphics.py by John Zelle
![Page 40: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/40.jpg)
40
Demo: Mite, Sytes, Kites
with CubeIT!
by Huntar Company
MITE = A+ A B+or A+ A B
Some guy on YouTube
![Page 41: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/41.jpg)
Track C (synergetic)
● Rich data structures ● SQL (supermarket math) ● GIS / GPS (outdoor activities)● mvps, time dimension ● user requests and events ● web framework (Django?) ● client / server, design patterns
![Page 42: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/42.jpg)
XRLs: Extremely Remote Locations
Dodeca Cams!
Operation Other Tomorrow
SA: Storytelling...
![Page 43: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/43.jpg)
...
Recalling GIS in Action 2005, Lunch Keynote
Seattle: Home of SAGE and Science Fiction museum
Place-based Education: record to school intranet...
![Page 44: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/44.jpg)
HP4EGSTGlobal MatrixThe GridGeoscopeHexapentetc.
![Page 45: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/45.jpg)
Animal zOO
● Biotum class, instances = biota● Monkey, Dog, Snake classes● Eating and pooping (deque?)● Animal class (common ancestor)● Polymorphism: “passing the buck”● The __rib__ cage●“everything's a python in Python”
![Page 46: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/46.jpg)
Your job: train House M.D. in Python (a busy grumpy guy)
![Page 47: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/47.jpg)
![Page 48: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/48.jpg)
Figurate Numbers
Pascal's Triangle (triangular and tetrahedral numbers)
Fibonacci Numbers (converge to phi, pentagon math)
Vectors (VPython -- xyz, spherical coordinates etc.)
Prime Numbers (sieves)
Prime Numbers (trials by division)
Polyhedra (as Python objects: scale, rotate, translate)
Polyhedral Numbers (icosahedral, geodesic spheres)
Modulo Numbers (override __mul__, __add__)
Finite Groups (Python module)
Euclid's Algorithm (Guido's gcd)
Euclid's Extended Algorithm (needed for inverses)
Totient and Totative (gcd based)
Fermat's Little Theorem (assert...)
Euler's Theorem for Totients (assert...)
Mandelbrot Set (chaotic sequences)
Miller-Rabin (or Jython probablePrime)
RSA.encrypt(m, N)
RSA.decrypt(c, N, d=secretkey)
Excerpt from edusig
Gnu Math:
What the Bleep!?
![Page 49: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/49.jpg)
More Lore (let's pick a couple) :
The Winterhaven Experiment
The ISEPP Story
Recording the Columbia Gorge
XRLs and BarCamps
Place based education w/ dodecacams
FOSS meets Design Science
Location Scouting
![Page 50: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/50.jpg)
Oregon: home of the real Springfield(with thanks to Akbar font)
![Page 51: A Python Workshop GIS in Action 2009 by K. Urner · A Python Workshop @ GIS in Action 2009 by K. Urner 4D Studios: Other Tomorrow Project](https://reader034.fdocuments.net/reader034/viewer/2022042804/5f52dd8290902a0ab3755d05/html5/thumbnails/51.jpg)
http://coffeeshopsnet.blogspot.com/