Tuesday, May 28, 2024

M2 Programming Fundamentals

 Greetings,

For, while, if, else, are among some of the most fundamental of operators within Python. Fundamentals are the name for this week. Looking at types of objects in this object-oriented language, and applying methods, arguments, and parameters to loops, conditional statements, and iterable variables. 

In one four-part script I have dissected my name, fixed and played a random number generation game, filled a list with random numbers and then extracted a chosen number from it. This is all executed by beginning to understand how the methods, functions, and variables interact within Python. 

Modules, variables, then code blocks, within them, methods or functions deal out commands with which the language operates. While loops and for loops, work to iterate over a block of code, affecting a variable in particular ways. Methods work to augment an object through prescribed parameters, whereas functions are executed against the variable object input as the parameter. 

Ultimately, through this week I saw that because I am unpracticed it can be significantly time consuming to get a block of code to function as intended. A mere typo, miscapitilization, forgotten quotation or parenthesis can all cause the code not to work. While loops were particularly challenging, especially when working with if / else and break statements. These provide condition trees or stopping points for iterative code, that if executed wrong, could execute indefinitely. 

Below is a simple output, but it is one running of the 4 section script that was created this week. 


I could potentially try to add more break lines in the output to show the more clear delineation between results. But suffice it to say, you see my name at the top, stripped from my full name. Then you see the game of chance played by 8 players. From there the script generates 20 random integers between 0 - 10, populating a list. And from that list, lucky number 7's are stripped out and the new list provided. 

The most satisfying part came from putting all 4 separate pieces together in one script and hitting run. And all of the outputs generate without issue! Sooo satisfying! 


v/r

Brandon

Saturday, May 18, 2024

M1 Intro to GIS Programming

L et us begin the whirlwind Summer tour of Python Coding with GIS Programming. The next two months will look at the integration of Python functions within GIS. This first week served as an introduction to the environment of Python and basic task flows that can be presented through standardized flow chart symbols. 

Lets look at a couple key terms before we continue. 

IDE = Integrated Development Environment

IDLE = Integrated Development and Learning Environment

Jupyter Notebook = another IDE

ArcGIS Notebook = derived from Jupyter for specific use within ArcGIS applications


Now, one key concept to ensure we get across is that Python is an interpreted language. This means that it has an associated translator which reads your input line by line and executes what the code is telling it in the same manner. The opposite is a compiled language which compiles the given syntax and converts it to a machine code which is then executed. Python, as an interpreted language, is by design easier, albeit slower to process, as it is linear, easier to debug if there are mistakes present, and is simplistic in execution as it either will or wont work. 

Python has default IDE's provided along side its installation, such as IDLE. But it also has numerous other graphic user interfaces (GUI) which can be used. Additionally, there are other interfaces which gain specific functionality such as the ArcGIS Notebook, which is a derivative of Jupyter Notebooks built specifically for use within ArcGIS Pro. We will predominately be using this throughout this course. 

Another key concept that we looked at this week is that of graphically representing an algorithmic process through a flow chart. The flow diagram below is fairly simple, it involves 3 different inputs and a specific deliverable. 

In its case we want to convert 3 radians of a circle into degrees. As such we can look at this concept in pseudocode, which is a word based representation of instructions which we could translate into python. Or we can pictographically look at it as has been done below. 





Overall, this week has been concept heavy with simple outputs. Next we will be looking into understanding the specific breakdowns of python code in what make our scripts work. Thank you. 

v/r

Brandon


Special Topics - Mod 3 - Lab 6 - Aggregation and Scale

 Hello and Welcome back!  My how time has flown. It has almost been 8 weeks, and 6 different labs. There have been so many topics covered in...