I have started working on my first real Python programming project. This goes way beyond writing a simple GIS related script. Here is the background.
If you happen to work in geotechnical engineering, you might be familiar with a ghastly piece of software called gINT, GEOTECHNICAL AND GEOENVIRONMENTAL SOFTWARE. gINT is a very powerful package for storing, analysing, and displaying geotechnical data. But I personally don’t enjoy working with it, although I have put in many 100s of hours doing so. What I like least about gINT is the non-intuitive GUI that doesn’t seem to have much in common with any standard Windows program. So what I would like is an alternate way of getting my geotechnical data (e.g. lab data, borehole data) into gINT.
Essentially, entering data in gINT comes down to stepping through a bunch of spread sheet like pages and doing a lot of copy/pasting. One obvious way to improve on the program’s interface is by doing all your data entry in something like Excel, and then copy pasting it into gINT, or – since the program allows you to import from various formats – saving your spreadsheet (e.g. as XLS) and importing it into gINT.
But rather than set-up an Excel template (I find Excel equally annoying, especially after finally updating to 2007) , I thought I’d try importing TXT into gINT, and write a Python program for data entry, that will output a TXT file. Plus, in the back of my mind, I am already thinking about converting all existing gINT projects (GPJ files) to TXT so that I can read and work with them using Python, and eventually link all this information to my GIS database.
Yes, gINT provides some kind of add-in for ArcGIS. But considering the program’s general level of user unfriendliness I don’t want to go there. Also, it looks like that extension merely lets you plot gINT borehole/project locations in ArcGIS. I want full access to years of existing gINT files and data ! I would much rather have a simple Python program that reads/writes TXT in a format that gINT understands. That will give me a lot more flexibility. It will even allow me to input data on computer not running gINT. And once, I figure out how to automate exporting all those GPJ files to TXT, I can dig through them and plot them myself in ArcGIS using Python. There is something called gINT RULES, a VBA like scripting language that I might have to befriend. We’ll see.
Creating my Python program starts with setting up a bunch of classes for the different spreadsheet tabs in gINT. For example, there will be a class for PROJECT that contains all the data fields for project information, and there will be a class with fields for the user’s borehole information. Then we go down the list of lab testing and other data that belong to each sample from each borehole. Therefore, the Borehole Class should be a child of the Project Class, and the Sample Class should be a child of the Borehole Class. Some sort of data entry routine, prompts the user for input and invokes instances of these classes to setup new boreholes or samples.
Moreover, an instance of the Sample Class should inherit from the applicable instance of the Borehole Class, i.e. that borehole from which the sample was collect. That way, something like the project number starts at PROJECT.ProjectNumber but is inherit by the Sample instance, and can be called as SAMPLE.ProjectNumber. More about how to accomplish this in the next post…