Follow us on Twitter

Using Python to Filter and Correct Data

Share:

This example uses a Python script to create a new layer within Maptitude from an input file of Oklahoma well injection data. The input data has a number of erroneous coordinates, so the script filters the bad coordinates out. A few of these coordinates have incorrect signs (e.g. negative latitude or positive longitude), so these are automatically corrected. Finally, each well typically has multiple entries (rows) and these are collated.

The data is the UIC (Underground Injection Control) Injection Volumes report for 2014, available from the Oil and Gas Division of the Oklahoma Corporation Commission. This data is reported by individual oil companies, and lists the volumes of water that have been disposed off in wells. This water is typically “produced water” (i.e. separated from oil that has been pumped from an oil field), and contrary to popular perception, not related to hydraulic fracturing (‘fracking’) activities.

The data file is an Excel workbook, but we export this to a CSV (comma separated value) file that can be easily read with Python’s csv module.

Maptitude includes a Python interface module. At the moment (June 2016), this module only supports Python 2. The following script was written with Python 2.7. You will need a Python COM interface, and ActivePython 2.5 (or later) is recommended. I also recommend the use of a Python development environment such as PythonWin or IDLE.

The Python module can be found in GISDK\Samples\Python sub-directory in the main Maptitude program folder. The installer will have a name such as ‘Caliper-5.0.win32.exe’. Choose the correct installer for your version of Maptitude.

Within Python, the module is named ‘caliper’ (no quotes). Maptitude is started with a call to caliper.Gisdk().

Here is the full script:

This loads the CSV file into a series of WellData objects. Each well is represented by multiple rows (one per month). These are aggregated by summing the volume injected for each well for the entire year. Coordinates are also filtered so that only those within a rectangular box around Oklahoma are accepted. Some have erroneous signs that place them in the wrong hemisphere, and these are corrected.

The data is plotted as a point layer with a JOINed table. The table stores the non-geospatial information for each well. A blue sized-symbol theme is applied. This is sized according to the volume of water injected (in barrels).

Here are the results (blue) on a map that also shows earthquakes for 2014-5 (red):

Imported well data (blue symbols) on a map that also shows earthquakes (red dots).

The input data had a number of fields that we ignored. One of the ones that was imported is the FormationName. This refers to the geological formation that the water was injected into. By creating a Maptitude selection set, it is possible to plot a single formation. Here we plot just the wells that injected water into the Arbuckle Formation:

Restricting the displayed wells (blue) to only those that injected water into the Arbuckle Formation. Notice the correlation with the earthquakes (red).

Here we see that there is a pretty good correlation between earthquakes and volumes injected into the Arbuckle Formation. These maps are discussed in more detail in the Mapping Earthquakes Case Study; and this relationship is given a much more rigorous treatment in the Science paper Oklahoma’s recent earthquakes and saltwater disposal“, Walsh, F., Zoback, M. 2015 (Sci. Adv. 2015;1:e1500195).

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">