PyGSLIB

Introduction

This is a simple example on how to use raw pyslib to compute variograms


In [1]:
#general imports
import pygslib


Data to test


In [2]:
import numpy as np
x= np.array([0, 0.5, 1,  2,  3,  4,  5,  6,  7,  8, 9])
y= np.array([0, 0.5, 0,  0,  0,  0,  0,  0,  0,  0, 0])
z= np.array([0,   0, 0,  0,  0,  0,  0,  0,  0,  0, 0])
v= np.array([0,   1, 1,  2,  3,  4,  5,  6,  7,  8, 9])
bhid = np.array ([1,1,1,1,1,1,1,1,1,1,1])

In [3]:
bhid.shape, v.shape,x.shape, y.shape, z.shape


Out[3]:
((11,), (11,), (11,), (11,), (11,))

Testing variogram function gamv


In [4]:
# these are the parameters we need. Note that at difference of GSLIB this dictionary also stores 
# the actual data (ex, X, Y, etc.). 

#important! python is case sensitive 'bhid' is not equal to 'BHID'


parameters = {
            'x'    : x, # mydata['Xlocation'].values,
            'y'    : y, # mydata['Ylocation'].values,
            'z'    : z, # mydata['Zlocation'].values, 
            'bhid' : bhid, # mydata['bhid'].values,
            'vr'   : v, # mydata['Primary'].values,
            'tmin' : -1.0e21,
            'tmax' :  1.0e21,
            'nlag' :  11,
            'xlag' :  1,
            'ndir' :  2,
            'ndip' :  1,
            'orgdir': 0.,
            'orgdip': 0.,
            'isill' : 1,
            'sills' : v.var(),
            'ivtail' : [1],
            'ivhead' : [1],
            'ivtype' : [1]
        }

In [5]:
#Now we are ready to calculate the veriogram
np, dis, gam, hm, tm, hv, tv = pygslib.gslib.gamv3D(parameters)

In [6]:
np


Out[6]:
array([[[[13.]],

        [[ 0.]]],


       [[[10.]],

        [[ 0.]]],


       [[[ 9.]],

        [[ 0.]]],


       [[[ 8.]],

        [[ 0.]]],


       [[[ 7.]],

        [[ 0.]]],


       [[[ 6.]],

        [[ 0.]]],


       [[[ 5.]],

        [[ 0.]]],


       [[[ 4.]],

        [[ 0.]]],


       [[[ 3.]],

        [[ 0.]]],


       [[[ 1.]],

        [[ 0.]]],


       [[[ 0.]],

        [[ 0.]]]])

In [7]:
dis


Out[7]:
array([[[[0.10878566]],

        [[0.        ]]],


       [[[1.05811388]],

        [[0.        ]]],


       [[[2.06105664]],

        [[0.        ]]],


       [[[3.06694174]],

        [[0.        ]]],


       [[[4.07538465]],

        [[0.        ]]],


       [[[5.08711342]],

        [[0.        ]]],


       [[[6.10384048]],

        [[0.        ]]],


       [[[7.12916205]],

        [[0.        ]]],


       [[[8.17156439]],

        [[0.        ]]],


       [[[9.        ]],

        [[0.        ]]],


       [[[0.        ]],

        [[0.        ]]]])

In [ ]:


In [ ]: