Thursday, November 12, 2015

Python Scripts

Script 1:

For the first python script that we ran we where tasked to design a script to clip our Trempealeau county Wisconsin area with three different raster models. The script that we where to design was made by importing arcpy and all environments into PyScripter for Python 3.2. After the environments where in we then needed to establish a list of all the three TIF raster's that we where using. Once we have produced a list of raster's we then needed to create a for loop for the raster's so all three of the raster's we had downloaded , including the DEM from USGS, the NLCD, and the NASS, it was these three raster's that we wanted to run through our clip. By creating this for loop we then could write a code for the raster's to run through a projection getting all of them to be projected into the same coordinate system which was NAD 1983 HARN Wis Trempealeau county. By projecting all three raster's in this projection it allows for minimal distortion and can display all mines in the appropriate location. Once they where in the proper projection we then could run a clip for the raster to only give us a print out of the county we were interested in, last we then extracted the new clipped map to our geo-database and could use the new maps to display our mining areas. The full script that was created is in figure 1.1.

Figure 1.1: Python script for exercise five, script is a representation of how to use a list and for loop to run a clip function on Trempealeau county Wisconsin

Python Script II (selecting active mines for analysis):

The second python script we where tasked to design was a script for selecting and narrowing our total mines in Wisconsin. The script was aimed to select out all mines that where a)active mines (currently in use), b) where all mines that where completely a mine ( not a processing plant or loading station), and c) all mines that where not adjacent to a rail line. Last we needed to write a code that excluded all of the mines that could be found within one and a half kilometers of a rail line. By querying out these three selection we where able to make a complete feature class that would later be used in our data analysis for calculating the total impact on the county road systems that the truckers from the mine to the rail station where causing.
Figure 1.1: displays the python script used to query out all mines needed in exercise 7






No comments:

Post a Comment