Thursday, August 7, 2014

GIS 5103 Module 11: Sharing Tools



The eleventh and final module of the course taught us the correct procedure to create easier to share tools.  The ability to share script tools with others is one of their key benefits, yet it is important to provide necessary documentation as well as the correct file structure to ensure it will run properly.

For our assignment, we were provided with a script, script tool and toolbox.  While the script tool parameters were preset, we were required to edit the script itself to accept user inputs for two of the parameters.  Because we were also instructed to rename the provided files, the script tool properties needed to be updated in order to locate the script.  We also needed to edit the script tool's item description for each parameter in ArcCatalog.  This significantly improves the user interface for those not familiar with the tool, as the description we entered would be displayed in the help window of the script tool's dialog box.

Finally, we embedded the script into the tool and set up a password.  This allows the tool to be shared more easily by dispensing with the need for the stand-alone script.  It also increases security on the tool by preventing unauthorized users from altering the script.

GIS 5103 Participation Post #2: Viewshed Analysis in Archaeological Modeling





In their 2014 article "A house with a view? Multi-modal inference, visibility fields, and point process analysis of a Bronze Age settlement on Leskernick Hill (Cornwall, UK)" (2014, Journal of Archaeological Science 43, 267-277), Stuart Eve and Enrico Crema describe their efforts to model Bronze Age sites using different sets of variables and critique the way in which some researchers approach statistical modelling.  Modelling, as the authors use the term, involves performing spatial analyses on variables that potentially affected site placement; a successful model would reveal correlations between variable values and site placement.  For example, a model might propose that sites are more likely to be located at certain elevations or in areas of a certain level of precipitation.  Environmental variables such as elevation, slope, aspect, land cover, rainfall, and distance to permanent water sources are all common variables to consider when constructing a model for analysis.  Eve and Crema emphasize that no model is "true"; there are only more or less successful models.  Even a successful model, showing strong statistical correlation between variables and site placement, is not guaranteed to be closer to true than other models.  A wide range of variables and different levels of analyses must be considered.

Eve and Crema investigate three proposed models for the location of sites on Leskernick Hill.  The two models unique to their study involve line of sight analyses.  The first model proposed the placement of sites to maintain line of sight with ritual sites in the area while the second proposed a line of sight preference for tin deposits.  The third model looked at the more standard topographic and environmental variables.  The line of sight analyses were created by calculating the viewshed of every raster cell coinciding with Leskernick Hill using GRASS GIS and Python for batch processing.


The results indicate the need to consider difference scales of analyses.  While the first model (line of sight with ritual sites) was the best match overall, sites in the western portion of the study area fit the second model (line of sight to tin resource) much better.  Removing these western sites also showed the southern sites fit the first model even better.  The topographic inputs of the third model did not fit site location very well.

Link to article (hopefully one that works this time):

Wednesday, August 6, 2014

GIS 5265 Module 10: Final Project









For our final project of the course, we were to either choose an independent project or work with the Oaxaca Valley data from module 6 for further catchment analyses.  As I could not find a suitable topic (or at least one for which data were readily available), I went with the Oaxaca Valley data.  Looking through the data provided for the northern portion of the valley (grid rows N11 through N14), there appeared to be oscillations in population density from the south to the north and back again through the time periods.  My project was to calculate maize consumption estimates based on population and compare this with estimated maize yields based on 1 km catchments.  

To create the Thiessen polygons as described in the module video for catchment analysis, I set up a model in ModelBuilder to create the final 1 km catchment buffer using the Buffer, Feature to Point, Thiessen Polygons, and Intersect tools.  I also used the model to create additional buffers of 2 km and 5 km, although I did not end up making use of them for this project.

The population data for my collection units for each period was acquired by joining the Excel sheets provided in our module 6 data.  Using the high and low consumption estimates provided in our readings (.16 metric tons and .29 metric tons respectively), I added four fields to the attribute tables for each period and used the Field Calculator to compute consumption estimates for each collection unit.

Arriving at maize yield estimates for the 1 km catchments was also a multi-step process.  The Identity tool was used to create shapefiles for each land type corresponding to the catchment areas.  A new field as added to calculate the area in hectares (since the estimates used in our readings are based on hectares).  Based upon data provided by Anne Kirkby (1973, The use of land and water resources in the past and present Valley of Oaxaca, Mexico, University of Michigan Museum of Anthropology Memoir 5), the yields of maize through time were multiplied by the area of each land type (again using the Field Calculator) to arrive at potential yields.

Microsoft Excel's Data Analysis correlation tool was used to determine if there was a correlation between population consumption estimates and maize yield estimates.  Unfortunately, no such correlation was seen.  The resulting data does show an oscillation of population from south to north and back, but significant variables remain unknown.  We do not know the fallowing strategy that was applied, nor do we know the potential degradation in catchment yields as the population grew and cultivation was intensified.  We also do not know the details of rainfall variation.  The majority of the study area (excepting one grid square) is considered to feature low average rainfall (below 700 mm), and the potential yields of the land types in the region (Type II and Type III) are highly susceptible to precipitation variation.  While this is suggestive as a potential cause for population movement through time, the lack of more detailed rainfall data prevents me from offering more than a mere suggestion.

Friday, August 1, 2014

GIS 5103 Module 10: Creating Custom Tools

Script tool messages after replacing print with arcpy.AddMessage().


Dialog box of script tool parameters.


While Python scripting for ArcMap allows one much more freedom to create functions not otherwise available, using and editing Python script requires a degree of knowledge and experience.  Fortunately, it is possible to import a stand-alone Python script into a toolbox as a script tool that is more easily shared with and used by others, regardless of their knowledge of Python.  Our exercise and assignment this week taught us to create and edit such script tools.

Although creating a script tool is a relatively simple matter, it does require a few steps to ensure the tool works properly without further editing the script itself.  After importing the script as a script tool into a toolbox, one must set up the properties and parameters of the tool.  The parameters include all the variables for the tool (inputs, outputs, etc.) as well as their data types.  This sets up the dialog box within the ArcMap GUI, but the Python code itself must be edited to accord with these parameters to allow users to successful enter variables into the tool.  This is accomplished by using the GetParameter or GetParameterAsText functions.  These are numbered in parentheses in the order they appear in the dialog box, starting with zero.  This will allow the script tool to function with custom inputs from the user.  The only remaining task is to use the AddMessage function rather than print to display the tool's messages in the results window.