Skip to main content

Geostatistical methods from GSLIB translated and reimplimented in Python

Project description

If you get a package import error, you may have to first install some of these packages. This can usually be accomplished by opening up a command window on Windows and then typing 'python -m pip install [package-name]'. More assistance is available with the respective package docs.

Explanation of GeostatsPy

GeostatsPy includes functions that run 2D workflows in GSLIB from Python (i.e. low tech wrappers), Python translations and in some cases reimplementations of GSLIB methods, along with utilities to move between GSLIB's Geo-EAS data sets and DataFrames, and grids and 2D Numpy arrays respectively and other useful operations such as resampling from regular datasets and rescaling distributions. Here's a sumary list of functions avaible.

  1. import and export from GSLIB's Geo-EAS format
  2. histograms
  3. location maps and combined location map and pixel plot
  4. affine and nscore distribution transformations
  5. variogram calculation and modeling
  6. sgsim unconditional and conditional
  7. cosgsim unconditonal
  8. regular, random and user-specified resampling from a grid

The reimplimentations as of now include NSCORE, GAM, GAMV, DECLUS and most of the visualizations using the standard GSLIB parametric inputs and Matplotlib back end. The low tech wrappers remain for KB2D and SGSIM and simply write the GSLIB parameters, run the GSLIB executables and then read in the GSLIB output. I will translate these soon.

Why make this package?

I wanted a set of functions for working with the very robust and numerically efficient GSLIB Geostatistical Library (Deutsch and Journel, 1998) in Python. While there are other current solutions in Python. I found that these solutions are either proprietary (not open source), not maintained or missing vital functionality; therefore, I have not been able to use these other solutions to teach modeling workflows to students with little or no programming experience. Imagine getting 55 undergraduate students to role back ot a previous version on Python because a single dependency of an available package is not available in a current Python version. Image a student about to submit an assignment that won't work immdeiately before submission because of an update. I need methods for my students that just work, are reliable and do not require students to complete a more complicated environment setup.

Deutsch and Journel (1998) gave the community GSLIB, an extremely robust and flexible set of tools to build spatial modeling workflows. I have spent almost 20 years working with GSLIB along with a wide variety of subsurface modeling software. The powerful flexibility of GSLIB may be lost in methods that attempt to 'can' the inputs and parameters into complicated and hard to work with objects or attempt to combine the programs into a single program. I love open source for teaching the theory, students must see under the hood! The concept of basic building blocks and simple, common inputs is essential to GSLIB. I tried to preserve this by putting together functions with the same conventions as GSLIB, the result is a set of functions that (1) are practical for my students to use and (2) will move the GSLIB veterans into Python workflow construction. Honestly, I did nothing original, but that was my intention.

Of course, I could have properly wrapped GSLIB, built a proper package and maintained it as open source free to all. I address this one day or maybe someone else will do that. That would be good for our community. I'm just a new professor keeping barely keeping up with providing new quality classes and supporting materials to students, supporting my graduate students and finding funding. Providing tools to support the community is something I believe in, I learned that as a PhD student with the great opportunity to be supervised by Clayton Deutsch. I'll do what I can.

The GeostatsPy Functions

The next block includes all the current functions. To use them save this as a .py file and import it at the beginning of your Python workflow. You could also just include them in the workflow as I do below. The executables associated with the functions should be in the current working directory. These include GSLIB programs.

  1. kb2d.exe
  2. sgsim.exe

The source for these are available from GSLIB.com. If you would like to get the executables, ready to use without any need to compile them, go to GSLIB.com for Windows and Linux. I failed to find any Mac OS X executables so my Ph.D. student Wendi Liu compiled them for us (thank you Wendi!) and we have posted them here https://github.com/GeostatsGuy/GSLIB_MacOS. If folks on Windows are encountering missing DLL's, I could post static builds. Wendi provided instructions to help Mac users with missing DLL issues at that same location above.

The functions are followed by a set of demonstrations. There is no attempt to build a comprehensive workflow nor demonstrate best practice, but the demonstrations should provide examples usecases to help you build your own workflows and benchmarks for testing.

Required Libraries

GeostatPy functions require some packages including:

  1. NumPy
  2. Pandas
  3. Matplotlib

along with miscellaneous operating system interfaces (os) and pseudo-random numbers (rand). By design these are all standard and should be available with standard Python installs (e.g. https://www.anaconda.com/download/).

Images

The graphical methods have 2 variants. '_ST' specifies that function is suitable for building subplots (stacked / combined images) while those without '_ST' are for stand-alone images (output in the output block and as an image file). The resolution and image file type are specified at the top of the GeostatPy functions.

Assistance Welcome

Found an issue (I'm sure there are issues!)? Got a new idea? Want to work on this? Let me know, submit revisions, I'm happy to collaborate,

Michael

Michael Pyrcz, Ph.D., P.Eng. Associate Professor The Hildebrand Department of Petroleum and Geosystems Engineering, Bureau of Economic Geology, The Jackson School of Geosciences, The University of Texas at Austin

On twitter I'm the @GeostatsGuy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geostatspy-0.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geostatspy-0.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file geostatspy-0.0.1.tar.gz.

File metadata

  • Download URL: geostatspy-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.0

File hashes

Hashes for geostatspy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f1f1531667ef7893139a831cdc948258031c41cf22401b96958790a1b25f87ac
MD5 a40b3d7dc62ac821e84259c46b9b4b99
BLAKE2b-256 9dc38588849a5a20613770b0a45b5d17cda08683bf3ea2bce9f549f193807cdd

See more details on using hashes here.

File details

Details for the file geostatspy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: geostatspy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.0

File hashes

Hashes for geostatspy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad277c37076611fd30f1c38ce3cb8aa846af1e733e353c789ec7d3d89345a73a
MD5 a2b6ebef4a282a191dd5b6c5e62d4bf2
BLAKE2b-256 371971c75dcc528a11e4cf704e572acadd7bc1b94e89246666ee3cb3391a0877

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page