geostats

GridSpec

class wtools.geostats.GridSpec(**kwargs)[source]

Bases: properties.base.base.HasProperties

A GridSpec object provides the details of a single axis along a grid.
If you have a 3D grid then you will have 3 GridSpec objects.

Required Properties:

  • min (Integer): The minimum value along this dimension. The origin., an integer
  • n (Integer): The number of components along this dimension., an integer
  • sz (Integer): The uniform cell size along this dimension., an integer

Optional Properties:

  • nnodes (Integer): The number of grid nodes to consider on either side of the origin in the output map, an integer
min

The minimum value along this dimension. The origin., an integer

Type:min (Integer)
n

The number of components along this dimension., an integer

Type:n (Integer)
nnodes

The number of grid nodes to consider on either side of the origin in the output map, an integer

Type:nnodes (Integer)
sz

The uniform cell size along this dimension., an integer

Type:sz (Integer)

geoeas2numpy

wtools.geostats.geoeas2numpy(datain, nx, ny=None, nz=None)[source]

Transform GeoEas array into np.ndarray to be treated like image. Function to transform a SINGLE GoeEas-formatted raster (datain) i.e., a single column, to a NumPy array that can be viewed using imshow (in 2D) or slice (in 3D).

Parameters:
  • datain (np.ndarray) – 1D input GeoEas-formatted raster of dimensions:
  • nx (int) – the number of dimensions along the 1st axis
  • ny (int, optional) – the number of dimensions along the 2nd axis
  • nz (int, optional) – the number of dimensions along the 3rd axis
Returns:

If only nx given: 1D array.

If only nx and ny given: 2D array. If nx, ny, and nz given: 3D array.

Return type:

np.ndarray

Note

In 3D, z increases upwards

References

Originally implemented in MATLAB by:
Phaedon Kyriakidis, Department of Geography, University of California Santa Barbara, May 2005
Reimplemented into Python by:
Bane Sullivan and Jonah Bartrand, Department of Geophysics, Colorado School of Mines, October 2018

geoeas2numpyGS

wtools.geostats.geoeas2numpyGS(datain, gridspecs)[source]

A wrapper for geoeas2numpy to handle a list of GridSpec objects

Parameters:gridspecs (list(GridSpec)) – array with grid specifications using GridSpec objects

raster2structgrid

wtools.geostats.raster2structgrid(datain, gridspecs, imeas='covariogram', idisp=False)[source]

Create an auto-variogram or auto-covariance map from 1D or 2D rasters. This computes auto-variogram or auto-covariance maps from 1D or 2D rasters. This function computes variograms/covariances in the frequency domain via the Fast Fourier Transform (np.fft).

Note this only handles one dataset and we removed the icolV argument.

Note

Missing values, flagged as np.nan, are allowed.

Parameters:
  • datain (np.ndarray) – input arrray with raster in GeoEas format
  • gridspecs (list(GridSpec)) – array with grid specifications using GridSpec objects
  • imeas (str) – key indicating which structural measure to compute: semi-variogram or covariogram
  • idisp (bool) – flag for whether to display results using an internal plotting routine
Returns:

output array with variogram or covariogram map, depending

on imeas, with size: in 1D: ( 2*nxOutHalf+1 ) or in 2D: ( 2*nxOutHalf+1 x 2*nxOutHalf+1 )

np.ndarray: output array with number of pairs available in each lag,

of same size as outStruct

Return type:

np.ndarray

Note

Author: Dennis Marcotte: Computers & Geosciences, > Vol. 22, No. 10, pp. 1175-1186, 1996.

References

Originally implemented in MATLAB by:
Phaedon Kyriakidis, Department of Geography, University of California Santa Barbara, May 2005
Reimplemented into Python by:
Bane Sullivan and Jonah Bartrand, Department of Geophysics, Colorado School of Mines, October 2018
Algorith based on:
Marcotte, D. (1996): Fast Variogram Computation with FFT, Computers & Geosciences, 22(10), 1175-1186.

suprts2modelcovFFT

wtools.geostats.suprts2modelcovFFT(CovMapExtFFT, ind1Ext, sf1Ext, ind2Ext, sf2Ext)[source]

Integrated model covariances between 1 or 2 sets of arbitrary supports. Function to calculate array of TOTAL or AVERAGE model covariances between 1 or 2 sets of irregular supports, using convolution in the frequency domain (FFT-based). Integration or averaging is IMPLICIT in the pre-computed sampling functions (from discrsuprtsFFT).

Parameters:
  • CovMapExtFFT (np.ndarray) – Fourier transform of model covariance map evaluated at nodes of an extended MATLAB grid
  • ind1Ext – (nSup1 x 1) cell array with MATLAB indices of non-zero sampling function values for support set #1 in extended MATLAB grid
  • sf1Ext – (nSup1 x 1) cell array with sampling function values for support set #1
  • ind2Ext – Optional (nSup2 x 1) cell array with MATLAB indices of non-zero sampling function values for support set #2 in extended MATLAB grid
  • sf2Ext – Optional (nSup2 x 1) cell array with sampling function values for support set #2
Returns:

(nSup1 x nSup[1,2]) array with integrated covariances

Return type:

np.ndarray

References

Originally implemented in MATLAB by:
Phaedon Kyriakidis, Department of Geography, University of California Santa Barbara, May 2005
Reimplemented into Python by:
Bane Sullivan and Jonah Bartrand, Department of Geophysics, Colorado School of Mines, October 2018