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 [6]:
    
print (pygslib.gslib.__dist_transf.nscore.__doc__)
    
    
In [7]:
    
transin,transout, error = pygslib.gslib.__dist_transf.ns_ttable(mydata['Primary'],mydata['Declustering Weight'])
print ('there was any error?: ', error!=0)
    
    
In [8]:
    
mydata['NS_Primary'] = pygslib.gslib.__dist_transf.nscore(mydata['Primary'],transin,transout,getrank=False)
    
In [9]:
    
mydata['NS_Primary'].hist(bins=30)
    
    Out[9]:
    
In [10]:
    
mydata['NS_Primary'] = pygslib.gslib.__dist_transf.nscore(mydata['Primary'],transin,transout,getrank=True)
    
In [11]:
    
mydata['NS_Primary'].hist(bins=30)
    
    Out[11]:
    
In [ ]:
    
    
In [ ]: