Calculate body composition component percentages based on % lipid

    Calculation of percent protein and percent ash are based on those presented
    in Reilly and Fedak (1990).

    Args
    ----
    perc_lipid: float or ndarray
        1D array of percent lipid values from which to calculate body composition
    perc_water: float or ndarray
        1D array of percent water values from which to calculate body
        composition (Default `None`). If no values are passed, calculations are
        performed with values from Biuw et al. (2003).

    Returns
    -------
    perc_water: float or ndarray
        1D array of percent water values
    perc_protein: float or ndarray
        1D array of percent protein values
    perc_ash: float or ndarray
        1D array of percent ash values

    References
    ----------
    Biuw, M., 2003. Blubber and buoyancy: monitoring the body condition of
    free-ranging seals using simple dive characteristics. Journal of
    Experimental Biology 206, 3405–3423. doi:10.1242/jeb.00583

    Reilly, J.J., Fedak, M.A., 1990. Measurement of the body composition of
    living gray seals by hydrogen isotope dilution. Journal of Applied
    Physiology 69, 885–891.

def perc_bc_from_lipid(perc_lipid, perc_water=None):
    '''Calculate body composition component percentages based on % lipid

    Calculation of percent protein and percent ash are based on those presented
    in Reilly and Fedak (1990).

    Args
    ----
    perc_lipid: float or ndarray
        1D array of percent lipid values from which to calculate body composition
    perc_water: float or ndarray
        1D array of percent water values from which to calculate body
        composition (Default `None`). If no values are passed, calculations are
        performed with values from Biuw et al. (2003).

    Returns
    -------
    perc_water: float or ndarray
        1D array of percent water values
    perc_protein: float or ndarray
        1D array of percent protein values
    perc_ash: float or ndarray
        1D array of percent ash values

    References
    ----------
    Biuw, M., 2003. Blubber and buoyancy: monitoring the body condition of
    free-ranging seals using simple dive characteristics. Journal of
    Experimental Biology 206, 3405–3423. doi:10.1242/jeb.00583

    Reilly, J.J., Fedak, M.A., 1990. Measurement of the body composition of
    living gray seals by hydrogen isotope dilution. Journal of Applied
    Physiology 69, 885–891.
    '''
    import numpy

    # Cast iterables to numpy arrays
    if numpy.iterable(perc_lipid):
        perc_lipid = numpy.asarray(perc_lipid)
    if numpy.iterable(perc_water):
        perc_water = numpy.asarray(perc_water)

    if not perc_water:
        # TODO check where `perc_water` values come from
        perc_water   = 71.4966 - (0.6802721 * perc_lipid)

    perc_protein = (0.42 * perc_water) - 4.75
    perc_ash     = 100 - (perc_lipid + perc_water + perc_protein)

    return perc_water, perc_protein, perc_ash