avdata 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ gem "nokogiri"
9
+
10
+ group :development do
11
+ gem "rspec", "~> 2.3.0"
12
+ gem "bundler", "~> 1.0.0"
13
+ gem "jeweler", "~> 1.6.4"
14
+ gem "rcov", ">= 0"
15
+ end
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.6.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ nokogiri (1.5.0)
11
+ rake (0.9.2)
12
+ rcov (0.9.9)
13
+ rspec (2.3.0)
14
+ rspec-core (~> 2.3.0)
15
+ rspec-expectations (~> 2.3.0)
16
+ rspec-mocks (~> 2.3.0)
17
+ rspec-core (2.3.1)
18
+ rspec-expectations (2.3.0)
19
+ diff-lcs (~> 1.1.2)
20
+ rspec-mocks (2.3.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 1.0.0)
27
+ jeweler (~> 1.6.4)
28
+ nokogiri
29
+ rcov
30
+ rspec (~> 2.3.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 simont
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = avdata
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to avdata
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 simont. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "avdata"
18
+ gem.homepage = "http://github.com/simont/avdata"
19
+ gem.license = "MIT"
20
+ gem.summary = "Code to parse the NASR subscription files from the Facility Aeronautical Data Distribution System"
21
+ gem.description = "A gem to parse Aviation data files"
22
+ gem.email = "simon.twigger@preparetotest.com"
23
+ gem.authors = ["Simon Twigger"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "avdata #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.4.0
@@ -0,0 +1,19 @@
1
+
2
+ class Airport_record
3
+
4
+ attr_accessor :location_identifier, :facility_name, :latitude, :longitude, :tower, :icao
5
+
6
+ def initialize(apt_line)
7
+ self.location_identifier = apt_line[27,4].strip
8
+ self.facility_name = apt_line[133,42].strip
9
+ self.latitude = apt_line[515,15].strip
10
+ self.longitude = apt_line[542,15].strip
11
+ self.tower = apt_line[989,1].strip
12
+ self.icao = apt_line[1254,7].strip
13
+ end
14
+
15
+ def has_tower?
16
+ return self.tower == 'Y' ? true : false
17
+ end
18
+
19
+ end
@@ -0,0 +1,51 @@
1
+ require 'iconv'
2
+ require 'airport_record'
3
+ require 'metar_record'
4
+
5
+ class Avdata
6
+
7
+ attr_accessor :directory, :apt_file
8
+
9
+ def initialize args
10
+ args.each do |k,v|
11
+ instance_variable_set("@#{k}", v) unless v.nil?
12
+ end
13
+
14
+ if (self.directory != nil) && (File.directory?(self.directory))
15
+ if File.exists?(File.expand_path('APT.txt', self.directory))
16
+ self.apt_file = File.expand_path('APT.txt', self.directory)
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ def get_airports
23
+ if self.apt_file
24
+ return get_rows(self.apt_file,'APT')
25
+
26
+ else
27
+ return []
28
+ end
29
+
30
+ end
31
+
32
+ def get_rows(file,prefix)
33
+
34
+ results = []
35
+
36
+ f = File.new(file, "r")
37
+ while line = f.gets
38
+
39
+ ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
40
+ valid_line = ic.iconv(line + ' ')[0..-2]
41
+
42
+ if valid_line.match(/^#{prefix}/)
43
+ results << Airport_record.new(valid_line)
44
+ end
45
+ end
46
+
47
+ return results
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,29 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ class Metar_record
5
+
6
+ attr_accessor :station, :url
7
+
8
+ def initialize(stn)
9
+ self.station = stn
10
+ self.url = "http://aviationweather.gov/adds/metars/index.php?station_ids="
11
+ end
12
+
13
+ def adds_url
14
+ return "#{url}#{station.upcase}"
15
+ end
16
+
17
+ def get_xml
18
+ xml = Nokogiri::HTML(open(self.adds_url))
19
+ end
20
+
21
+ def get_metar
22
+ begin
23
+ doc = Nokogiri::HTML(open(adds_url))
24
+ return doc.xpath('//font').first.text
25
+ rescue
26
+ return nil
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Avdata" do
4
+
5
+ it "should be initialized with the download directory" do
6
+ avdata = Avdata.new(:directory => "#{File.dirname(__FILE__)}/files/test_database")
7
+ avdata.directory.should be_a_kind_of(String)
8
+ File.directory?(avdata.directory).should eq true
9
+ end
10
+
11
+ describe "find the key files we need" do
12
+ before(:each) do
13
+ @avdata = Avdata.new(:directory => "#{File.dirname(__FILE__)}/files/test_database")
14
+ end
15
+
16
+ it "should find the APT.txt file" do
17
+ File.exists?(@avdata.apt_file).should == true
18
+ end
19
+
20
+ it "should know when a file doesnt exist" do
21
+ @avdata2 = Avdata.new(:directory => "/")
22
+ @avdata2.apt_file.should == nil
23
+ end
24
+
25
+
26
+ it "should open the APT file and find airport entries" do
27
+ airports = @avdata.get_airports
28
+ airports.should be_a_kind_of(Array)
29
+ airports.should_not be_empty
30
+ airports.size.should == 5
31
+ end
32
+
33
+ it "should return airport objects" do
34
+ airports = @avdata.get_airports
35
+ airports[0].should_not be_a_kind_of(String)
36
+ airports[0].should be_a_kind_of(Airport_record)
37
+ end
38
+
39
+ it "should parse the airport information" do
40
+ airports = @avdata.get_airports
41
+ airports[0].location_identifier.should eq 'ADK'
42
+ airports[0].facility_name.should eq 'ADAK'
43
+ airports[0].latitude.should eq '51-52-40.6700N'
44
+ airports[0].longitude.should eq '176-38-45.7100W'
45
+ airports[0].has_tower?.should eq false
46
+ airports[0].icao.should eq 'PADK'
47
+
48
+ end
49
+
50
+ it "should get metar data" do
51
+ @stn = Metar_record.new('KMWC')
52
+ @stn.get_metar.should be_a_kind_of(String)
53
+ end
54
+
55
+ end
56
+
57
+
58
+
59
+
60
+ end
@@ -0,0 +1,56 @@
1
+ APT50009.*A AIRPORT ADK 06/30/2011AALNONEAKALASKA ALEUTIAN ISLANDS AKADAK ISLAND ADAK PUPUSTATE OF ALASKA-DOTPF-CENTRAL RGN P O BOX 196900 ANCHORAGE, AK 99519 907-269-0751VINCE TUTIAKOFF P O BOX 1952 ADAK, AK 99546 907-592-802651-52-40.6700N 186760.6700N176-38-45.7100W635925.7100WE 18S07E2000 W ALEUTIAN ISLS 00W ZAN ZANANCHORAGE ZAP ZAPANCHORAGE OCEANIC NCDB COLD BAY 907-532-2466 1-800-478-7250 ENA KENAI 1-866-864-1737 PADKY04/1949O I A S 11/2000 N NO OBJECTION NNNY F F0826201001081991A1 NONE NONE NONE NONE DUSK-DAWNN 122.900Y CG 000000000000 000100 00000000000000005000000508/26/2010 HGR CARGO Y PADK
2
+ ATT50009.*A AK 1ALL/ALL/0800-1600
3
+ RWY50009.*A AK05/23 7790 200ASPH-G GRVD HIGH 05 061 Y G 51-52-42.0200N 186762.0200N176-39-26.9800W635966.9800W 17.4 17.4 NNHILL B(V) 10 23 241LOC/GS G 51-53-19.7700N 186799.7700N176-37-38.8600W635858.8600W 15.2 472.75 15.2P4R MALS YNN PIR 50 AVN 06/18/2003 AVN 06/18/2003AVN 06/18/2003 AVN 04/11/2011 AVN 06/18/2003AVN 06/18/2003 AVN 04/11/2011
4
+ RWY50009.*A AK18/36 7605 200ASPH-G GRVD HIGH 18 185 NNPI 51-52-57.7300N 186777.7300N176-38-52.3000W635932.3000W 6.4 9 NN HILL B(V) 9 15600 36 005 YNPI 51-51-43.0600N 186703.0600N176-39-03.7000W635943.7000W 4.3 4.3 NN HILL B(V) 12 10500 AVN 06/18/2003 0.1 AVN 06/18/2003AVN 06/18/2003 AVN 06/18/2003 0.1 AVN 06/18/2003AVN 06/18/2003 AVN 04/11/2011
5
+ RMK50009.*A AKA110-11 PSBL WIND SHEARS LNDG/DEPARTING ALL RYS.
6
+ RMK50009.*A AKA110-14 ALL RWYS GRVD; DO NOT MAKE LOCKED-BRAKE TURNS.
7
+ RMK50009.*A AKA110-17 ARFF INDEX A, ARFF EQUIPMENT STAFFED ONLY DURING AIR CARRIER OPS WITH MORE THAN 30 PASSENGER SEATS.
8
+ RMK50009.*A AKA110-18 DUTY HOURS: 8AM TO 4PM, UNATTENDED AFTER DUTY HOURS.
9
+ RMK50009.*A AKA110-19 ARPT AREA SUBJECT TO MODERATE TO EXTREME CONCENTRATIONS OF BIRDS.
10
+ RMK50009.*A AKA110-20 PERSONNEL AND EQUIPMENT MAY BE WORKING ON THE RWY AT ANY TIME.
11
+ RMK50009.*A AKA110-21 SNOW AND ICE REMOVAL, AND ARPT HAZARDOUS REPORTING ONLY PERFORMED DURING DUTY HRS UNLESS BY PRIOR AGREEMENT IN WRITING WITH ARPT MANAGEMENT.
12
+ RMK50009.*A AKA110-23 RECOMMEND VISUAL INSPECTION OF RUNWAY PRIOR TO USE.
13
+ RMK50009.*A AKA110-25 EXERCISE EXTREME VIGILANCE DURG APCH TO ALL RYS; MOUNTAIN TRRN ALL QUADRANTS.
14
+ RMK50009.*A AKA110-5 VOLCANO 5710 FT MSL 22.3 NM BEARING 059 DEGS.
15
+ RMK50009.*A AKA16 AFTER HOURS PHONE NUMBER 907-572-9960.
16
+ RMK50009.*A AKA26 CLOSED TO AIR CARRIER OPS WITH MORE THAN 30 PASSENGER SEATS EXCEPT PPR IN WRITING TO ARPT MANAGER, P.O. BOX 1952, ADAK, AK 99546.
17
+ RMK50009.*A AKA35-05/23 GWT RY 05/23: S 80, T 145, TT 325, TDT 770.
18
+ RMK50009.*A AKA35-18/36 GWT RY 18/36: S 80, T 145, TT 325, TDT 770.
19
+ RMK50009.*A AKA43-23 UNUSBL BYD 5 DEG LEFT/RIGHT OF CNTRLN.
20
+ RMK50009.*A AKA49-23 NSTD APCH LGTS.
21
+ RMK50009.*A AKA70 FOR FUEL SVC CALL 907-592-8330, AFTER HRS 907-592-2154.
22
+ RMK50009.*A AKA81 ACTVT HIRL RYS 05/23 AND RY 18/36; PAPI AND REIL RY 23 - CTAF.
23
+ APT50016.1*A AIRPORT AKK 06/30/2011AALNONEAKALASKA KODIAK ISLAND AKAKHIOK AKHIOK PUPUST OF AK DOTPF-CEN REG PO BOX 196900 ANCHORAGE, AK 99519-6900 907-269-0767ROBERT GREENE 1500 ANTON LARSON RD. KODIAK, AK 99615 907-487-495256-56-19.2870N 204979.2870N154-10-57.2000W555057.2000WE 44S18E2005 KODIAK 01SW ZAN ZANANCHORAGE NENA KENAI 800-478-3576 1-866-864-1737 AKK Y11/1979O NGY NO OBJECTION NN Y C C06132007 NONE NONE NONE NONE N122.800 122.800Y N 000000000000 001500 000100 12/31/2006NACO 03/18/1997NACO 03/18/1997 Y PAKH
24
+ ATT50016.1*A AK 1UNATNDD
25
+ RWY50016.1*A AK04/22 3120 50GRAVEL-G 04 062 YNSTD G 56-56-11.6760N 204971.6760N154-11-23.6880W555083.6880W 44.1 44 ROAD A(V) 15 32 4950B 22 242 NSTD 56-56-25.9820N 204985.9820N154-10-33.9030W555033.9030W 39.1 44 BRUSH A(V) 15 10 15096L STATE 07/30/2004 0.4 REGION 09/24/2004REGION 09/24/2004 REGION 09/24/2004 0.4 REGION 09/24/2004REGION 09/24/2004 REGION 09/24/2004
26
+ RMK50016.1*A AKA110-1 SAFETY AREA 3600 FT BY 120 FT - ROUGH & UNEVEN - ROCKS TO 4 INCHES.
27
+ RMK50016.1*A AKA110-2 RY CONDITION NOT MONITORED; RECOMMEND VISUAL INSPECTION PRIOR TO LANDING.
28
+ RMK50016.1*A AKA110-3 6 TO 8 INCH RUTS ON APRON.
29
+ RMK50016.1*A AKA110-4 WX CAMERA AVBL ON INTERNET AT HTTP://AKWEATHERCAMS.FAA.GOV
30
+ RMK50016.1*A AKA33-04/22 RY 4/22 NE 1/3 HAS WATER PUDDLES TO 2 IN DEEP.
31
+ RMK50016.1*A AKA42-04 RYS 04 & 22 NSTD MKGS; RYS MKD WITH REFLECTIVE CONES & THLDS MKD WITH REFLECTIVE CONES & REFLECTIVE MKRS.
32
+ APT50017.*A AIRPORT Z13 06/30/2011AALNONEAKALASKA BETHEL AKAKIACHAK AKIACHAK PUPUSTATE OF ALASKA DOT 4111 AVIATION DR ANCHORAGE, AK 99519-6900 907-269-0747BETHEL ARPT MGR 2016 AIRPORT ROAD BETHEL, AK 99559 907-543-249560-54-17.4000N 219257.4000N161-25-20.8000W581120.8000WE 25E19E1985 MC GRATH 00SE ZAN ZANANCHORAGE NENA KENAI 800-478-3576 1-866-864-1737 BET Y01/1968O N NO OBJECTION NNNY C C06122009 NONE NONE NONE NONE N 122.900N N 000000000000 003000 08/26/2005NGS 08/09/2001 CARGO Y
33
+ ATT50017.*A AK 1UNATNDD
34
+ RWY50017.*A AK11/29 1649 40GRVL-F 11 117 N 60-54-21.0814N 219261.0814N161-25-35.5370W581135.5370W 22.2 ROAD A(V) 2 15 35130L/R 29 297 N 60-54-13.7393N 219253.7393N161-25-05.9937W581105.9937W 22.8 TREES A(V) 5 20 11275R NGS 08/09/2001 0.0 NGS 08/09/2001NGS 0.0 NGS 08/09/2001NGS
35
+ RMK50017.*A AKA110*G THIS AIRPORT HAS BEEN SURVEYED BY THE NATIONAL GEODETIC SURVEY.
36
+ RMK50017.*A AKA110-1 RY COND NOT MONITORED; RCMD VISUAL INSPECTION PRIOR TO USING.
37
+ RMK50017.*A AKA110-5 WX CAMERA AVBL ON INTERNET AT HTTP://AKWEATHERCAMS.FAA.GOV
38
+ RMK50017.*A AKA30-11/29 ACTIVE ROAD CROSSING RY 11 APCH END .
39
+ RMK50017.*A AKA83 WINDSOCK CLOSE TO TREES AND UNRELIABLE.
40
+ APT50017.1*C SEAPLANE BASEKKI 06/30/2011AALNONEAKALASKA BETHEL AKAKIACHAK AKIACHAK PUPUPUBLIC DOMAIN NONE 60-54-28.3130N 219268.3130N161-26-06.2780W581166.2780WE 18E19E1985 MC GRATH 00S ZAN ZANANCHORAGE NENA KENAI 800-478-3576 1-866-864-1737 BET Y07/1966O NO OBJECTION NNNN S C09022006 NONE NONE NONE NONE N 122.900N N 12/31/2005 N
41
+ ATT50017.1*C AK 1UNATNDD
42
+ RWY50017.1*C AKE/W 5000 300WATER E NNONE 0.0 N NNN 50 W NNONE 0.0 N NNN 50 0.0 0.0
43
+ RWY50017.1*C AKNW/SE 5000 500WATER NW NNONE 0.0 N NNN 50 SE NNONE 0.0 N NNN 50 0.0 0.0
44
+ RMK50017.1*C AKA110-1 NO SERVICES OR DOCK. BEACHING AREA ADJACENT TO VILLAGE.
45
+ RMK50017.1*C AKA110-2 WX CAMERA AVBL ON INTERNET AT HTTP://AKWEATHERCAMS.FAA.GOV
46
+ RMK50017.1*C AKA30-NW/SE SEAPLANES LND NW-SE IN LAGOON; TKOF E-W IN RIVER.
47
+ RMK50017.1*C AKA83 WINDSOCK AT ARPT FOR SPB.
48
+ APT50020.*A AIRPORT AKI 06/30/2011AALNONEAKALASKA BETHEL AKAKIAK AKIAK PUPUSTATE OF AK DOTPF CENTRAL RGN PO BOX 196900 ANCHORAGE, AK 99519-6900 907-269-0747DAVID CUMMINGS P O BOX 505 BETHEL, AK 99559 907-543-249560-54-10.4000N 219250.4000N161-13-50.1000W580430.1000WE 30E16E2005 MC GRATH 00SW 59ZAN ZANANCHORAGE NENA KENAI 800-478-3576 1-866-864-1737 BET Y07/1966O N1 NO OBJECTION NNNY C C05302009 NONE NONE NONE NONE DUSK-DAWNN 122.900Y CG N 001000000000 08/26/2005NGS 08/09/2001NGS 08/09/2001 CARGO Y-LPFAK
49
+ ATT50020.*A AK 1UNATNDD
50
+ RWY50020.*A AK03/21 3196 75GRVL-G MED 03 047 NNSTD 60-53-59.6828N 219239.6828N161-14-13.7787W580453.7787W 30.4 TREES A(NP)14 53 7630B 21 227 N 60-54-21.1406N 219261.1406N161-13-26.4960W580406.4960W 30.4 TREE A(NP)28 40 114510L NGS 08/09/2001 0.3 NGS 08/09/2001NGS 08/09/2001 0.3 NGS 08/09/2001NGS 08/09/2001
51
+ RMK50020.*A AKA110*G THIS AIRPORT HAS BEEN SURVEYED BY THE NATIONAL GEODETIC SURVEY.
52
+ RMK50020.*A AKA110-2 RY COND NOT MONITORED; RCMD VISUAL INSPECTION PRIOR TO USING.
53
+ RMK50020.*A AKA110-3 WINDSOCK UNRELIABLE.
54
+ RMK50020.*A AKA110-4 WX CAMERA AVBL ON INTERNET AT HTTP://AKWEATHERCAMS.FAA.GOV
55
+ RMK50020.*A AKA42-03 RYS 03 & 21 NSTD MKGS; RYS MKD WITH CONES & REFLECTIVE THLD PANELS.
56
+ RMK50020.*A AKA81 ACTVT MIRL RY 03/21 - CTAF.
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
2
+ <HTML>
3
+ <HEAD>
4
+ <TITLE>ADDS - METARs form results</TITLE>
5
+ <LINK REL="StyleSheet" type="text/css" HREF="/adds/layout/ops/mystyle.css">
6
+ </HEAD>
7
+ <BODY BGCOLOR="#FFFFFF">
8
+ <TABLE SUMMARY="This table is used for formatting purposes only" BORDER=0 CELLPADDING=3 CELLSPACING=0>
9
+ <TR VALIGN="top">
10
+ <TD ALIGN="left" COLSPAN="2">
11
+ <H2>Aviation Digital Data Service (ADDS)</H2>
12
+
13
+ Output produced by METARs form (1719&#160;UTC&nbsp;12 July 2011)<BR>
14
+ found at <A HREF="/adds/metars/index.php"> http://aviationweather.gov/adds/metars/index.php</A><BR>&#160;<BR>
15
+ </TD>
16
+ </TR>
17
+ <TR VALIGN="top">
18
+ <TD ALIGN="left" COLSPAN="2">
19
+
20
+ <FONT FACE="Monospace,Courier">KMWC 121645Z 13005KT 10SM SCT045 26/13 A2999</FONT><BR>
21
+ </TD>
22
+ </TR>
23
+ </TABLE>
24
+ </BODY>
25
+ </HTML>
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Metar" do
4
+
5
+ it "should be initialized with the station id" do
6
+ metar = Metar_record.new('KMWC')
7
+ metar.station.should eq "KMWC"
8
+ end
9
+
10
+ describe "Download and parse XML from NWS" do
11
+
12
+ before(:each) do
13
+ @stn = Metar_record.new('KMWC')
14
+ end
15
+
16
+ it "should get the XML document from the server" do
17
+ @stn.adds_url.should eq "http://aviationweather.gov/adds/metars/index.php?station_ids=KMWC"
18
+ @stn.get_xml.should be_a_kind_of(Nokogiri::HTML::Document)
19
+ @stn.get_metar.should be_a_kind_of(String)
20
+ # should have something to read/parse the METAR data itself.
21
+ end
22
+
23
+ it "should fail gracefully" do
24
+ @new_stn = Metar_record.new('XZXX')
25
+ @new_stn.adds_url.should eq "http://aviationweather.gov/adds/metars/index.php?station_ids=XZXX"
26
+ @new_stn.get_xml.should be_a_kind_of(Nokogiri::HTML::Document)
27
+ @new_stn.get_metar.should eq nil
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'avdata'
5
+ require 'metar_record'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc,
8
+ # in ./support/ and its subdirectories.
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+
13
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avdata
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
+ platform: ruby
11
+ authors:
12
+ - Simon Twigger
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-07-19 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: nokogiri
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 2
42
+ - 3
43
+ - 0
44
+ version: 2.3.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 0
58
+ - 0
59
+ version: 1.0.0
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: jeweler
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 6
73
+ - 4
74
+ version: 1.6.4
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: rcov
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *id005
91
+ description: A gem to parse Aviation data files
92
+ email: simon.twigger@preparetotest.com
93
+ executables: []
94
+
95
+ extensions: []
96
+
97
+ extra_rdoc_files:
98
+ - LICENSE.txt
99
+ - README.rdoc
100
+ files:
101
+ - .document
102
+ - .rspec
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.rdoc
107
+ - Rakefile
108
+ - VERSION
109
+ - lib/airport_record.rb
110
+ - lib/avdata.rb
111
+ - lib/metar_record.rb
112
+ - spec/avdata_spec.rb
113
+ - spec/files/test_database/APT.txt
114
+ - spec/files/test_metar.html
115
+ - spec/metar_spec.rb
116
+ - spec/spec_helper.rb
117
+ has_rdoc: true
118
+ homepage: http://github.com/simont/avdata
119
+ licenses:
120
+ - MIT
121
+ post_install_message:
122
+ rdoc_options: []
123
+
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ hash: -2755643018869823453
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ requirements: []
144
+
145
+ rubyforge_project:
146
+ rubygems_version: 1.3.7
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: Code to parse the NASR subscription files from the Facility Aeronautical Data Distribution System
150
+ test_files: []
151
+