In [1]:
import gamv
import pygslib


test with arbitrary gslib files


In [2]:
parameters = {
    'datafl' : '../pygslib/data/cluster.dat',     # path to file, or none (to use '_xxx_.in') or numpy array (with columns [x,y])
    'icolx'  : 1,                                 # columns for X, Y, Z coordinates
    'icoly'  : 2,
    'icolz'  : 0,
    'ivar'   : [3,4],                        # variables column numbers to be used in ivtail and ivhead,
    'tmin'   : -1.0e21,                      # trimming limits min and max (raws out of this range will be ignored)
    'tmax'   :  1.0e21,
    'outfl'  :  None,                       # path to the output file or None (to use '_xxx_.out')
    'nlag'   : 10,                         # number of lags
    'xlag'   : 5.0,                       # lag separation distance
    'xltol'  : 3.0,                       # lag tolerance
    'ivdir'  : [[0.0,90.0,50.0,0.0,90.0,50.0],
                [0.0,22.5,25.0,0.0,22.5,25.0],
                [90.,22.5,25.0,0.0,22.5,25.0]],           # azm,atol,bandh,dip,dtol,bandv (array with shape [ndir,6])
    'standardize': 0,                     # standardize sill? (0=no, 1=yes)
    'ivpar': [[1, 1, 1, None],
              [1, 2, 2, None],
              [2, 2, 1, None]]}              # tail, head, variogram type, and cut (with shape [nvarg,4])

In [3]:
vg, fig, ax = gamv.gamv(parameters)


                  Parameters for GAMV
                  *******************

START OF PARAMETERS:
../pygslib/data/cluster.dat                          -file with data
1 2 0           -   columns for X, Y, Z coordinates
2 3 4                    - number of variables: column numbers
-1e+21 1e+21                     - trimming limits
_xxx_.out                           -file for variogram output
10                            -number of lags
5.0                            -lag separation distance
3.0                           -lag tolerance
3                            -number of directions
0.0  90.0  50.0  0.0  90.0  50.0
 0.0  22.5  25.0  0.0  22.5  25.0
90.0  22.5  25.0  0.0  22.5  25.0                          -azm,atol,bandh,dip,dtol,bandv (array with shape [ndir,6])
0                     -standardize sill? (0=no, 1=yes)
3                           -number of variograms
1  1  1  None
1  2  2  None
2  2  1  None                          -tail, head, variogram type, cut (array with shape [nvarg,4])


cut[i] is only required if ivtype[i] == 9 or == 10



GAMV Version: 2.905

 data file = ../pygslib/data/cluster.dat             
 columns for X,Y,Z =           1           2           0
 number of variables =           2
 columns =           3           4
 trimming limits =   -1.000000E+21    1.000000E+21
 output file = _xxx_.out                               
 number of lags =          10
 lag distance =        5.000000
 lag tolerance =        3.000000
 number of directions =           3
 azm, atol, bandwh =    0.000000E+00       90.000000       50.000000
 dip, dtol, bandwd =    0.000000E+00       90.000000       50.000000
 azm, atol, bandwh =    0.000000E+00       22.500000       25.000000
 dip, dtol, bandwd =    0.000000E+00       22.500000       25.000000
 azm, atol, bandwh =       90.000000       22.500000       25.000000
 dip, dtol, bandwd =    0.000000E+00       22.500000       25.000000
 flag to standardize sills =           0
 number of variograms =           3
 tail,head,type =           1           1           1
 tail,head,type =           1           2           2
 tail,head,type =           2           2           1

maxdat =         140
Variable number           1
  Number   =         140
  Average  =        4.350429
  Variance =       44.924290
Variable number           2
  Number   =         140
  Average  =        4.140214
  Variance =       20.176980

Variogram  1 Semivariogram          :  tail=Primary      head=Primary        
Variogram  2 Cross Semivariogram    :  tail=Primary      head=Secondary      
Variogram  3 Semivariogram          :  tail=Secondary    head=Secondary      
  currently on        14 of       140
  currently on        28 of       140
  currently on        42 of       140
  currently on        56 of       140
  currently on        70 of       140
  currently on        84 of       140
  currently on        98 of       140
  currently on       112 of       140
  currently on       126 of       140
  currently on       140 of       140

GAMV Version: 2.905 Finished

Stop - Program terminated.



In [4]:
vg


