ocw/utils.py
def calculate_ensemble_temporal_trends(timeseries_array, number_of_samples=1000):
    ''' Calculate temporal trends in an ensemble of time series
    :param timeseries_array: Two dimensional array. 1st index: model, 2nd index: time.
    :type timeseries_array: :class:`numpy.ndarray`

    :param sampling: A list whose elements are one-dimensional numpy arrays
    :type timeseries_array: :class:`list`

    :returns: temporal trend and estimated error from bootstrapping
    :rtype: :class:`float`, :class:`float`
    '''

    nmodels, nt = timeseries_array.shape
    x = np.arange(nt)
    sampled_trend = np.zeros(number_of_samples)
    ensemble_trend, _ = calculate_temporal_trend_of_time_series(
                        x, np.mean(timeseries_array, axis=0))

    for isample in np.arange(number_of_samples):
        index = np.random.choice(nmodels, size=nmodels, replace=True)
        random_ensemble = np.mean(timeseries_array[index, :], axis=0)
        sampled_trend[isample], _ = calculate_temporal_trend_of_time_series(
                                    x, random_ensemble)
    return ensemble_trend, np.std(sampled_trend, ddof=1)
 Calculate temporal trends in an ensemble of time series
    :param timeseries_array: Two dimensional array. 1st index: model, 2nd index: time.
    :type timeseries_array: :class:`numpy.ndarray`

    :param sampling: A list whose elements are one-dimensional numpy arrays
    :type timeseries_array: :class:`list`

    :returns: temporal trend and estimated error from bootstrapping
    :rtype: :class:`float`, :class:`float`
    
Calculate temporal trends in an ensemble of time series
Calculate temporal trends in an ensemble of time series
def calculate_ensemble_temporal_trends(timeseries_array, number_of_samples=1000):
    nmodels, nt = timeseries_array.shape
    x = np.arange(nt)
    sampled_trend = np.zeros(number_of_samples)
    ensemble_trend, _ = calculate_temporal_trend_of_time_series(
                        x, np.mean(timeseries_array, axis=0))
    for isample in np.arange(number_of_samples):
        index = np.random.choice(nmodels, size=nmodels, replace=True)
        random_ensemble = np.mean(timeseries_array[index, :], axis=0)
        sampled_trend[isample], _ = calculate_temporal_trend_of_time_series(
                                    x, random_ensemble)
    return ensemble_trend, np.std(sampled_trend, ddof=1)
def calculate_ensemble_temporal_trends ( timeseries_array , number_of_samples = 1000 ) : nmodels , nt = timeseries_array . shape x = np . arange ( nt ) sampled_trend = np . zeros ( number_of_samples ) ensemble_trend , _ = calculate_temporal_trend_of_time_series ( x , np . mean ( timeseries_array , axis = 0 ) ) for isample in np . arange ( number_of_samples ) : index = np . random . choice ( nmodels , size = nmodels , replace = True ) random_ensemble = np . mean ( timeseries_array [ index , : ] , axis = 0 ) sampled_trend [ isample ] , _ = calculate_temporal_trend_of_time_series ( x , random_ensemble ) return ensemble_trend , np . std ( sampled_trend , ddof = 1 )
Calculate temporal trends in an ensemble of time series
Calculate temporal trends in an ensemble of time series
''' Calculate temporal trends in an ensemble of time series
    :param timeseries_array: Two dimensional array. 1st index: model, 2nd index: time.
    :type timeseries_array: :class:`numpy.ndarray`

    :param sampling: A list whose elements are one-dimensional numpy arrays
    :type timeseries_array: :class:`list`

    :returns: temporal trend and estimated error from bootstrapping
    :rtype: :class:`float`, :class:`float`
    '''
temporal trend and estimated error from bootstrapping
temporal trend and estimated error from bootstrapping
:class:`float`, :class:`float`
timeseries_array
Two dimensional array. 1st index: model, 2nd index: time.
Two dimensional array . 1st index : model 2nd index : time .
number_of_samples
sampling
A list whose elements are one-dimensional numpy arrays
A list whose elements are one - dimensional numpy arrays