from typing import OrderedDict


def parse_metadata(text):
    """parse yaml metadata on raster layers
    
    Parameters
    ----------
    text: str
        text in yaml format
        
    Returns
    -------
    OrderedDict:
        layer name: raster attribute number
    """
    text = text.rstrip()
    metadata = OrderedDict()
    for line in text.split('\n'):
        key, val = line.split(':')
        val = int(val)
        #~ print key, val
        metadata[key] = val
    
    return metadata