Thursday, October 22, 2015

Post 2: Python Scripting

Python Scripting:

Goal: 

The goal of these exercises is to practice creating python script for use in the suitability and risk model for sand mining in Western Wisconsin. By using Python, we will efficiently manage and analyze collected data.

Background:

Python is a basic scripting language that is used to automate computing tasks. Automation makes work faster, easier, and more efficient. Other advantages of Python are that it is easy for beginners to understand, requires little overhead, and is free to use. Although Python is well suited for GIS work, it is useful in many other computer science areas (John A. Dutton E-Education Institute, 2014).

Python Scripts:

Python Scrip 1: 

Figure 1 shows Python script used in the first and third exercises. The script was used to project different data sources into one coordinate system, clip the feature class to the county boundary of Trempealeau County, and load the projected and clipped feature classes into a geodatabase.


Figure 1: A screenshot of the Python script in Pyscriptor.

Python Script 2:

Goal:

The goal for this script was to select frac sand mines suitable for network analysis in our class project, which is focused on creating a suitability model for frac sand mining in Wisconsin. These mines had to fit the following criteria:
  • Must be active 
  • Mine must not have a rail loading station. Mines with a rail loading station will use the rails to transport their sand, not the local roads. We are focused on mining's impact on local roads. 
  • Must be 1.5 km away from any rail roads. Rail road data is not totally up to date, and mines closer than 1.5 km may have had a rail spur built to them within the past few years.
Background: 

In order to use frac sand in hydraulic fracking, the sand has to be transported from the mining site to the user. It it quite typical for mines to use rail roads to transport sand to the user. The only problem is that sand mines are usually in rural locations, and are often not near rail roads. In order to get their sand to the rail roads, mine operators will use trucks. The roads that mines are located on are usually local roads that are not built to withstand heavy loads with heavy traffic.

The suitability model we create will determine the cost of transporting sand on Wisconsin roads. This will enable land planners to make better-informed decisions on where to allow frac sand mines.

Python Script: 

Figure 2: The python script for this exercise used SQL statements to select frac sand mines suitable for network analysis. The SQL statement was based off criteria listed in the Goal section.  

Python Script 3: 

The objective of this script was to multiply a factor in the frac sand mining risk model, built in Exercise 8 (see post 6), by a weight of 1.5. This would weight the most important risk factor, which would influence the overall results of the mining suitability model accordingly.

A short python script was created in order to weight the most important risk factor. All risk factors were set up as variables in the script, the most important factor was multiplied by 1.5, and the result was added with the other risk factor rasters to create a newly weighted risk model. The python script is seen below (Figure 3). 

Figure 3: The python script used raster calculator to multiply the most important mining risk factor by a weight of 1.5. The result was added to the other risk factors to create a newly weighted risk model for frac sand mining in Trempealeau County.

Reference List:

John A. Dutton E-Education Institute. (2014). " What is Python". In "Lesson 1: Introduction to GIS modeling and Python" (Section 1.4.2). Retrieved from: https://www.e-education.psu.edu/geog485/node/104

No comments:

Post a Comment