bme680-python icon indicating copy to clipboard operation
bme680-python copied to clipboard

Altitude and sea level pressure

Open TheOzarkWizard opened this issue 4 years ago • 2 comments

Im needing altitude and sea level pressure parameters. Is there something Im missing?

TheOzarkWizard avatar Jun 12 '21 08:06 TheOzarkWizard

It's simple enough to convert one to the other. Check Wikipedia for the formula.

smurfix avatar Jun 25 '21 11:06 smurfix

I use this code in my project. Seems to work well

# Station altitude in meters
sta_alt = 276.0

# Station pressure to MSL Pressure conversion function
# Formula source: https://gist.github.com/cubapp/23dd4e91814a995b8ff06f406679abcf
def sta_press_to_mslp(sta_press, temp_c):
    mslp = sta_press + ((sta_press * 9.80665 * sta_alt)/(287 * (273 + temp_c + (sta_alt/400))))
    logging.info(f"{mslp:.2f} hPa MSL")
    return mslp

themeadery avatar Jan 03 '24 03:01 themeadery