Pages

Monday, March 13, 2017

Python Scripts

Python Script for Exercise 8
#-------------------------------------------------------------------------------
# Name:        Ex 8 - Part Two
# Purpose:     Calculates
#
# Author:      Zach Miller
#
# Created:     05/15/2017
# Copyright:   (c) millerzm 2017
#-------------------------------------------------------------------------------

#import spatial settings
import arcpy
from arcpy import env
from arcpy.sa import*
arcpy.CheckOutExtension("spatial")

#set workspace
arcpy.env.workspace = "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\ex8\Exercise_8.gdb"
arcpy.env.overwriteOutput = True
print "{}".format(env.workspace)

#Set up variables
streams = arcpy.Raster("dist2river_reclass")
farms = arcpy.Raster("dist2farms_reclass")
schools = arcpy.Raster("dist2schools_reclassify")
people = arcpy.Raster("dist2people_reclass")
wildlife = arcpy.Raster("dist2WLA_reclassify")

#Calculating the most important variable
outweight = (schools*1.5)

#Overlaying rasters with weighted variable
weighted = (outweight + streams + farms + people + wildlife)
weighted.save("weighted_result")


print "The script is complete"

Python Script for Exercise 7

#-------------------------------------------------------------------------------
# Name:        Ex 7 - part 1
# Purpose: To perform a network analysis on frac sand transportation
#
# Author:      millerzm
#
# Created:     10/04/2017
#-------------------------------------------------------------------------------

#import system modules and set up workspace
import arcpy
from arcpy import env
arcpy.env.overwriteOutput=True
arcpy.env.workspace = "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex7\ex7.gdb"

#set up variables
all = "all_mines"
active = "active_mines"
status = "status_mines"
railess = "mines_norail"
wi ="wi"
wtm = "rails_wtm"
final = "mines_norail_final"

#Add field delimiters for the SQL statements
field1 = arcpy.AddFieldDelimiters(all, "Site_Statu")
field2 = arcpy.AddFieldDelimiters(all, "Facility_T")

#SQL statements to select active mines, have mine facility type, and do not have rail
activeSQL = field1 + "=" + "'Active'"
statusSQL = field2 + "LIKE" + "'%Mine%'"
norailSQL = "NOT" + field2 + "LIKE" + "'%Rail%'"

#create feature layer from SQL statement
arcpy.MakeFeatureLayer_management(all, "active_mines", activeSQL)
arcpy.MakeFeatureLayer_management(active, "status_mines", statusSQL)
arcpy.MakeFeatureLayer_management(status, "mines_norail", norailSQL)

#select all mines from mines_norail layer within wi layer
arcpy.SelectLayerByLocation_management(railess, "INTERSECT", wi)

#remove all mines within 1.5 km of rails within mines_norail_final layer
arcpy.SelectLayerByLocation_management(railess, "WITHIN_A_DISTANCE", wtm, "1.5 KILOMETERS", "REMOVE_FROM_SELECTION")

#save selected features
arcpy.CopyFeatures_management(railess, final)


print "The script is complete"

Discussion

This script works by first bringing in the neccessary system modules and setting up the workspace so python knows where to grab the data from and where to put the outputs once tools in the script have been ran. Nest, variables were assigned to be defined throughout the script. *** To my pleasure, the script worked the first time and I ran into no real issues with it. The script selected 44 mines to be used for the network analysis.

Python Script for Exercise 5


#-------------------------------------------------------------------------------
# Name:        Ex 5
# Purpose:      Project, clip, and load data into geodatabase
#
# Author:      Zach Miller
#
# Created:     08/03/2017
# Copyright:   (c) millerzm 2017
# Licence:     <your licence>
#-------------------------------------------------------------------------------

#import spatial settings
import arcpy
from arcpy import env
from arcpy.sa import*
arcpy.CheckOutExtension("spatial")

#set workspace
arcpy.env.workspace = "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\Work"
arcpy.env.overwriteOutput = True
print "{}".format(env.workspace)

#get a list of rasters
ListOfRasters = arcpy.ListRasters()
print "{}".format(ListOfRasters)

