import pkg_resources
import json


def load_vocabularies(project):
    """Load project vocabularies from json file.

    Load from project json data files all accepted values for facets.

    Args:
        project (str): data project

    Returns:
        a series of lists (list): one for each facets, elements are accepted values 

    """
    project = project.upper()
    if project.split('-')[0] == 'CORDEX':
        project = 'CORDEX'
        #vocab = get_esgf_facets('CORDEX')
        #vocab['frequency'] = vocab['time_frequency']
        #vocab['attributes'] = [k for k in vocab.keys()]
    vfile = pkg_resources.resource_filename(__name__, 'data/'+project+'_validation.json')
    with open(vfile, 'r') as f:
        data = f.read()
        vocab = json.loads(data)
    return vocab