<jupyter_start><jupyter_text>PyGSLIB========Draw---------------The GSLIb equivalent parameter file is```                  Parameters for DRAW                  *******************START OF PARAMETERS:data/cluster.dat              \file with data3                                \   number of variables1   2   3                        \   columns for variables0                                \   column for probabilities (0=equal)-1.0e21   1.0e21                 \   trimming limits69069    100                     \random number seed, number to drawdraw.out                         \file for realizations```<jupyter_code>#general imports
import matplotlib.pyplot as plt   
import pygslib  
import numpy as np
import pandas as pd

#make the plots inline
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Getting the data ready for work---------If the data is in GSLIB format you can use the function `pygslib.gslib.read_gslib_file(filename)` to import the data into a Pandas DataFrame.<jupyter_code>#get the data in gslib format into a pandas Dataframe
cluster  = pygslib.gslib.read_gslib_file('../datasets/cluster.dat')

print ('\n\t\tCluster Data \n',cluster.tail())<jupyter_output>Cluster Data 
      Xlocation  Ylocation  Primary  Secondary  Declustering Weight
135       31.5       41.5    22.75       8.21                0.427
136       34.5       32.5     9.42       6.76                0.413
137       35.5       31.5     8.48      12.78                0.419
138       35.5       33.5     2.82       9.21                0.271
139       36.5       32.5     5.26      12.40                0.252<jupyter_text>Testing Draw<jupyter_code>print (pygslib.gslib.__draw.draw.__doc__)
cluster['NO-Weight']=1.
parameters_draw = {
    'vr'    : cluster[['Xlocation','Ylocation','Primary']],  # data
    'wt'    : cluster['NO-Weight'],                          # weight/prob (use wt[:]=1 for equal probability)
    'rseed' : 69069,                                         # random number seed (conditioning cat.)
    'ndraw' : 100}                                           # number to draw

vo,sumwts,error = pygslib.gslib.__draw.draw(**parameters_draw)

print ('error ? ',  error != 0, error)

print ('is 1./sumwts == nd?', 1./sumwts, len(cluster))

#making the output (which is numpy array) a pandas dataframe for nice printing
dfvo=pd.DataFrame(vo,columns= ['Xlocation','Ylocation','Primary'])<jupyter_output><empty_output><jupyter_text>Comparing results with gslib<jupyter_code>print (dfvo.head(6))
print ('******')
print (dfvo.tail(6))<jupyter_output>Xlocation  Ylocation  Primary
0       39.5       18.5     0.06
1       39.5       18.5     0.06
2       39.5       18.5     0.06
3       39.5       18.5     0.06
4       39.5       18.5     0.06
5       39.5       18.5     0.06
******
    Xlocation  Ylocation  Primary
94       39.5       18.5     0.06
95       39.5       18.5     0.06
96       39.5       18.5     0.06
97       39.5       18.5     0.06
98       39.5       18.5     0.06
99       39.5       18.5     0.06