Code Monkey home page Code Monkey logo

geostatsmodels's Introduction

geostatsmodels

This is an implementation of ideas from Clayton V. Deutsch and Michael Pyrcz's book Geostatistical Reservoir Modeling in order to better understand geostatistics. I am working through things first in Python in order to prototype things quickly and make sure I understand them.

There is also an R package for geostatistics named gstat, but I have not used it much.

This software is licensed under the MIT License.

Installation and Dependencies

This package depends on:

  • numpy, the fundamental package for scientific computing with Python.
  • matplotlib, a Python 2D plotting library which produces publication quality figures.
  • scipy, a Python library which provides many user-friendly and efficient numerical routines such as routines for numerical integration and optimization.
  • pandas, a Python library which implements excellent tools for data analysis and modeling.

The best/easiest way to install these packages is to use one of the Python distributions described here. Anaconda has been successfully tested with geostatsmodels.

Most of those distributions should include pip or conda, which are command line tools for installing and managing Python packages. You can use pip to install geostatsmodels itself.

You may need to open a new terminal window to ensure that the newly installed versions of python and pip are in your path.

To install geostatsmodels:

pip install git+git://github.com/cjohnson318/geostatsmodels.git

Uninstalling and Updating

To uninstall:

pip uninstall geostatsmodels

To update:

pip install -U git+git://github.com/cjohnson318/geostatsmodels.git

Usage

Some notebooks exploring the functionality of geostatsmodels are included below.

Variogram Analysis

Kriging Example

More to come!

geostatsmodels's People

Contributors

cjohnson318 avatar dynamicwebpaige avatar mhearne-usgs avatar michaelpyrcz avatar xunius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geostatsmodels's Issues

Kriging for geotif image

Hello, i m trying to use kriging to tiff image. the image is that below with number 1 that can be used as an array, it is regular grid. the 2nd image is the one that saga simple kriging module generates. I 'd like to produce a similar product using python. Is it possible somehow geostatsmodels? I tried to run your example using my images with no success.

image

install geostatsmodels

(test) C:\Users\Parisa\Anaconda3\Scripts>pip install geostatsmodels
Collecting geostatsmodels
Could not find a version that satisfies the requirement geostatsmodels (from versions: )
No matching distribution found for geostatsmodels

Hi, degree function is erroneous

Hi,

I am sorry I believe your bearing function is erroneous

p1 = [1.0, 0.0]
p0 = [2.0, -0.1]
from geostatsmodels import utilities
utilities.bearing( p0, p1 )

should be close to 90 degrees but results in 275.71.

I also know that angle tolarance function (lagindices) is wrong but I could not tell exactly where. The reason is, if you do not exclude indices as you do by "indices = np.array([ i for i in indices if i[1] > i[0] ])", the resulting pairs of indicies might be assymetric, check with np.allclose(np.sort(indices[:,0]), np.sort(indices[:,1])). Tell me if you need more information. Do we use the same definition for tolerance?

Issue on Geostatsmodel

"git clone -q git://github.com/cjohnson318/geostatsmodels.git C:\Users\xxxxxxxx\AppData\Local\Temp\pip-req-build-bt3qlfue" failed with error code 1 in None

Having difficulty installing. Anticipating your response.

Error variance computation for ordinary krigging?

Hi,

I'm studying your code for ordinary krigging, and I notice that the variance of krigging error is computed differently from wiki and this reference, and they also differ from each other, so I'm bit confused.

Can you give a look at the relevant code and see if there is any error?

geoplot.semivariogram from example gives error

Hello C Johnson,

I came across your interesting software today and immediately tried to run few examples. I followed the example from
http://nbviewer.jupyter.org/github/cjohnson318/geostatsmodels/blob/master/notebooks/VariogramAnalysis.ipynb

and my code is

import numpy as np
from pandas import DataFrame, Series
from geostatsmodels import utilities, kriging, variograms, model, geoplot
import matplotlib.pyplot as plt
from scipy.stats import norm


z = open('ZoneA.dat','r' ).readlines()
z = [ i.strip().split() for i in z[10:] ]
z = np.array( z, dtype=np.float )
z = DataFrame( z, columns=['x','y','thk','por','perm','lperm','lpermp','lpermr'] )
P = np.array( z[['x','y','por']] )

