esmvaltool/preprocessor/_time_area.py
def time_average(cube):
    """
    Compute time average

    Get the time average over the entire cube. The average is weighted by the
    bounds of the time coordinate.

    Arguments
    ---------
        cube: iris.cube.Cube
            input cube.

    Returns
    -------
    iris.cube.Cube
        time averaged cube.
    """
    time = cube.coord('time')
    # homogeneous time
    time_thickness = time.bounds[..., 1] - time.bounds[..., 0]

    # The weights need to match the dimensionality of the cube.
    slices = [None for i in cube.shape]
    coord_dim = cube.coord_dims('time')[0]
    slices[coord_dim] = slice(None)
    time_thickness = np.abs(time_thickness[tuple(slices)])
    ones = np.ones_like(cube.data)
    time_weights = time_thickness * ones

    return cube.collapsed('time', iris.analysis.MEAN,
                          weights=time_weights)

    Compute time average

    Get the time average over the entire cube. The average is weighted by the
    bounds of the time coordinate.

    Arguments
    ---------
        cube: iris.cube.Cube
            input cube.

    Returns
    -------
    iris.cube.Cube
        time averaged cube.
    
Compute time average
Get the time average over the entire cube. The average is weighted by the
bounds of the time coordinate.

Arguments



Returns


Compute time average Get the time average over the entire cube . The average is weighted by the bounds of the time coordinate . Arguments Returns
def time_average(cube):
    time = cube.coord('time')
    time_thickness = time.bounds[..., 1] - time.bounds[..., 0]
    slices = [None for i in cube.shape]
    coord_dim = cube.coord_dims('time')[0]
    slices[coord_dim] = slice(None)
    time_thickness = np.abs(time_thickness[tuple(slices)])
    ones = np.ones_like(cube.data)
    time_weights = time_thickness * ones
    return cube.collapsed('time', iris.analysis.MEAN,
                          weights=time_weights)
def time_average ( cube ) : time = cube . coord ( 'time' ) time_thickness = time . bounds [ ... , 1 ] - time . bounds [ ... , 0 ] slices = [ None for i in cube . shape ] coord_dim = cube . coord_dims ( 'time' ) [ 0 ] slices [ coord_dim ] = slice ( None ) time_thickness = np . abs ( time_thickness [ tuple ( slices ) ] ) ones = np . ones_like ( cube . data ) time_weights = time_thickness * ones return cube . collapsed ( 'time' , iris . analysis . MEAN , weights = time_weights )
Compute time average
Get the time average over the entire cube.
Compute time average Get the time average over the entire cube .
"""
    Compute time average

    Get the time average over the entire cube. The average is weighted by the
    bounds of the time coordinate.

    Arguments
    ---------
        cube: iris.cube.Cube
            input cube.

    Returns
    -------
    iris.cube.Cube
        time averaged cube.
    """ # homogeneous time # The weights need to match the dimensionality of the cube.
cube