aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarved <arved@FreeBSD.org>2004-09-04 02:43:23 +0800
committerarved <arved@FreeBSD.org>2004-09-04 02:43:23 +0800
commit7a94beb7bd86d52b2cabb6443ddc077e81d8953d (patch)
tree2d8041b513d529b1c2b8bcfae52bb4e103660dcb
parent47f54647d52a08e932d42a918780f677f802ee3b (diff)
downloadfreebsd-ports-gnome-7a94beb7bd86d52b2cabb6443ddc077e81d8953d.tar.gz
freebsd-ports-gnome-7a94beb7bd86d52b2cabb6443ddc077e81d8953d.tar.zst
freebsd-ports-gnome-7a94beb7bd86d52b2cabb6443ddc077e81d8953d.zip
- Support the "CAVOK" string: "Ceiling and visibility OK"
- Support the "9999" string: visibility > 10km - All the world is not North America - Support Pressure values in hectopascals - Support weather stations outside of North America: Move Station ID detection out of the token parser loop - Bump PORTREVISION and take Maintainership
-rw-r--r--astro/p5-Geo-METAR/Makefile3
-rw-r--r--astro/p5-Geo-METAR/files/patch-METAR.pm180
2 files changed, 182 insertions, 1 deletions
diff --git a/astro/p5-Geo-METAR/Makefile b/astro/p5-Geo-METAR/Makefile
index 9510cbc4fdab..9c4c524989ab 100644
--- a/astro/p5-Geo-METAR/Makefile
+++ b/astro/p5-Geo-METAR/Makefile
@@ -7,12 +7,13 @@
PORTNAME= Geo-METAR
PORTVERSION= 1.14
+PORTREVISION= 1
CATEGORIES= astro
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= Geo
PKGNAMEPREFIX= p5-
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= arved@FreeBSD.org
COMMENT= A perl module that processes METAR information from NOAA sources
PERL_CONFIGURE= yes
diff --git a/astro/p5-Geo-METAR/files/patch-METAR.pm b/astro/p5-Geo-METAR/files/patch-METAR.pm
new file mode 100644
index 000000000000..2dc232bf33c2
--- /dev/null
+++ b/astro/p5-Geo-METAR/files/patch-METAR.pm
@@ -0,0 +1,180 @@
+--- METAR.pm.orig Sat Nov 25 01:07:51 2000
++++ METAR.pm Fri Sep 3 20:33:01 2004
+@@ -95,9 +95,13 @@
+
+ # PRESSURE
+ #
++# USA and Canada:
+ # The pressure, or altimeter setting, at the reporting site recorded in
+ # inches of mercury (Hg) minus the decimal point. It should always look
+ # like (A\d\d\d\d).
++# Rest of the World:
++# The pressure, or altimeter setting, at the reporting site recorded in
++# hectopascals(hPa). It should always look like (Q\d\d\d\d).
+
+ # REMARKS
+ #
+@@ -164,6 +168,7 @@
+ my %_sky_types = (
+ SKC => "Sky Clear",
+ CLR => "Sky Clear",
++ CAVOK => "Sky Clear",
+ SCT => "Scattered",
+ BKN => "Broken",
+ FEW => "Few",
+@@ -366,52 +371,87 @@
+ $self->{type} = "METAR";
+ $self->{TYPE} = "Routine Weather Report";
+
+- while (defined($tok = shift(@toks))) ## as long as there are tokens
++ $tok = shift(@toks);
++ print "trying to match [$tok]\n" if $self->{debug};
++
++ ##
++ ## is it a report type?
++ ##
++
++ if (($tok =~ /METAR/i) or ($tok =~ /SPECI/i))
+ {
++ $self->{type} = $tok;
++
++ if ($self->{type} eq "METAR")
++ {
++ $self->{TYPE} = "Routine Weather Report";
++ }
++ elsif ($self->{type} eq "SPECI")
++ {
++ $self->{TYPE} = "Special Weather Report";
++ }
++ print "[$tok] is a report type.\n" if $self->{debug};
++
++ $tok = shift(@toks);
+ print "trying to match [$tok]\n" if $self->{debug};
+
+ ##
+- ## is it a report type?
++ ## is it a site ID?
+ ##
+
+- if (($tok =~ /METAR/i) or ($tok =~ /SPECI/i))
++ if ($tok =~ /[A-Z]{4,4}/)
+ {
+- $self->{type} = $tok;
+-
+- if ($self->{type} eq "METAR")
+- {
+- $self->{TYPE} = "Routine Weather Report";
+- }
+- elsif ($self->{type} eq "SPECI")
+- {
+- $self->{TYPE} = "Special Weather Report";
+- }
+- print "[$tok] is a report type.\n" if $self->{debug};
+- next;
++ $self->{site} = $tok;
++ print "[$tok] is a site ID.\n" if $self->{debug};
+ }
+
+ ##
+- ## is is a site ID?
++ ## Most likely something is wrong, but to be sure put the token back
++ ## on the stack
+ ##
+
+- elsif ($tok =~ /K[A-Z]{3,3}/)
++ else
+ {
+- $self->{site} = $tok;
+- print "[$tok] is a site ID.\n" if $self->{debug};
+- next;
++ unshift(@toks,$tok);
+ }
+
++ }
++
++ ##
++ ## is it a site ID?
++ ##
++
++ elsif ($tok =~ /[A-Z]{4,4}/)
++ {
++ $self->{site} = $tok;
++ print "[$tok] is a site ID.\n" if $self->{debug};
++ }
++
++ ##
++ ## Most likely something is wrong, but to be sure put the token back
++ ## on the stack
++ ##
++
++ else
++ {
++ unshift(@toks,$tok);
++ }
++
++ # The order of the remaining stack is not defined, so do a patternmatching loop
++
++ while (defined($tok = shift(@toks))) ## as long as there are tokens
++ {
++ print "trying to match [$tok]\n" if $self->{debug};
++
+ ##
+ ## is it a date/time?
+ ##
+
+- elsif ($tok =~ /\d{6,6}Z/i)
++ if ($tok =~ /\d{6,6}Z/i)
+ {
+ $self->{date_time} = $tok;
+ print "[$tok] is a date/time.\n" if $self->{debug};
+ next;
+-
+-
+ }
+
+ ##
+@@ -447,6 +487,14 @@
+ next;
+ }
+
++ ## 9999 == visibility is better than 10 km
++ elsif ($tok eq "9999")
++ {
++ $self->{visibility} = $tok;
++ print "[$tok] is visibility information.\n" if $self->{debug};
++ next;
++ }
++
+ ##
+ ## is it visibility information with a leading digit?
+ ##
+@@ -526,7 +574,7 @@
+ ## is it sky conditions (clear)?
+ ##
+
+- elsif ( $tok eq "SKC" || $tok eq "CLR" )
++ elsif ( $tok eq "SKC" || $tok eq "CLR" || $tok eq "CAVOK")
+ {
+ push(@{$self->{sky}},$tok);
+ push(@{$self->{SKY}}, "Sky Clear");
+@@ -588,10 +636,20 @@
+ ## is it an altimeter setting?
+ ##
+
++ ## Northamerican setting in inches
+ elsif (!$in_remarks && $tok =~ /^A(\d\d)(\d\d)$/i)
+ {
+ $self->{alt} = $tok;
+ $self->{ALT} = "$1.$2";
++ print "[$tok] is an altimeter setting.\n" if $self->{debug};
++ next;
++ }
++
++ ## setting in hectopascals (hPa)
++ elsif (!$in_remarks && $tok =~ /^Q(\d\d)(\d\d)$/i)
++ {
++ $self->{alt} = $tok;
++ $self->{ALT} = "$1$2";
+ print "[$tok] is an altimeter setting.\n" if $self->{debug};
+ next;
+ }