1
Index: libgeo-metar-perl/METAR.pm
2
===================================================================
3
--- libgeo-metar-perl.orig/METAR.pm
4
+++ libgeo-metar-perl/METAR.pm
9
-# The pressure, or altimeter setting, at the reporting site recorded in
10
-# inches of mercury (Hg) minus the decimal point. It should always look
12
+# The pressure, or altimeter setting, at the reporting site recorded in whole
13
+# hectopascals (starts with a Q) or inches of mercury (Hg) minus the decimal
14
+# point (starts with an A). It should always look like ([AQ]\d\d\d\d).
16
# KNMI: Q\d\d\d\d pressure in hPa calculated for sea level
18
@@ -354,7 +354,8 @@ sub new
19
$self->{HOURLY_DEW_F} = undef; # hourly dew point, celcius
20
$self->{HOURLY_DEW_C} = undef; # hourly dew point, fahrenheit
21
$self->{HOURLY_PRECIP} = undef; # hourly precipitation
22
- $self->{ALT} = undef; # altimeter setting
23
+ $self->{ALT} = undef; # altimeter setting (Hg)
24
+ $self->{ALT_HP} = undef; # altimeter setting (hPa)
25
$self->{SLP} = undef; # sea level pressure
26
$self->{REMARKS} = undef; # remarks
28
@@ -891,18 +892,14 @@ sub _process
32
- ## is it an altimeter setting?
33
+ ## is it an altimeter setting? (in.Hg)
36
elsif (($parsestate >= $expect_modifier) and ($parsestate < $expect_remarks) and ($tok =~ /^A(\d\d)(\d\d)$/i))
39
- $self->{ALT} = "$1.$2";
41
- # inches Hg pressure. How imperial can you get
42
- # conversion using 'units'
44
- $self->{pressure} = 33.863886 * $self->{ALT};
45
+ $self->{ALT} = "$1.$2"+0;
46
+ $self->{ALT_HP} = "$1.$2" * 33.863886;
48
print "[$tok] is an altimeter setting.\n" if $self->{debug};
49
$parsestate = $expect_recentweather;
50
@@ -910,14 +907,14 @@ sub _process
54
- ## is it a pressure?
55
+ ## is it a pressure? (hPa)
58
elsif (($parsestate >= $expect_modifier) and ($parsestate < $expect_remarks) and ($tok =~ /^Q(\d\d\d\d)$/i))
60
$self->{pressure} = $1;
62
- $self->{ALT} = 0.029529983*$self->{pressure};
63
+ $self->{ALT_HP} = $1;
64
+ $self->{ALT} = 0.029529983 * $self->{pressure};
65
print "[$tok] is an air pressure.\n" if $self->{debug};
66
$parsestate = $expect_recentweather;
68
@@ -1378,7 +1375,8 @@ sub dump
69
print "weather: " . join(', ', @{$self->{weather}}) . "\n";
70
print "sky: " . join(', ', @{$self->{sky}}) . "\n";
71
print "temp_dew: $self->{temp_dew}\n";
72
- print "alt: $self->{ALT}\n";
73
+ print "alt: $self->{alt}\n";
74
+ print "pressure: $self->{pressure}\n";
75
print "slp: $self->{slp}\n";
76
print "remarks: " . join (', ', @{$self->{remarks}}) . "\n";
78
@@ -1668,6 +1666,10 @@ Hourly dewpoint, celcius
80
Altimeter setting (barometric pressure).
84
+Altimeter setting in hectopascals.
88
Any remarks in the report.