
import pandas as pd 

def calc_absorption_by_layer(model_conc, optical_parameters, thickness_layer, aerosol):
    """
    Calculate Absorption of Aerosol Layer

    Parameters:
    model_conc (float): Concentration of aerosol layer
    optical_parameters (dict): Optical parameters of aerosol layer
    thickness_layer (float): Thickness of aerosol layer

    Returns:
    float: Absorption of aerosol layer
    """
    model_conc = model_conc[0]*1e-6

    #aerosolconc = model_conc.columns.tolist()

    absorption = ((3.0* (optical_parameters[aerosol]['qext'] - optical_parameters[aerosol]['qsca']) * optical_parameters[aerosol]['vphi']) / 
                (4.0 * optical_parameters[aerosol]['dens'] * optical_parameters[aerosol]['reff'])) * model_conc * thickness_layer

    return absorption*1e6
