Thursday, June 14, 2012

Intro to Python - Module 3


Summary of what I learned:

Exercise 3a:

·        While the Shell is good for a lot of things, working on multiple-line code segments is not one of them.

·        One of the big benefits of working in a Text Editor is the global Find/Replace functionality that we have become accustomed to.

·        Notepad ++ can be temperamental.   Whenever I tried to work with it, it would muck up my paths to my S: drive not only from within Notepad ++ but even from Windows Explorer.

Exercise 3b:

·        It is important to recognize places where you will need to use both single and double quotation marks, such as in contractions used in text strings.

·        Embedded variables are an extremely yet simple way to personalize your text strings.

·        Variable naming can lead to a lot of confusion.   You want to make sure to check for proper case sensitivity to ensure that you reference the correct variable.

Exercise 3c:

·        Be sure to take full advantage of the auto-complete functionality that ArcGIS gives you with Python.

·        In addition to auto-complete, Python also offers extensive drag and drop functionality to create code for you.

·        Don’t forget to import your arcpy library !

·        Be mindful of your environment settings.   These are key to finding all the awesome data results you have created !

Assignment 3a:

·        Python has great tools for automating repetitive tasks such as directory creation.

·        Lists are a very useful concept that can help reduce “code-bloat”

Assignment 3b:

·        String literals are very helpful in this assignment.  These really help minimize the time it takes to format your strings

·        You can use a “while” loop to make this code more streamlines

·        Using the data in a LIST format really helps with readability

Challenge Exercise:

·        For this exercise, you can set the parameters using the ArcGIS interface rather than trying to do it from within the Python script.

·         You can then read these parameters as follows:    inYear = gp.GetParameterAsText(0)

This was a fun assignment and challenge exercise.    I am looking forward to what comes next !

No comments:

Post a Comment