def sqrt_transform(R, metadata=None, inverse=False, **kwargs):
    """
    Square-root transform.

    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
        :py:mod:`pysteps.io.importers`.
    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.

    """

    R = R.copy()

    if metadata is None:
        if inverse:
            metadata = {"transform": "sqrt"}
        else:
            metadata = {"transform": None}
        metadata["zerovalue"] = np.nan
        metadata["threshold"] = np.nan
    else:
        metadata = metadata.copy()

    if not inverse:
        # sqrt transform
        R = np.sqrt(R)

        metadata["transform"] = "sqrt"
        metadata["zerovalue"] = np.sqrt(metadata["zerovalue"])
        metadata["threshold"] = np.sqrt(metadata["threshold"])
    else:
        # inverse sqrt transform
        R = R**2

        metadata["transform"] = None
        metadata["zerovalue"] = metadata["zerovalue"] ** 2
        metadata["threshold"] = metadata["threshold"] ** 2

    return R, metadata
Square-root transform.

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
:py:mod:`pysteps.io.importers`.
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.
pysteps/utils/transformation.py