#loop through the rasters
for raster in ListOfRasters:
    #define the outputs
    rasterOut = "{}_Out.tif".format(raster)
    rasterExtract = "{}_Extract.tif".format(raster)

    #project the rasters
    arcpy.ProjectRaster_management(raster, rasterOut, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\TrempWebDATA.gdb\Boundaries\County_Boundary")

    #Extract the raster and copy the raster into the geodatabase
    outExtractByMask = ExtractByMask(rasterOut, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\TrempWebDATA.gdb\Boundaries\County_Boundary")
    outExtractByMask.save(rasterExtract)
    arcpy.RasterToGeodatabase_conversion(rasterExtract, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\Work")
    print "Raster to Geodatabase conversion {} successful".format(rasterExtract)


print "Script is complete"

Exercise 5: Data Downloading, Interoperability, and Working With Projections in Python

Introduction

The goal of this assignment was to become familiar with downloading data from a multitude of internet sources, importing the data into ArcGIS applications, and automating the projection of the data using python. This data collection and preparation will be used in a latter assignment which will focus on frac sand mining in Trempealeau County.

Methods

In order to ensure an organized and concise method of downloading data from multiple sources, a temporary folder was created in which all of the .zip files downloaded would be stored until unzipped into the assignment's working folder. The data for the digital elevation model (DEM) and the land cover came from the USGS National Map. The data for the cropland map was found in the USDA Geospatial Gateway. The data for the soil survey was obtained from the USDA NRCS Soil Survey. Lastly, the Trempealeau County database was derived from the Trempealeau County Land Records Department.

Once the data was downloaded and unzipped into the working folder, python scripter was used to automate projecting the shapefiles and rasters into the same projection (NAD 83 Trempealeau County US Feet) and any shapefiles or rasters that were not just the county already were clipped.

 #-------------------------------------------------------------------------------
# Name:        Ex 5
# Purpose:      Project, clip, and load data into geodatabase
#
# Author:      Zach Miller
#
# Created:     08/03/2017
#
#-------------------------------------------------------------------------------

#import spatial settings
import arcpy
from arcpy import env
from arcpy.sa import*
arcpy.CheckOutExtension("spatial")

#set workspace
arcpy.env.workspace = "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\Work"
arcpy.env.overwriteOutput = True
print "{}".format(env.workspace)

#get a list of rasters
listOfRasters = arcpy.ListRasters()
print "{}".format(listOfRasters)

#loop through the rasters
for raster in listOfRasters:
    #define the outputs
    rasterOut = "{}_Out.tif".format(raster)
    rasterExtract = "{}_Extract.tif".format(raster)

    #project the rasters
    arcpy.ProjectRaster_management(raster, rasterOut, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\TrempWebDATA.gdb\Boundaries\County_Boundary")

    #Extract the raster and copy the raster into the geodatabase
    outExtractByMask = ExtractByMask(rasterOut, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\TrempWebDATA.gdb\Boundaries\County_Boundary")
    outExtractByMask.save(rasterExtract)
    arcpy.RasterToGeodatabase_conversion(rasterExtract, "Q:\StudentCoursework\CHupy\GEOG.337.001.2175\MILLERZM\Ex5\Work")
    print "Raster to Geodatabase conversion {} successful".format(rasterExtract)

print "Script is complete"

Next, the accuracy of the data was determined by looking at the metadata of the downloaded datasets.


Lastly, three maps were made to show the landcover, cropland, and DEM of Trempealeau County.

Results




Conclusions

After making the maps and reviewing the accuracy of the data, it is clear that there is quite a bit of information missing. In the instance of this assignment, the sources used to collect the data are fairly reputable and credible. Time-wise the lack of temporal information might be critical in some situations but for the context of this assignment, again, it's not. As far as the usability of these maps, the landcover is relatively useful. For the croplands map, there is an overwhelming amount of classified values and would require a much smaller scale to really be effective.

Wednesday, March 1, 2017

Sand Mining in Western Wisconsin Overview


Introduction

Frac sand mining is the process of extracting well-rounded quartz sand from sandstone of a very particular size (425 to 212 microns). This process starts by site location; finding where these deposits exist and if they're economically viable. In order to be deemed economically viable and profitable, a deposit must have no more than 50 feet of overburden (the amount of ground to be removed in order to access the deposit) for a particular deposit and relatively easy access to water. Once the sand is extracted, it undergoes washing, sorting, drying, and is then shipped to a hydraulic oil fracking site to be used in that process.

Where in Wisconsin?

Due to the geologic history of western Wisconsin, much of the country’s frac sand is mined in Wisconsin, but there are also deposits in Minnesota, Michigan, Missouri, and in the eastern United States.
Figure 1. Quartz sandstone formations and frac sand sites in Wisconsin


Environmental and Public Health Concerns

With the excavation and processing methods associated with mining for frac sand (or really any type of mining) comes potential health risks to the workers, citizens in the area, and the environment. One of the major issues associated with frac sand mining is air pollutants, more specifically: silica. Because frac sand is comprised of almost pure quartz (SiO2), drilling, processing, and transporting the sand creates silica dust. These silica particles are then dispersed in the air and can then be inhaled by workers, nearby citizens, and nearby wildlife. This prolonged exposure to silica particles in the air can lead to silicosis.

Another issue concerned with frac sand mining is groundwater depletion and/or contamination. Due to the processing involved with frac sand mining, the operation requires a significant amount of water to wash the sand. Depending on the size, duration, and location of the operation, groundwater wells could be used and therefore, might deplete the wells used, if not contribute to lowering of the water table. This water is also sometimes mixed with chemicals for the purpose of sanitizing or further washing the sand. When the company is done with the washing/sanitizing process, the mixture is dumped and could seep into the ground water. This contamination could affect wildlife, citizens who use water from the same aquifer, and streams that are fed by that aquifer.

GIS and Frac Sand Mining

Using a geographic information system could be extremely beneficial when it comes to mining frac sand in terms of managing deposit data, modeling mine sites and geological deposits, and modeling potential environmental and public health hazards associated with this industry.

Sources

http://www.fracsandinsider.com/mmi_ConferenceDL/2013FSI/FSIThurAlan%20Bennetts%20(2).pdf

https://iisc.uiowa.edu/sites/iisc.uiowa.edu/files/project/files/assessment_of_site_suitability_for_frac_sand_mining_in_winneshiek_county_final_report.pdf

http://wcwrpc.org/frac-sand-factsheet.pdf

http://geology.com/minerals/quartz.shtml

http://www.lung.org/lung-health-and-diseases/lung-disease-lookup/silicosis/silicosis-symptoms-causes-risk.html?referrer=https://www.google.com/

HalfmoonSeminar-Exploring%20Impacts.pdf