Monday, May 30, 2016

Module 3 Python Fundamentals Part 2

This weeks module continued with fundamentals of python adding paths, modules, conditional statements, loop structures, obtaining user input and commenting.  These items were used in conjunction with lists, strings, variables, data types and functions from the previous module.  Our task was to debug an existing script, add comments and then create a list of 20 random integers and once printed, count and remove the "unlucky" number.  This task used conditional statements and loop structures along with variables, lists, strings and casting.


Monday, May 23, 2016

Module 2 Python Fundamentals Part 1 - String me along.....

Process Summary Notes:
Part 1, Step 4: Calculate the length of your last name.
This step involves two separate actions that can be combined into one line of code, or can be done on two lines of code. Give a detailed explanation of how you completed this step.
1.       I assigned my full name as StringName and then used the split function to separate it into a list (variable listName).
2.       I created the variable lastNameLen and gave it a value of len(listName[1]).  This calculated the length of the last name item in my list.

I know it is still quite early in the semester, but I am enjoying python coding and finding it to be more simple than I had expected.  I think this is going to be an incredibly valuable skill for both GIS and critical thinking!

Below are my results and my flow chart.



Module 2 Natural Hazard, Lahar Event - answers to burning questions

While learning about Lahars and their impacts was very interesting, the main focal points of Module 2 were the creation of data using the XY tool, exploring the Spatial Analyst Extension, using the Raster Mosaic Tool and preparing datasets for use in a geodatabase.  As I worked through the steps I the lab, I created an outline of the overall process, key metadata information and tools used project, import and/or create the information.  Employed tools were as follows:  XY Tool, ArcToolbox-DataManagement-Project, AcrToolbox-DataManagement-BatchProject, ArcToolbox-DataManagementTools-Raster-RasterDataset-MosaictoNewRaster, SpatialAnalystTools-Hydrology-Fill, SpatialAnalystTools-Hydrology-FlowDirection, SpatialAnalystTools-Hydrology-FlowAccumulation, SpatialAnalystTools-Math-int, SpatialAnalystToos-Conditional-Con, SpatialAnalystTools-Hydrology-StreamtoFeature, Select by Location, ArcToolbox-AnalysisTools-Proximity-Buffer, and Attribute Table Statistics.  Critical to this week’s module was not only logical thinking, but also logical file naming.  Because many tools created data which was in turned used by the next tool it was imperative to establish a naming process that made sense both now and in the future should you need to review or justify your processes.  Integral to this was the creation of a default geodatabase so that data created stored to a default location for this project; this saved time as I did not have to navigate to my project location every time I created a dataset.  I chose to follow the default naming conventions ArcDesktop employed.  Since I was documenting my steps as I went, it was easy to notate the file name and follow the pattern created by ArcDesktop.  This documentation process also helps to solidify my knowledge of what each tool does, where to locate it and what outcome to expect. 



Saturday, May 14, 2016

Module 1, Introducing Python......one more reason to love constrictors....

Ok, so it's not about constrictors, but they're still cool.  Who couldn't love the Pythonwin icon?  What a great addition to my taskbar and of course toolset!
The screenshot shown represents a series of folders and subfolders created instantaneously by running a Python Script.  This is a great time saver and I wish I had known this information last semester when I painstakingly created my class folders manually! 

Our task this week was quite straightforward.  I downloaded the specified .py file from the R: drive and placed it on my S: drive.  After right-clicking and choosing edit, I reviewed the contents of the script and then closed the window.  I ran the script by double-clicking rather than choosing run from within Pythonwin.  Once I saw the words process complete in the interface window I checked my Windows Explorer and noted that the 12 folders and respective sub-folders had been created.  A great tool I will modify and use in the future.  As an extra back-up and because I cannot access eLearning (during my lunch hour) from my office PC, I use my C drive on my laptop to complete my assignments and then copy those to the S: and H: drives.  I liked the ease of the CreateModuleFolders.py script; consequently, I modified it so that it created the same directory and folder structure on my laptop’s C: drive.  This will make uploading to my S and H drives very easy.  Because I often work locally, I downloaded and installed Pythonwin on my laptop.