import pandas as pd
import numpy as np
import os 

from .aerosol_absorption_calc import calc_absorption_by_layer as cabl
from .aerosol_optics import aerosol_optics_single as aos

def brc_single_layer_absorption(model_concentration, wavelength, relative_humidity, thickness_layer, **kwargs):
    
    ri_brc = kwargs.get('ri_brc')

    #calculate optical parameters
    optical_parameters = aos( relative_humidity,
                              ['BRC'],
                               wavelength,
                               ri_brc
                               )

    calculated_absorption = cabl(model_concentration*1e-6,
                                 optical_parameters, thickness_layer).sum(axis=1)

    columns = ['AbsBrC']
    final_absorption = pd.DataFrame(calculated_absorption, columns=columns)
    #return absorption in Mm-1
    return final_absorption*1e6