import pickle


def get_mct_frame(site):

    """Serves up a dataframe of micro-CT SSA data for a given site"""

    # Load a dictionary of dataframes stored as a pickle file
    # The pickle file itself is generated by notebook: CheckOutCT.ipynb

    frames = pickle.load(open('../data/microCT/processed_mCT.p', 'rb'))

    # Select your dataframe from the dictionary by using the site code as the key

    mct_df = frames[site]

    # Drop duplicate samples that have the same average height

    mct_df = mct_df.drop_duplicates(subset='height_ave (cm)',keep="first")

    mct_df.set_index('height_ave (cm)', inplace=True)
    
    return mct_df