Sunday, May 31, 2015

GIS Programming - Participation Assignment 1

The purpose of this assignment is to find and summarize an article about a real-world application of GIS, programming, or Python.

The article I read (title and link below) discusses the use of a Python script to correct distortion errors in hyperspectral imagery collected by aircraft.

Jensen, R.R., Jackson, M.W. and Lulla, V., 2008: “Single line correction method to remove aircraft roll errors in hyperspectral imagery.” Journal of Applied Remote Sensing 2, pp.1-10.

I found this article to be very interesting and pertinent because it ties together our Remote Sensing course (which I took last fall semester) with the use of Python programming.  The problem being addressed here with a Python algorithm is fairly simple.  Because planes collecting aerial imagery are subject to pitch, roll and yaw as they follow their paths, any data collected for more than just a single instantaneous frame is prone to distortion.  Hyperspectral data is collected in what is referred to as the “push-broom” method:  the sensor instantaneously collects a single continuous strip of data at a time, to each side of the plane, perpendicular to the flight path.  Any amount of roll by the plane will change the relative view angles along the data strips, and cause distortion in the resultant image.
The usual way to correct this distortion is called the reference line method: the wavy, distorted image of a feature known to be linear on the ground (like a straight road) is digitized. The program then calculates and implements the offsets needed in each row of pixels to make that feature appear straight on the image. This process, though simple in theory, is very meticulous, as it has to look at every single row of pixels in the image.  That makes it an excellent candidate for automation by Python scripting.
The correction was accomplished by exporting the coordinates of each pixel in the wavy reference line into an ASCII file.  The inputs for the Python program that will correct the distortion are:

the uncorrected/distorted imagery file, and
the ASCII file containing the pixel coordinates of the reference line.

The variables used by the program are also very simple:

the range of column values for the pixels reference line, and
the average column value for the entire reference line.

The Python script then just offsets each row by the difference between the column value and the average.  The effect of this is to straighten out the image of the linear feature, so it appears straight on the corrected image.  The positions of the rest of the features in the image are corrected along with it.

Here is a graphic explanation of how pixel rows are offset using a simple Python script to correct the wavy distortion caused by aircraft roll.
Example of Distortion Correction from Jensen, et al. (2008)

Friday, May 29, 2015

GIS Programming - Module 2 - Python Fundamentals Part 1

As we learn more about Python scripting this week, we used functions and methods, which are types of instructions for the program.  We wrote a script in which the input was a string, consisting of our full names.  The final output was our last name, and the number of letters in that name time 3.  My results are shown below:
The last name, Sease, and 15, which is 3 times the number of letters of my last name.

Results of the Python Script

Wednesday, May 20, 2015

GIS Programming - Module 1 - Introducing Python

In the first week of GIS Programming, we were introduced to the concept of pseudocoding to help us learn how we'll be constructing Python scripts later on.  This is a step-by-step script that is more-or-less like English, that puts together the Input, the desired Output, and a list of the tasks necessary to get from the Input to Output.  We also examined the interactive window of Python, in which script can be run a line at a time, the Pythonwin script editor, in which multiple lines of script can be compiled, saved, then run.  A Python interactive window is also accessible through ArcMap, by clicking the Python Window button on the standard toolbar.  This environment is convenient, because when you start typing, it gives suggestion prompts for possible statements from which you can select. Also, there is help and syntax information in this window for whatever statement you select .

Saturday, May 16, 2015

2015 GIS Programming - First Post

This is the initial post for GIS Programming, Summer, 2015

(The blog posts for the partially-completed programming course from summer 2014 are labeled 2014 (old) Programming.)