Out[4]:
average separation var funct number of pairs mean on tail mean on head tail head type cut
Variogram Direction Lag
0 0 1 0.000 NaN 280 4.35043 4.35043 1 1 1 None
2 1.715 54.72187 344 8.25648 8.25648 1 1 1 None
3 5.398 51.34340 1462 5.46949 5.46949 1 1 1 None
4 10.106 49.30686 2402 4.39970 4.39970 1 1 1 None
5 14.980 37.87250 2954 4.22077 4.22077 1 1 1 None
6 19.812 41.63007 2928 3.74417 3.74417 1 1 1 None
7 24.903 46.02334 3240 4.00354 4.00354 1 1 1 None
8 29.897 48.44114 3188 4.20921 4.20921 1 1 1 None
9 34.796 43.20760 2614 3.78018 3.78018 1 1 1 None
10 39.731 51.65716 2168 4.61536 4.61536 1 1 1 None
11 44.571 37.33535 1482 5.09089 5.09089 1 1 1 None
12 49.026 29.87481 526 4.56597 4.56597 1 1 1 None
1 1 0.000 NaN 140 4.35043 4.35043 1 1 1 None
2 1.581 30.65833 43 7.99814 7.99558 1 1 1 None
3 5.252 58.19712 213 6.91756 6.24183 1 1 1 None
4 10.048 36.47485 325 3.10018 4.84182 1 1 1 None
5 14.829 31.17937 379 3.48739 4.04744 1 1 1 None
6 19.889 33.53069 388 2.59619 4.63003 1 1 1 None
7 24.699 41.63728 410 1.98176 5.20532 1 1 1 None
8 29.882 52.89236 383 2.47809 5.17911 1 1 1 None
9 34.816 73.04692 302 2.63924 6.08447 1 1 1 None
10 39.361 78.36996 209 2.32005 6.51976 1 1 1 None
11 44.443 22.93371 88 0.60795 4.36432 1 1 1 None
12 48.021 21.02459 10 0.41500 4.32300 1 1 1 None
2 1 0.000 NaN 140 4.35043 4.35043 1 1 1 None
2 1.688 55.27149 48 10.39250 7.48938 1 1 1 None
3 5.271 33.61133 186 5.53903 3.91215 1 1 1 None
4 9.952 52.02257 274 4.93161 3.22383 1 1 1 None
5 15.131 47.00384 356 4.34725 4.21463 1 1 1 None
6 19.576 53.84740 385 3.87356 4.17714 1 1 1 None
... ... ... ... ... ... ... ... ... ... ... ...
2 0 7 24.903 17.95296 3240 3.62590 3.62590 2 2 1 None
8 29.897 21.17041 3188 3.73242 3.73242 2 2 1 None
9 34.796 22.42900 2614 3.67907 3.67907 2 2 1 None
10 39.731 24.20232 2168 4.72536 4.72536 2 2 1 None
11 44.571 29.71206 1482 5.89316 5.89316 2 2 1 None
12 49.026 35.28325 526 5.46238 5.46238 2 2 1 None
1 1 0.000 NaN 140 4.14021 4.14021 2 2 1 None
2 1.581 4.96574 43 8.04349 8.40488 2 2 1 None
3 5.252 18.45436 213 6.79070 5.20540 2 2 1 None
4 10.048 16.03286 325 3.20135 4.28135 2 2 1 None
5 14.829 20.15019 379 4.14984 3.53913 2 2 1 None
6 19.889 18.38974 388 3.09848 4.06830 2 2 1 None
7 24.699 18.95917 410 2.24256 4.48607 2 2 1 None
8 29.882 22.76557 383 2.86990 3.96376 2 2 1 None
9 34.816 27.64490 302 3.52497 4.12520 2 2 1 None
10 39.361 32.12188 209 3.30330 4.61096 2 2 1 None
11 44.443 13.87014 88 0.92148 4.21273 2 2 1 None
12 48.021 11.37257 10 1.56000 4.68700 2 2 1 None
2 1 0.000 NaN 140 4.14021 4.14021 2 2 1 None
2 1.688 5.29808 48 8.35292 7.49563 2 2 1 None
3 5.271 10.41969 186 5.19425 3.88737 2 2 1 None
4 9.952 18.33652 274 4.46609 2.83004 2 2 1 None
5 15.131 21.57426 356 4.65963 3.19539 2 2 1 None
6 19.576 22.66979 385 4.12717 3.37678 2 2 1 None
7 25.010 20.68425 442 3.60995 3.81387 2 2 1 None
8 29.886 21.26143 467 3.64906 3.95709 2 2 1 None
9 34.630 23.38794 364 3.28080 3.36442 2 2 1 None
10 39.443 30.66947 237 5.30451 2.25578 2 2 1 None
11 44.500 38.30968 150 7.60633 2.36467 2 2 1 None
12 48.483 60.68928 27 10.04519 1.73704 2 2 1 None

108 rows × 9 columns

test with numpy array


In [6]:
data = pygslib.gslib.read_gslib_file('../pygslib/data/cluster.dat')
data['Zlocation'] = 0
data.columns


Out[6]:
Index(['Xlocation', 'Ylocation', 'Primary', 'Secondary', 'Declustering Weight',
       'Zlocation'],
      dtype='object')

In [7]:
parameters = {
    'datafl' : data[['Xlocation', 
                     'Ylocation', 
                     'Zlocation',
                     'Primary', 
                     'Secondary']].values,     # path to file, or none (to use '_xxx_.in') or numpy array (with columns [x,y])
    'icolx'  : 1,                                 # columns for X, Y, Z coordinates
    'icoly'  : 2,
    'icolz'  : 0,
    'ivar'   : [3,4],                        # variables column numbers to be used in ivtail and ivhead,
    'tmin'   : -1.0e21,                      # trimming limits min and max (raws out of this range will be ignored)
    'tmax'   :  1.0e21,
    'outfl'  :  None,                       # path to the output file or None (to use '_xxx_.out')
    'nlag'   : 10,                         # number of lags
    'xlag'   : 5.0,                       # lag separation distance
    'xltol'  : 3.0,                       # lag tolerance
    'ivdir'  : [[0.0,90.0,50.0,0.0,90.0,50.0],
                [0.0,22.5,25.0,0.0,22.5,25.0],
                [90.,22.5,25.0,0.0,22.5,25.0]],           # azm,atol,bandh,dip,dtol,bandv (array with shape [ndir,6])
    'standardize': 0,                     # standardize sill? (0=no, 1=yes)
    'ivpar': [[1, 1, 1, None],
              [1, 2, 2, None],
              [2, 2, 1, None]]}              # tail, head, variogram type, and cut (with shape [nvarg,4])

In [8]:
vg = gamv.gamv(parameters)


                  Parameters for GAMV
                  *******************

START OF PARAMETERS:
_xxx_.in                          -file with data
1 2 3           -   columns for X, Y, Z coordinates
2 4 5                    - number of variables: column numbers
-1e+21 1e+21                     - trimming limits
_xxx_.out                           -file for variogram output
10                            -number of lags
5.0                            -lag separation distance
3.0                           -lag tolerance
3                            -number of directions
0.0  90.0  50.0  0.0  90.0  50.0
 0.0  22.5  25.0  0.0  22.5  25.0
90.0  22.5  25.0  0.0  22.5  25.0                          -azm,atol,bandh,dip,dtol,bandv (array with shape [ndir,6])
0                     -standardize sill? (0=no, 1=yes)
3                           -number of variograms
1  1  1  None
1  2  2  None
2  2  1  None                          -tail, head, variogram type, cut (array with shape [nvarg,4])


cut[i] is only required if ivtype[i] == 9 or == 10



GAMV Version: 2.905

 data file = _xxx_.in                                
 columns for X,Y,Z =           1           2           3
 number of variables =           2
 columns =           4           5
 trimming limits =   -1.000000E+21    1.000000E+21
 output file = _xxx_.out                               
 number of lags =          10
 lag distance =        5.000000
 lag tolerance =        3.000000
 number of directions =           3
 azm, atol, bandwh =    0.000000E+00       90.000000       50.000000
 dip, dtol, bandwd =    0.000000E+00       90.000000       50.000000
 azm, atol, bandwh =    0.000000E+00       22.500000       25.000000
 dip, dtol, bandwd =    0.000000E+00       22.500000       25.000000
 azm, atol, bandwh =       90.000000       22.500000       25.000000
 dip, dtol, bandwd =    0.000000E+00       22.500000       25.000000
 flag to standardize sills =           0
 number of variograms =           3
 tail,head,type =           1           1           1
 tail,head,type =           1           2           2
 tail,head,type =           2           2           1

maxdat =         140
Variable number           1
  Number   =         140
  Average  =        4.350429
  Variance =       44.924290
Variable number           2
  Number   =         140
  Average  =        4.140214
  Variance =       20.176980

Variogram  1 Semivariogram          :  tail=v1           head=v1             
Variogram  2 Cross Semivariogram    :  tail=v1           head=v2             
Variogram  3 Semivariogram          :  tail=v2           head=v2             
  currently on        14 of       140
  currently on        28 of       140
  currently on        42 of       140
  currently on        56 of       140
  currently on        70 of       140
  currently on        84 of       140
  currently on        98 of       140
  currently on       112 of       140
  currently on       126 of       140
  currently on       140 of       140

GAMV Version: 2.905 Finished

Stop - Program terminated.