# gstools.transform¶

GStools subpackage providing transformations.

## Field-Transformations¶

 `binary`(fld[, divide, upper, lower]) Binary transformation. `discrete`(fld, values[, thresholds]) Discrete transformation. `boxcox`(fld[, lmbda, shift]) Box-Cox transformation. `zinnharvey`(fld[, conn]) Zinn and Harvey transformation to connect low or high values. `normal_force_moments`(fld) Force moments of a normal distributed field. `normal_to_lognormal`(fld) Transform normal distribution to log-normal distribution. `normal_to_uniform`(fld) Transform normal distribution to uniform distribution on [0, 1]. `normal_to_arcsin`(fld[, a, b]) Transform normal distribution to the bimodal arcsin distribution. `normal_to_uquad`(fld[, a, b]) Transform normal distribution to U-quadratic distribution.

`gstools.transform.``binary`(fld, divide=None, upper=None, lower=None)[source]

Binary transformation.

After this transformation, the field only has two values.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. divide (`float`, optional) – The dividing value. Default: `fld.mean` upper (`float`, optional) – The resulting upper value of the field. Default: `mean + sqrt(fld.model.sill)` lower (`float`, optional) – The resulting lower value of the field. Default: `mean - sqrt(fld.model.sill)`
`gstools.transform.``discrete`(fld, values, thresholds='arithmetic')[source]

Discrete transformation.

After this transformation, the field has only len(values) discrete values.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. values (`numpy.ndarray`) – The discrete values the field will take thresholds (`str` or `numpy.ndarray`, optional) – the thresholds, where the value classes are separated possible values are: * “arithmetic”: the mean of the 2 neighbouring values * “equal”: devide the field into equal parts * an array of explicitly given thresholds Default: “arithmetic”
`gstools.transform.``boxcox`(fld, lmbda=1, shift=0)[source]

Box-Cox transformation.

After this transformation, the again Box-Cox transformed field is normal distributed.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. lmbda (`float`, optional) – The lambda parameter of the Box-Cox transformation. For `lmbda=0` one obtains the log-normal transformation. Default: `1` shift (`float`, optional) – The shift parameter from the two-parametric Box-Cox transformation. The field will be shifted by that value before transformation. Default: `0`
`gstools.transform.``zinnharvey`(fld, conn='high')[source]

Zinn and Harvey transformation to connect low or high values.

After this transformation, the field is still normal distributed.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. conn (`str`, optional) – Desired connectivity. Either “low” or “high”. Default: “high”
`gstools.transform.``normal_force_moments`(fld)[source]

Force moments of a normal distributed field.

After this transformation, the field is still normal distributed.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace.
`gstools.transform.``normal_to_lognormal`(fld)[source]

Transform normal distribution to log-normal distribution.

After this transformation, the field is log-normal distributed.

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace.
`gstools.transform.``normal_to_uniform`(fld)[source]

Transform normal distribution to uniform distribution on [0, 1].

After this transformation, the field is uniformly distributed on [0, 1].

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace.
`gstools.transform.``normal_to_arcsin`(fld, a=None, b=None)[source]

Transform normal distribution to the bimodal arcsin distribution.

After this transformation, the field is arcsin-distributed on [a, b].

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. a (`float`, optional) – Parameter a of the arcsin distribution (lower bound). Default: keep mean and variance b (`float`, optional) – Parameter b of the arcsin distribution (upper bound). Default: keep mean and variance
`gstools.transform.``normal_to_uquad`(fld, a=None, b=None)[source]

Transform normal distribution to U-quadratic distribution.

After this transformation, the field is U-quadratic-distributed on [a, b].

Parameters: fld (`Field`) – Spatial Random Field class containing a generated field. Field will be transformed inplace. a (`float`, optional) – Parameter a of the U-quadratic distribution (lower bound). Default: keep mean and variance b (`float`, optional) – Parameter b of the U-quadratic distribution (upper bound). Default: keep mean and variance