pysteps.utils.transformation.boxcox_transform
pysteps.utils.transformation.boxcox_transform¶
- pysteps.utils.transformation.boxcox_transform(R, metadata=None, Lambda=None, threshold=None, zerovalue=None, inverse=False)¶
The one-parameter Box-Cox transformation.
The Box-Cox transform is a well-known power transformation introduced by Box and Cox (1964). In its one-parameter version, the Box-Cox transform takes the form T(x) = ln(x) for Lambda = 0, or T(x) = (x**Lambda - 1)/Lambda otherwise.
Default parameters will produce a log transform (i.e. Lambda=0).
- Parameters
- R: array-like
Array of any shape to be transformed.
- metadata: dict, optional
Metadata dictionary containing the transform, zerovalue and threshold attributes as described in the documentation of
pysteps.io.importers
.- Lambda: float, optional
Parameter Lambda of the Box-Cox transformation. It is 0 by default, which produces the log transformation.
Choose Lambda < 1 for positively skewed data, Lambda > 1 for negatively skewed data.
- threshold: float, optional
The value that is used for thresholding with the same units as R. If None, the threshold contained in metadata is used. If no threshold is found in the metadata, a value of 0.1 is used as default.
- zerovalue: float, optional
The value to be assigned to no rain pixels as defined by the threshold. It is equal to the threshold - 1 by default.
- inverse: bool, optional
If set to True, it performs the inverse transform. False by default.
- Returns
- R: array-like
Array of any shape containing the (back-)transformed units.
- metadata: dict
The metadata with updated attributes.
References
Box, G. E. and Cox, D. R. (1964), An Analysis of Transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26: 211-243. doi:10.1111/j.2517-6161.1964.tb00553.x