Module 4 - Exploring and Manipulating Data

 

Data Manipulation Script Code Output

Data Manipulation Script Flowchart

The script I created for this week's laboratory assignment demonstrates an understanding of how one 
 may explore and manipulate data, specifically spatial data in this instance. It involves creating a geodatabase, copying features into it, finding the county seat cities in a feature class using a Search Cursor, and populating/printing a dictionary. I enjoyed learning how to use a variety of new methods to accomplish tasks that are vital in organizing and understanding spatial data. This was certainly a more self-directed laboratory assignment, involving a great amount of problem-solving and backtracking to ensure the code would run smoothly. The Search Cursor syntax had made perfect sense while navigating through the readings and lecture materials. However, when working on the lab assignment, I found that there are many important rules one must follow to ensure the cursor runs correctly and does not lock files or geodatabases. Populating the data retrieved in the search cursor into the created dictionary was also a challenge, but after consulting many online help forums and attending office hours, I better understood how to format the script to allow for this. I certainly took a great amount of knowledge and skills from this lab that I will be able to use in future assignments and work projects. 

The output screenshot above shows the output generated by the various processes completed in the script. Each step of the lab involved  a different output, including my own personal print statements and GetMessage( ) method outputs. It first shows the geodatabase being created, fclist being defined, features being copied with the Search Cursor, and the empty dictionary being created, populated, and printed. My flowchart highlights the various steps I took to achieve success in the code running smoothly and all requirements being satisfied. I unfortunately surpassed the limit of shapes one may add to the flowchart with the specific software I was using, so I did have to group together many items such as the print statements and so forth. Otherwise, I demonstrated how each step of the script was conducted from beginning to end. I would like to emphasize the use of the diamond-symbol for the loops I created, where the arrow symbols would lead back to these loops and would often run until all variables/fields were accounted for. I found that this was the best way in which to showcase the process of loops and how they may continuously iterate until exhausted of items or a break is reached.


I had the most trouble with the final two major steps of the lab, involving creating a cursor to iterate over the fields in the cities class and the step requiring the relevant fields to be uploaded into the created dictionary. Both of these steps were fairly complex and required much trial/error for them to run properly. To resolve the problem with creating the Search Cursor, I learned that it is important to delete the cursor and row after running the cursor, otherwise certain files may lock and not allow you to access them when re-running the code. I also learned to use a for loop so that all instances of relevant fields in the County Seat cities would be accounted for. To resolve not being able to upload the cursor data from the cursor to the dictionary, I resolved this by naming the fields separately and then using the update function to update the dictionary with the relevant key and value. I found this worked best when using a for loop, so that all county seats would be iterated over and the values would be populated accordingly.


This lab assignment taught me the importance of closely following the exercises prior to completing the lab. They ensure a full understanding of the material being covered in the lab and provide crucial advice that would otherwise be more difficult to attain. I had great success in consulting the esri pages for general syntax help, but often had issues with other parts of my code that would be difficult to resolve without reviewing the exercise.


I also became much more comfortable with formatting my output so that it is aesthetically pleasing and easy to follow. The \n character allows for a new line to be created which is essential in breaking up lengthy blocks of code output to increase legibility. I also learned how to use the GetMessageCount ( ) method successfully, by using the (count-1) argument to display the most important information. Otherwise, I printed manual statements on what the code was doing and when it was completed successfully.