Jenningsplanet.files.wordpress.com
Justin Cahoon5-11-2015GEOG 375jrockcahoon@python automation…for a show about nothingProject SummaryFor nine seasons throughout the 90’s, and countless re-runs, I have used the television sitcom Seinfeld to calm the endless chatter in my brain. It has helped me to relax, spark thought, and even guided me through the contemplation of many of life’s seemingly mundane interactions. For a show about “nothing” it is an obsession that I do not take lightly. Just as any other set of geographic data and related tables, a major goal of this project was to prove that even something as trivial as a sitcom could be the basis for a meaningful and applicable academic process that could generate actual usable data. The use of Python in this project was integrated to show that data, regardless of topic, could be managed, maintained, and manipulated through automation-based scripts. Purpose41478202286000The goal of this project was to integrate my appreciation for this television institution with a functional and applicable set of python scripts that would help organize, relate, automate, and map data developed in a self-made geodatabase regarding 180 episodes of Seinfeld. Initially, it was my desire to use Python to help automate the creation of database tables, use scripts to search and update cursors, join tables, and create the map of key episode locations in New York City. Multiple iterations of functionality were tested and it was concluded through this process that three scripts would be focused on; joining tables, pivoting tables, and map creation (including pdf generation). Because the nature of the data and the fact many sitcoms are based on relationships (personal, professional, and locational), a “table join” script was developed to automate the way in which the information could be related and displayed. Because of certain “many-to-many” relationships of seasons, episodes, and characters, a “pivot” script was developed to help “flatten” data and present it in a more understandable way. Lastly, any good GIS project is complemented with an understandable map to help visualize the data. In this case, a mapping script was developed in concert with a previously developed map template for key locations of the sitcom and included code to zoom into certain areas of interest as well as to export the map out in pdf form. GEOPROCESSING TASKSSix data tables and a map, which included five spatial features, were used for the basis of these processes. Data tables included:Episodes;Seasons;Season_Episode_Link;Characters;Relationships; and Key Locations. Python Task 1 – “Add Join”Because of the relational nature of the data, I wanted to work through a script that would automate table joins based on key attributes. This script was developed to join tables with such relationships as episodes-seasons; characters-episodes; locations-episodes; characters-relationships, etc. The scripts I developed for this task were a Locations-Episodes join; a Seasons-Episodes join; and a Characters-Relationships join. Of the three scripts, one of the joins carried over multiple attributes, while the other two scripts only carried over one attribute (joined by a key field). After developing these scripts separately, I combined them all into one large script that joined multiple tables. Python Task 2 – “Pivot Tables”Multiple “many-to-many” relationships were produced when the database was developed. To help counter the large row count of the tables, a “Pivot Tables” script was develop to help flatten some of the data out and make it more presentable and more readable. For instance, when multiple seasons include multiple episodes, a “pivot” can be used to organize the table so that each season shows its unique episodes, instead of an episode list that includes the same season in multiple fields. Though the script worked and pivoted the table to my specifications, it didn’t quite come out the way I would have liked it. Because each field still had a unique ID, the table didn’t really flatten. Using:From:lefttopTo: Python Task 3 – “Mapping Module”Before a script was developed to automate certain mapping processes, a map template was set up of New York City and key locations of important Seinfeld destinations. Based on latitude and longitude data gathered online, the “Display XY Data” was run to generate point locations in ArcGIS. Those were added to a map with a few other shapefiles used for background information and reference. A raster was also made but not used in this map, however a Digital Ortho Quarter-Quads (DOQQ) index file was included for the purposes of referencing certain areas in the map to zoom-in on. The template included a Title, a Subtitle, a North Arrow, a Scale Bar and a Text Box for source information. These could then manipulated in the script by changing the text, altering their position, or including certain elements in the Table of Contents (TOC). Since I wanted to be able to zoom into a specific part of the map, a “Select Layer Attribute” code was added and referenced the DOQQ quad for the area of the map that I wanted selected, then a “zoom to selected features” code was added to focus the map on that location. After that, some code to modify some of the text elements was added so that the editor could change the title, subtitle, source, etc. Lastly, an “Export to PDF” code was included so that map printing could be automated easier. Using: From: To:CHALLENGES/RESOLUTIONSThis project was not without its issues. The first issue was making this type of subject matter applicable. I felt that the geodatabase I created and the spatial data I gathered combined to make this project just as relevant as any other geographically based report. The first, and most common issue I had when dealing with the table joins and pivots, was that every time I would the table open in ArcCatalog, this error would pop up:Line 23ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application.Failed to execute (JoinField).I had to close ArcCatalog every time I wanted to run a script. What this report also does not touch on was the multiple scripts that I ran that didn’t work for various reasons, the most common being indentation issues. For instance, the map script would run just fine but just skip the part where I entered in the “Export to PDF”. This was due to poor indentation. Also, there would be times where I would just try certain commands that I thought were logical, but ended up not being real code. For instance, I wanted to position the Title and the Subtitle in the center of the page. I included this script so that (in a real world scenario), an editor could change the title and the subtitle as they saw fit, which might end up moving depending on the amount of text was added. Since the template for the script had a “text element positonX” included, I thought this had to be used. I even tried to change the numeric “X” position to the text “center” to see if that would work (you never know). It did not. It wasn’t until a little while later, when I noticed that some of the other text elements did not even include an “X” position, that I thought you could just delete this and the position would default to however you set it up in the template. This worked. Also, an earlier iteration of the map template had the legend converted to graphics so as to modify how the legend layout was displayed. This, however, meant that the script would not make any changes to legend if code was included because it was now in a different format. As previously mentioned, I had an issue with table pivots in the sense that I maybe didn’t understand how to go about making them look the way I wanted them to look. I wanted to flatten the table, however the pivoted table had the same amount of rows as before, and then even wider (with a lot of blank fields). I attributed this to the fact that each attribute has its own unique ID, which I thought I had to use to successfully complete the pivot. I am not sure if this is the case, but I never figured out a workaround. This was an independently researched script and was not covered in class but I was hoping to learn something new and make it work. I could not. The mapping script I found most rewarding, because I could the changes and everything finally worked out the way I wanted them to. It was also the script I spent the most time on, so that makes sense.ConclusionBecause this project was about a topic that really solved no real-world problem, I was worried that my process would hit more speedbumps. I felt that the subject matter was the least important part, but rather what you could do with this…or ANY data, to be the cornerstone of successful automated processes with Python. Not only did I learn how to utilize this type of software to manage data, I had a good time doing it because the subject matter held my interest. This type of “data-creation-heavy” project was made easier by the fact that I got to watch a lot of my favorite old episodes of Seinfeld. For a show about “nothing”, there sure is a lot of data to sort through. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post