The mean pressure weighted function defined here seems to be based on an odd formulation(see code below). Holton(fifth edition ,page 86), and many otheres calculate the sum the of the desired variable multiplied by dp and not by pdp as shown in the code below. Also most authors normalize the result by summation of dp which is sufrace pressure - top pressure. Yet, the code below use sufrace pressure^2 - top pressure^2. Is there is any reference for the formula used below. Thanks
# Taking the integral of the weights (pressure) to feed into the weighting
# function. Said integral works out to this function:
pres_int = 0.5 * (pres_prof[-1] ** 2 - pres_prof[0] ** 2)
# Perform integration on the profile for each variable
return [np.trapz(var_prof * pres_prof, x=pres_prof) / pres_int for var_prof in others]