From f5d94caa1c44f948186d4a192636d4bf33b32ee6 Mon Sep 17 00:00:00 2001 From: lukas leufen <l.leufen@fz-juelich.de> Date: Thu, 12 Dec 2019 14:41:10 +0100 Subject: [PATCH] new function to apply inverse transformation for given mean and std (if required) --- src/statistics.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/statistics.py b/src/statistics.py index 060081de..6f34187e 100644 --- a/src/statistics.py +++ b/src/statistics.py @@ -9,6 +9,18 @@ from typing import Union, Tuple Data = Union[xr.DataArray, pd.DataFrame] +def apply_inverse_transformation(data, mean, std=None, method="standardise"): + if method == 'standardise': + return standardise_inverse(data, mean, std) + elif method == 'centre': + return centre_inverse(data, mean) + elif method == 'normalise': + # use min/max of data or given min/max + raise NotImplementedError + else: + raise NotImplementedError + + def standardise(data: Data, dim: Union[str, int]) -> Tuple[Data, Data, Data]: """ This function standardises a xarray.dataarray (along dim) or pandas.DataFrame (along axis) with mean=0 and std=1 -- GitLab