Friday, May 29, 2015

GISProgramming: Module 2 - Python Fundamentals Part 1

     This week we looked at the basic building blocks of Python. Specifically, we combined variables, strings, functions, and methods to write simple code. The script, if successful, prints a given last name and the result of the number of letters in a last name times three (expressed as an integer).
     I think my first instinct was to panic about writing code on my own, albeit simple code. I then remembered what we learned the previous week regarding a logical way to tackle programming. That is, defining the information given , sorting out the goals of the program, and thinking about what tasks will help in achieving the aims of the program. Also, I realized that this program wasn't so bad. In fact, as I looked over what needed to be done the wheels in my head were already turning with how to go about writing this program.
     This may not be efficient in the future but I wrote pseudocode on paper first. I then tried out portions of the code to test them in the Python window of ArcMap. Once I felt like I had it down I composed the final script in PythonWin. You can see a screen shot below showing the result of my script.

This is a screenshot of the result of the program composed for this exercise.
The program prints my last name and the integer value of the number of characters in my last name times three. 
     This was a simple program to write but it is exciting to write code and have it work. I do not mind these ego boosting baby steps. I cannot wait to feel the sense of accomplishment that will come with having finished an entire semester of programming.

Friday, May 22, 2015

GIS Programming: Module 1 - Introducing Python

Start
     Welcome back to my blog. For the next few months I will be detailing my experience with        learning Python for use in GIS. As an introduction to Python we practiced running a preexisting Python script in lab. The program set up the folders and subfolders we will need throughout the course. I included a screenshot below showing the result of running the provided program.
     The lab also had us look at 'The Zen of Python' by Tim Peters. It is accessed by typing 'import this' into a Python window as a command prompt. It is a list/poem of the guiding principles of Python as proposed by the BDFL (Benevolent Dictator For Life), Guido van Rossum.

This is a screen shot displaying the result of the Python script run to
generate folders (and subfolders) for the modules in this course. 
     Our readings focused on introductory information about Python, like it being open source software and the various ways to work with Python (different graphic user interfaces or through command line). For our course we will be focusing on PythonWin (an editor for Windows) and the Python window in ArcGIS. Other readings focused on adopting a problem solving mindset through identifying important variables, determining objectives and goals based on those variables, and creating a list of tasks (implemented to meet goals/objectives).  
End