In today’s E&P industry the maxim “time is money” could never be more true. How much time is spent running the same process, the same workflow, clicking the same mouse buttons, tapping the same keys?
Using GIS we have shortened workflows that take many hours into mere minutes, or from months into days. GIS tools may never be able to replace the ZMaps or Petrels but in a first pass review of a new area GIS tools are well positioned to be the first analysis software to use, as they can consume many different types of data and allow you to run many types of analysis.
So what’s Python then? Yes a strange name but potentially critical to the success of advanced use of GIS in the E&P industry. Python is a scripting language – don’t run yet! Anyone can start scripting and the amount of time it could save you will easily compensate for the investment.
OK here’s some background behind Python. Python was named after Monty Python’s Flying Circus by a Dutch man Guido van Rossum. It was designed as an easy to use and learn scripting language, especially for people who have never opened a script in their lives. There’s even a design philosophy called “The Zen of Python”. Python is open source which means that it is developed by the community, it’s free, and that lots of enthusiasts can build modules and expand its capabilities.
Python and ArcGIS
So what’s this got to do with GIS? Well Python is integrated into ArcGIS as a scripting platform allowing you to expand on out-of-the-box functionality to fully automated workflows. You can also easily put a simple dialog on the workflow for passing in parameters if you wish. If you have a workflow that is repetitive then Python will repeat it for you. If you need to do some number crunching with many GRIDs then Python can do this for you. For example, recently I developed a workflow to create Area Depth Pairs which I could run on as many extents as I liked in a single process. There are many possibilities and opportunities for saving time and getting more effective results by using Python in ArcGIS.
Esri have opened up all of the tools in ArcToolbox to be accessible via Python. In ArcGIS 10 access to layers and map functionality has been added to this. For example, I can write a script that will bulk save layers in a map to layer files with a single click.
With Python there are many modules that allow you to expand your workflows. For example, NumPy is a statistical module which has many mathematical equations. GDAL allows interaction with many formats of raster. There are many other modules that can be downloaded. ArcGIS Desktop also includes some scripts that can be found in ArcToolbox, for example Batch Project. Scripts in ArcToolbox look like the image below and you can review the code by right mouse clicking on the tool in ArcToolbox and selecting Edit.
Python is not the complete answer to everything; there are situations where there is a need for development in .NET ArcObjects. But for automating workflows Python provides a great starting point by being an open platform and easy to use.
When to use Python
I’d propose a very simple model to analyse the worth of modelling workflows from other software into GIS in terms of would it benefit a business in saving time or money. I ask some simple questions, such as:
- Is the workflow spatial?
- What are the inputs (can we get them into GIS format)?
- What are the desired outputs (can we get them back into the desired format)?
- If the workflow was put in GIS would it save time for the users?
- Can the workflow be mostly automated?
- Will it save money e.g. other software license costs in comparison to GIS?
If the answer is yes to most of these then it could be Python time! At Exprodat we have developers and consultants who can analyse your workflows and redevelop them if you don’t want to learn Python yourself. We can even help you develop your own scripts or assess if .NET ArcObjects would provide a better solution.
Getting Started with Python
If you would like to get started in Python then there are some good starting tutorials online, two example websites would by Python.org or Dive into Python. You could also attend Esri Python courses; more information can be found at your local Esri website.
Ready to start scripting? ArcGIS Desktop installation comes with a free application called PythonWin where you can start writing Python scripts in (see ArcGIS Desktop’s installation notes for more details), and also the embedded Python panel in ArcGIS 10. Alternatively you could use a commercial application called Wing IDE, which has additional functionality.
Posted by Rob Clark, GIS Consultant, Exprodat.