How to use the climpred.smoothing._reset_temporal_axis function in climpred

To help you get started, we’ve selected a few climpred examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bradyrx / climpred / climpred / classes.py View on Github external
has_dataset(
            self._datasets['control'], 'control', 'compute a persistence forecast'
        )
        input_dict = {
            'ensemble': self._datasets['initialized'],
            'control': self._datasets['control'],
            'init': True,
        }
        res = self._apply_climpred_function(
            compute_persistence,
            input_dict=input_dict,
            metric=metric,
            alignment='same_inits',
        )
        if self._temporally_smoothed:
            res = _reset_temporal_axis(res, self._temporally_smoothed, dim='lead')
        return res
github bradyrx / climpred / climpred / classes.py View on Github external
'compute an uninitialized metric',
        )
        input_dict = {
            'ensemble': self._datasets['uninitialized'],
            'control': self._datasets['control'],
            'init': False,
        }
        res = self._apply_climpred_function(
            compute_perfect_model,
            input_dict=input_dict,
            metric=metric,
            comparison=comparison,
            **metric_kwargs,
        )
        if self._temporally_smoothed:
            res = _reset_temporal_axis(res, self._temporally_smoothed, dim='lead')
        return res
github bradyrx / climpred / climpred / classes.py View on Github external
metric=metric,
            comparison=comparison,
            alignment=alignment,
            dim=dim,
            hist=hist,
            reference=reference,
            **metric_kwargs,
        )
        if self._temporally_smoothed:
            if isinstance(res, dict) and not isinstance(res, xr.Dataset):
                for res_key, res_item in res.items():
                    res[res_key] = _reset_temporal_axis(
                        res_item, self._temporally_smoothed, dim='lead'
                    )
            else:
                res = _reset_temporal_axis(res, self._temporally_smoothed, dim='lead')
        return res
github bradyrx / climpred / climpred / classes.py View on Github external
"""
        has_dataset(self._datasets['control'], 'control', 'compute a metric')
        input_dict = {
            'ensemble': self._datasets['initialized'],
            'control': self._datasets['control'],
            'init': True,
        }
        init_skill = self._apply_climpred_function(
            compute_perfect_model,
            input_dict=input_dict,
            metric=metric,
            comparison=comparison,
            **metric_kwargs,
        )
        if self._temporally_smoothed:
            init_skill = _reset_temporal_axis(
                init_skill, self._temporally_smoothed, dim='lead'
            )
        if isinstance(reference, str):
            reference = [reference]
        elif reference is None:
            return init_skill
        skill_labels = ['init']
        if 'historical' in reference:
            uninit_skill = self.compute_uninitialized(
                metric=metric, comparison=comparison, **metric_kwargs
            )
            skill_labels.append('historical')
        elif 'uninitialized' in reference:
            uninit_skill = self.compute_uninitialized(
                metric=metric, comparison=comparison, **metric_kwargs
            )
github bradyrx / climpred / climpred / classes.py View on Github external
}
        res = self._apply_climpred_function(
            _verify,
            input_dict=input_dict,
            metric=metric,
            comparison=comparison,
            alignment=alignment,
            dim=dim,
            hist=hist,
            reference=reference,
            **metric_kwargs,
        )
        if self._temporally_smoothed:
            if isinstance(res, dict) and not isinstance(res, xr.Dataset):
                for res_key, res_item in res.items():
                    res[res_key] = _reset_temporal_axis(
                        res_item, self._temporally_smoothed, dim='lead'
                    )
            else:
                res = _reset_temporal_axis(res, self._temporally_smoothed, dim='lead')
        return res