GIS Programming Module 1 – Python Environments & Flowcharts
Module 1 examines “The Zen of Python” which is a poem by Tim Peters a software engineer. This poem can be seen by typing “import this” into any Python interpreter and describes what it means to write Python code.
“The Zen of Python” is the principals or guidelines on how programmers
should write code. These principles suggest to me that we should write code in
a way that is easy to read and understand, even though the code may be
complicated. I see this as writing code that is modular where the complexity
can be broken down into smaller functions that do a specific task. Complexity
can also be handled by simplifying the code, by finding ways to reduce the
number of lines it takes to accomplish the same task. We should follow these
principles not only for others who might later need to interpret the code, but
for ourselves to help us in debugging and future alterations. It is up to the programmer
to write code that provides the required functionality, but they should make a conscious
effort to maintain readability and reduce complexity wherever possible.
One of the tasks of Module 1 was to create a flowchart of a
program that converts 3 radians to degrees and print the result. The formula
for converting radians to degrees was given as
degrees
= radians*180 / pi.
I first created the pseudocode and then created the flowchart
using draw.io.
The first part of Module 1 was to
create all the folders needed for this course inside the S:\ drive, which is
the student’s files folder on Argo. I
completed the task by logging into ArgoApps Lite and running the Python script
file CreateModFolders.py using the IDLE. The results of running the script
created the main class folder S:\GISProgramming and all the subfolders needed
for all 6 modules. The subfolders Data, Results, and Scripts were created
inside each of the Module folders. The process was straight forward. The only
issue I had was knowing where to copy the CreateModFolders.py script. I realized
after examining the code that it really did not matter where the script was executed
since the path S:\GISProgramming was hard coded in the script.
The second part of Module 1 was
answering the questions in the Process Summary. I utilized the course book “Python
Scripting for ArcGIS Pro” and internet resources to answer questions Q1, Q2,
Q3, and Q5. These resources helped me better understand the similarities and
differences between IDLE and ArcGIS Notebooks. For questions Q4, I utilized Chapter
3 from Agarwal to better understand how to write pseudocode and create a Flowchart
of the code. I downloaded Draw.io to create the flowchart.
Comments
Post a Comment