Find your local airport code (for example: Heathrow is EGLL, Farnborough is EGLF).
Feed that into
http://www.aviationweather.gov/metar?gis=off (check the decoded box) that gives you the local "official" reading from your local national weather service.
From the METAR you have a MSL value
Code: Select all
METAR for: EGLL (London/Heathrow Intl, --, UK)
Text: EGLL 162020Z AUTO 23014KT 9999 BKN036 15/09 Q1017
Temperature: 15.0°C ( 59°F)
Dewpoint: 9.0°C ( 48°F) [RH = 67%]
Pressure (altimeter): 30.03 inches Hg (1017.0 mb)
Winds: from the SW (230 degrees) at 16 MPH (14 knots; 7.2 m/s)
Visibility: 6 or more sm (10+ km)
Ceiling: 3600 feet AGL
Clouds: broken clouds at 3600 feet AGL
it's the Q value in the RAW METAR data.
Get your elevation using a GPS receiver.
Run this code (you need two values, it returns the third)
Code: Select all
#!/usr/bin/python
import math
import sys
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--elevation')
parser.add_argument('-p', '--pressure')
parser.add_argument('-m', '--msl')
args = parser.parse_args()
if args.elevation is None:
args.elevation = 112.2 # Value from my GPS for my house
if args.pressure is None:
print "Pressure value required"
sys.exit(40)
if args.msl is None:
args.msl = 1013.25
args.pressure = float(args.pressure)
args.elevation = float(args.elevation)
args.msl = float(args.msl)
print "Elev:", args.elevation, "Pressure:", args.pressure, "MSL:", args.msl
print "Sealevel:",args.pressure/pow(1-(args.elevation/44330.0),5.255)
print "Elev:",(44330.0*(1-pow(args.pressure/args.msl,1/5.255)))
NOTE: change line# 13 (my default elevation is 112.2m) or you will get invalid output.
pi@beaufort:/tmp$ ./msl_pressure.py -e 112.2 -p 1004.72
Elev: 112.2 Pressure: 1004.72 MSL: 1013.25
Sealevel: 1018.18970592
Elev: 71.2594761739
pi@beaufort:/tmp$ ./msl_pressure.py -m 1018.19 -p 1004.72
Elev: 112.2 Pressure: 1004.72 MSL: 1018.19
Sealevel: 1018.18970592
Elev: 112.20243034
pi@beaufort:/tmp$
Depending which value(s) (-e & -p or -m & -p) you give it my ugly program returns the missing value (msl or elev). In all cases we're using an absolute (local at altitude) pressure reading from your sensor.