Module 1 GIS Programming: Python Environments and Flowcharts
Hello all, the first week of the Summer 2023 GIS Programming course (GIS4102/5103) at UWF was an introduction to basic Python, including its environments and some syntax, as well as the logic, principles, and design of flowcharts. Since I've had no prior coding experience, the first week was very daunting. However, taking my time to do some extra practice outside of the exercises and readings really helped quell those fears and prepare me for the work. I cannot recommend the www.w3schools.com/python/ tutorial enough for beginners to understand Python. It is interactive, explanatory, and has exercises built in. I would also like to make note of the Agarwal et. Al. (2010) reading for a good introduction to flowcharts, which helped me to create mine.
Module 1 introduced us to Python environments with a main focus on IDLE and ArcGIS Notebooks (integrated Jupyter Notebooks in ArcGIS). IDLE and ArcGIS are the same in that they both use Python and have similar syntax. They also both highlight different parts of syntax but I think Notebooks has much more intuitive and visually pleasing coloration. The main difference between the two is that ArcGIS Notebooks has code written in cells, while IDLE has a traditional 'page' to write the code in. Additionally, Notebooks is a program fully integrated into ArcGIS while IDLE is more of an independent environment for testing Python code.
The main focus of the assignment was to create a flowchart for converting 3 radians to degrees using the formula "degrees = radians*180/pi." The flowchart (which can be seen below) was quite easy to make, but writing the pseudocode (typed below) and testing out the code in Python helped to understand the logic and steps.
Start
import math
radnum
= 3
degrees = radnum * 180/math.pi
print degrees
End
The Zen of Python was an interesting "easter egg" hidden within Python by typing "import this". I think at its core, the Zen of Python is expressing some advice for writing good code. Code that other programmers can easily read and understand is good. A common theme is also the idea of simplicity being important when writing code. Overly complex code can lead to errors that may be hard to find or simply code that is hard for others to work with. The lines of the Zen of Python seem like guidelines that can be used to improve code, not necessarily strict but highly recommended.
Comments
Post a Comment