fig, ax = plt.subplots()
fig.set_size_inches(8,8)
cmap = geoplot.YPcmap
ax.scatter( z.x/1000, z.y/1000, c=z.por, s=64,cmap=cmap)
ax.set_aspect(1)
plt.xlim(-2,22)
plt.ylim(-2,17.5)

plt.xlabel('Easting [m]')
plt.ylabel('Northing [m]')
th=plt.title('Porosity %')

tolerance = 1000
lags = np.arange( tolerance, 10000, tolerance*2 )
sill = np.var(P[:,2])

pw = utilities.pairwise(P)
geoplot.hscattergram(P,pw,1000,500)

tolerance = 250
lags = np.arange( tolerance, 10000, tolerance*2 )
sill = np.var(P[:,2])

geoplot.semivariogram( P, lags, tolerance )

I use the same data as in the example. However, I am unable to get a plot of semivariogram and instead I get

Traceback (most recent call last):

  File "<ipython-input-51-b20e0e8f00c3>", line 1, in <module>
    runfile('C:/PYTHON/geostatistics/geo1.py', wdir='C:/PYTHON/geostatistics')

  File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/PYTHON/geostatistics/geo1.py", line 37, in <module>
    geoplot.semivariogram( P, lags, tolerance )

  File "C:\Anaconda\lib\site-packages\geostatsmodels\geoplot.py", line 82, in semivariogram
    h, sv = variograms.semivariogram( data, lags, tol )

TypeError: iteration over a 0-d array

Can you please help me to get over this issue ?

MemoryError

Hello, I get the error "Memory Error" when I tried to create a grid from a file with 188632 sample data
__________input.dat
Clustered 188632 primary data
3
Xlocation
Ylocation
Zlocation
2.9464846e+02 1.0134669e+01 2.6000000e+00
2.9468616e+02 1.0125276e+01 3.0000000e+00
2.9467971e+02 1.0149461e+01 8.6000000e+00
2.9471140e+02 1.0137093e+01 7.6000000e+00
2.9472819e+02 1.0120373e+01 2.6000000e+00
2.9475969e+02 1.0117260e+01 3.9000000e+00
2.9477075e+02 1.0129904e+01 9.0000000e+00
2.9474078e+02 1.0138911e+01 8.5000000e+00
2.9476244e+02 1.0147643e+01 1.0400000e+01
2.9481534e+02 1.0138168e+01 1.0400000e+01
2.9479561e+02 1.0111503e+01 4.4000000e+00
2.9480350e+02 1.0119822e+01 7.2000000e+00
2.9481507e+02 1.0125717e+01 8.5000000e+00
2.9484598e+02 1.0125001e+01 1.4000000e+01
2.9462761e+02 1.0140289e+01 5.0000000e+00
2.9460220e+02 1.0143621e+01 3.0000000e+00
2.9458538e+02 1.0144641e+01 3.0000000e+00
2.9456347e+02 1.0149351e+01 3.9000000e+00
2.9456820e+02 1.0166675e+01 9.0000000e+00
2.9460479e+02 1.0163288e+01 9.9000000e+00
2.9459742e+02 1.0182539e+01 1.6200000e+01
2.9463228e+02 1.0173038e+01 1.3600000e+01
2.9467131e+02 1.0168906e+01 1.2000000e+01
2.9471549e+02 1.0158991e+01 1.1200000e+01
2.9471329e+02 1.0177279e+01 1.6800000e+01
2.9474776e+02 1.0175847e+01 1.5800000e+01
2.9475986e+02 1.0158109e+01 1.2200000e+01
2.9483608e+02 1.0098198e+01 7.2000000e+00
2.9486021e+02 1.0091173e+01 8.1000000e+00
2.9486914e+02 1.0086241e+01 3.5000000e+00

404 error on links to Bohling's website

your references to Bohling's KU geostat course seem to be 404ing.
Indeed, most of bohling's website appears to be broken right now; not sure if this is temporary or if this is a permanent change in the target site.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.