def nir_mean(msarr,nir_band=7):
    """
    Calculate the mean of the (unmasked) values of the NIR (near infrared) band
    of an image array. The default `nir_band` value of 7 selects the NIR2 band
    in WorldView-2 imagery. If you're working with a different type of imagery,
    you will need figure out the appropriate value to use instead.

    Parameters
    ----------
    msarr : numpy array (RxCxBands shape)
        The multispectral image array. See `OpticalRS.RasterDS` for more info.
    nir_band : int (Default value = 7)
        The default `nir_band` value of 7 selects the NIR2 band in WorldView-2
        imagery. If you're working with a different type of imagery, you will
        need figure out the appropriate value to use instead. This is a zero
        indexed number (the first band is 0, not 1).

    Returns
    -------
    float
        The mean radiance in the NIR band.
    """
    return msarr[...,nir_band].mean()