def layer_type(flags):
    """
    Returns the layer type from the feature classification flag

    0 = invalid (bad or missing data)
    1 = "clear air"
    2 = cloud
    3 = aerosol
    4 = stratospheric feature
    5 = surface
    6 = subsurface
    7 = no signal (totally attenuated)

    """
    # type flag : bits 1 to 3
    return flags & 7