Friday, March 18, 2016

Python Scripting Two: Batch Processing

   As mentioned in the last blog, Python scripting for ArcGis can be used to automate tedious and repetitive tasks. In the below example (figure one) a “for loop” was used to name, locate, project, extract (the vector equivalent of this tool would be “clip”) and copy to a different geodatabase.
Figure one. Python coding used to batch process a raster dataset. 

 While creating this code I experienced several setbacks and many error messages, most of which were due to my own inexperience with coding. The data set I was working with only totaled three raster files meaning that it would have been much faster for me to have run each raster individually.  But it is the principle of the matter which is important and making a batch data processing code is immensely important for a dataset that totals many more files than the one used for this exercise.

Results:

Figure two. Elevation data raster for Trempealeau County WI. 
Figure three. Land use in Trempealeau County (too many specific types of land use to fit in legend, see figure four for simplified labels). 
Figure four. Generalized land use map for Trempealeau County.


No comments:

Post a Comment