In [1]:
#general imports
import matplotlib.pyplot as plt
import pygslib
from matplotlib.patches import Ellipse
import numpy as np
import pandas as pd
#make the plots inline
%matplotlib inline
In [2]:
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file('../datasets/cluster.dat')
In [3]:
# This is a 2D file, in this GSLIB version we require 3D data and drillhole name or domain code
# so, we are adding constant elevation = 0 and a dummy BHID = 1
mydata['Zlocation']=0
mydata['bhid']=1
# printing to verify results
print (' \n **** 5 first rows in my datafile \n\n ', mydata.head(n=5))
In [4]:
#view data in a 2D projection
plt.scatter(mydata['Xlocation'],mydata['Ylocation'], c=mydata['Primary'])
plt.colorbar()
plt.grid(True)
plt.show()
In [5]:
print (pygslib.gslib.__dist_transf.ns_ttable.__doc__)
Note that the input can be data or a reference distribution function
In [6]:
dtransin,dtransout, error = pygslib.gslib.__dist_transf.ns_ttable(mydata['Primary'],mydata['Declustering Weight'])
dttable= pd.DataFrame({'z': dtransin,'y': dtransout})
print (dttable.head(3))
print (dttable.tail(3) )
print ('there was any error?: ', error!=0)
In [7]:
dttable.hist(bins=30)
Out[7]:
Normal score transformation table without delustering wight
In [8]:
transin,transout, error = pygslib.gslib.__dist_transf.ns_ttable(mydata['Primary'],np.ones(len(mydata['Primary'])))
ttable= pd.DataFrame({'z': transin,'y': transout})
print (ttable.head(3))
print (ttable.tail(3))
In [9]:
ttable.hist(bins=30)
Out[9]:
In [10]:
parameters_probplt = {
'iwt' : 0, #int, 1 use declustering weight
'va' : ttable.y, # array('d') with bounds (nd)
'wt' : np.ones(len(ttable.y))} # array('d') with bounds (nd), wight variable (obtained with declust?)
parameters_probpltl = {
'iwt' : 0, #int, 1 use declustering weight
'va' : dttable.y, # array('d') with bounds (nd)
'wt' : np.ones(len(dttable.y))} # array('d') with bounds (nd), wight variable (obtained with declust?)
binval,cl,xpt025,xlqt,xmed,xuqt,xpt975,xmin,xmax, \
xcvr,xmen,xvar,error = pygslib.gslib.__plot.probplt(**parameters_probplt)
binvall,cll,xpt025l,xlqtl,xmedl,xuqtl,xpt975l,xminl, \
xmaxl,xcvrl,xmenl,xvarl,errorl = pygslib.gslib.__plot.probplt(**parameters_probpltl)
In [11]:
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (cl, binval, label = 'gaussian non-declustered')
plt.plot (cll, binvall, label = 'gaussian declustered')
plt.legend(loc=4)
plt.grid(True)
fig.show
Out[11]:
In [ ]:
In [ ]: