esmvaltool/diag_scripts/ocean/diagnostic_tools.py
def bgc_units(cube, name):
    """
    Convert the cubes into some friendlier units.

    This is because many CMIP standard units are not the standard units
    used by the BGC community (ie, Celsius is prefered over Kelvin, etc.)
    """
    new_units = ''

    if name in ['tos', 'thetao']:
        new_units = 'celsius'

    if name in ['no3', ]:
        new_units = 'mmol m-3'

    if name in ['chl', ]:
        new_units = 'mg m-3'

    if name in ['mfo', ]:
        # sverdrup are 1000000 m3.s-1, but mfo is kg s-1.
        new_units = 'Tg s-1'

    if new_units != '':
        logger.info(' '.join(
            ["Changing units from",
             str(cube.units), 'to', new_units]))
        cube.convert_units(new_units)

    return cube

    Convert the cubes into some friendlier units.

    This is because many CMIP standard units are not the standard units
    used by the BGC community (ie, Celsius is prefered over Kelvin, etc.)
    
Convert the cubes into some friendlier units.
This is because many CMIP standard units are not the standard units
used by the BGC community
Convert the cubes into some friendlier units . This is because many CMIP standard units are not the standard units used by the BGC community
def bgc_units(cube, name):
    new_units = ''
    if name in ['tos', 'thetao']:
        new_units = 'celsius'
    if name in ['no3', ]:
        new_units = 'mmol m-3'
    if name in ['chl', ]:
        new_units = 'mg m-3'
    if name in ['mfo', ]:
        new_units = 'Tg s-1'
    if new_units != '':
        logger.info(' '.join(
            ["Changing units from",
             str(cube.units), 'to', new_units]))
        cube.convert_units(new_units)
    return cube
def bgc_units ( cube , name ) : new_units = '' if name in [ 'tos' , 'thetao' ] : new_units = 'celsius' if name in [ 'no3' , ] : new_units = 'mmol m-3' if name in [ 'chl' , ] : new_units = 'mg m-3' if name in [ 'mfo' , ] : new_units = 'Tg s-1' if new_units != '' : logger . info ( ' ' . join ( [ "Changing units from" , str ( cube . units ) , 'to' , new_units ] ) ) cube . convert_units ( new_units ) return cube
Convert the cubes into some friendlier units.
Convert the cubes into some friendlier units .
"""
    Convert the cubes into some friendlier units.

    This is because many CMIP standard units are not the standard units
    used by the BGC community (ie, Celsius is prefered over Kelvin, etc.)
    """ # sverdrup are 1000000 m3.s-1, but mfo is kg s-1.
cube
name