200 likes | 300 Views
Python Tool to create genetic Divergence landscapes. William Perry U.S. Geological Survey Western Ecological Research Center Geography 375 Final Project May 22, 2013. Background. Rapidly growing field of landscape genetics in ecological research
E N D
Python Tool to create genetic Divergence landscapes William Perry U.S. Geological Survey Western Ecological Research Center Geography 375 Final Project May 22, 2013
Background • Rapidly growing field of landscape genetics in ecological research • Promising approach using GIS visualization and analysis of genetic landscapes • Allows users to map patterns of genetic divergence and diversity • Need to automate a series of steps to create these genetic landscapes • Python tool speeds up work and reduces error in complex, repetitive workflows Python Script Script Output
Script Overview Three Main Sections - • Read in species point data, create TIN edges with midpoints, • join back to points to create composite key 2. Read in file with genetic distance data, create composite key, join back to the species midpoints file 3. Create single species genetic surfaces
Input data Species collection points Table with genetic distance values
Python Script • Read in species point feature class. • Create TIN • Edit TIN to add in the species point information. • Create TIN triangle polygons and TIN edges. • Convert feature vertices to points from TIN edges. • Add XY coordinates to the Mid points of TIN edge. • Make Table view to do a spatial join between input points and TIN edge lines • Add field to store genetic distance data • Add fields to store unique composite key to start and end population names. • Read in dbf file containing genetic data. • Create composite key for start and end populations. • Create genetic landscape surface using IDW interpolation. • Clip genetic landscape surface to study area grid. • Create Minimum, Maximum, AllNegative, Allpositive grids using Map Algebra. • Divide the species grid by the Maximum grid to get standardized grid.
Python Script Script Info
Python Script Create variables for tool dialog Set the workspace
Python Script Create scratch geodatabase
Python Script Create TIN, edit TIN, create TIN edges, start, end and mid points Add XY coordinates to TIN midpoint file
Python Script Spatial join from TIN edge start points back to point features Spatial join from TIN edge end points back to point features
Python Script Add fields, create composite key Read in file with genetic distance values Add fields, create composite key
Python Script Write genetic values to species midpoints Create the genetic surface using IDW, clip to study area grid, then clip to TIN polygon tag file
Python Script Create grids needed for final output grid Create final standardized grid and grid with raw values
Obstacles Encountered • Exported python from ModelBuilder for code outline • Numerous changes required to get tools to function in python • Changes in tool syntax between ArcGIS versions (Map Algebra) • Excel files not supported in x64 version of python! • Additional troubleshooting required to run as tool in ArcGIS
Test script for 64 vs 32 bit python to read in Excel files Batch file to run 32 bit version of python
Future Enhancements • Add support for additional input formats (csv) • Finish polishing script and include with toolbox for distribution • Customize script tool behavior using python validation