Wednesday, May 29, 2024

Python Fundamentals - GIS Programming Module 2

 Hello everyone!

In this week's lab, we explored some of the basic fundamentals of Python to help prepare us for what is coming ahead in this course. At the end of the assignment, we were expected to know how to run Python scripts using Notebook in ArcGIS Pro. While using Notebook we needed to work with string variables, so in the lab, we had to identify our full name with a string variable and the string looked like this: stringName = 'Tyler Scott Weber'. The next learning outcome we were supposed to achieve was to use and import modules, this was very important for the overall final result of the lab. The one module we had to import was the random module, so at the beginning of the line of code for our random number generator, the first thing that needed to be done was to type import random. We needed to learn how to save Python code as a script for the next objective. This can be done by simply exporting the code from Notebook and then saving the script as a .py file. For the next object, we needed to know how to include comments in the scripts, this is done by using a # for each line that the comment is located on. The comments are important for users because they can give context to what the code is trying to portray. The last two learning outcomes are being able to create loops and conditional statements and then iterate variables within loops to control script workflow. 

These outcomes were key to learning to finalize the lab submission. But to give you an idea of what the lab assignment entailed; we were tasked with printing our last name from a created list and then using indexing to print our last name from another list containing our full name. The next step gave us a bit of pre-written code for a dice game that had two errors, the first error was fixing the code to print the random number that the dice showed. The issue with it is that we couldn't use a str() because the code is part of a module. The next issue that was wrong with the text was that an x was capitalized when it needed to be lowercase. For the 2nd half of the lab, we needed to create a random number generator, the lecture exercises were key to the success of this part of the lab. Some notes I took included examples of a different formatted random number generator and different ways we can display a limited range of the number generator. I had to explore the range aspect because we need to display 20 random numbers between or equal to 0 and 10.  Here is a flowchart of the code I wrote to give you an idea of how the script is read:



Without further ado, here is the result of my script from the overall assignment:


This week's lab was a great wake-up call on what to expect moving forward, and I am excited to see what will come next.

Thanks for reading!






Monday, May 20, 2024

New Semester, New Class, Welcome to the GIS Programming Blog Series - Module 1

 Hello fellow GIS enthusiasts!

Welcome to this semester's edition of the GIS blog series. I am back at it here at UWF continuing my education by taking this GIS Programming class. Python has always been something I've wanted to tackle to further my career, but I haven't had a real opportunity until this class. So I am looking forward to what this class has to offer. 

In this week's module, we learned how to run a script using IDLE, which stands for "Integrated Development and Learning Environment. IDLE is a built-in development environment used for writing, running, and debugging code written in Python. The next learning outcome we were expected to learn was interacting with Python (Jupyter) ArcGIS Notebooks. This is ArcGIS Pro's integrated Python application, and it is a more modern and innovative way of coding. The last outcome we were expected to learn about is how to think algorithmically with flowcharts. This involved us creating a flow chart design depicting the solving of this formula: degrees = radians*180/pi. To make the flow chart, we needed to understand what symbols to use to depict the processes to solve the formula. So the first symbol I used is an ellipse-like shape, and it is called the terminal symbol. This symbol indicates the beginning or end of a flowchart. The next couple of symbols I used was a rectangle symbol, this symbol depicts a step in a process. After I identified the process, the next symbol I used was a parallelogram. This symbol is the input/output symbol that indicates the process of inputting or outputting external data. To end the flowchart, I used another ellipse symbol. Here is how it turned out:


You may notice that the formula looks a little bit different compared to the formula I mentioned above. This is because I wanted to integrate into this flow chart as if someone would actually be coding this in Python. The reason I did this is because I wanted to try out the formula on IDLE and was having errors with pi not being a defined value. Knowing how pi is a long list of infinite numbers, I wanted to ensure it would be an accurate calculation. So I researched how to import math functions into Python, which can be done by doing import math, and then integrated it into my flow chart process. Then when it came to writing out what degrees equal, instead of just pi, I typed out math.pi to ensure that it would be calculated accurately. That is how I got to the depiction of my flowchart that you see above.

The last thing we needed to explore was a poem called "The Zen of Python", and in case you have not read it before, you can access it via you're IDLE program by typing import this or you can be uncool and find it here at this link: The Zen of Python

I see this poem as a beautiful piece on the art of coding with Python, specifically coding correctly. It talks about how one method is better than the other, confirming my belief in coding correctly. It also seems to talk about the ethics of coding, specifically making sure to follow the rules of coding and paying attention to detail to ensure errors aren’t missed. I also believe it encourages the future development of coding and emphasizes not to rush a final product. I think this poem is definitely a piece I can look at to model how to be successful in this class, and successful in utilizing Python in my career.

That is all for this week, thanks for reading!


Final Project and other maps created

 After eight weeks this class has come to its conclusion. Our last task was to come up with a project idea that is geographic and meaningful...