argos-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ 09660 049887 24 31 K
2
+ 2013-01-04 08:46:24 1 33 134 214 176
3
+ 04 138 31 82
4
+ 138 108 127 254
5
+ 232 124 02 00
6
+ 127 07 120 17
7
+ 03 163 249 70
8
+ 32 142 252 39
9
+ 00 104 163
10
+ 2013-01-04 08:49:16 1 01 134 248 247
11
+ 11 63 147 127
12
+ 161 208 26 160
13
+ 167 143 248 176
14
+ 13 08 175 128
15
+ 00 00 00 00
16
+ 00 00 08 00
17
+ 08 00 215
18
+ 2013-01-04 08:52:08 1 01 134 220 215
19
+ 10 15 148 248
20
+ 97 195 117 160
21
+ 234 00 00 00
22
+ 00 00 00 13
23
+ 08 175 136 00
24
+ 00 00 108
25
+ 09660 10783 3 3 H 0 2013-12-30 15:20:52 79.866 22.423 0.000 401649712
26
+ 2013-12-30 15:18:56 1 78 08 512
27
+ 2013-12-30 15:22:48 3 78 00 00
@@ -0,0 +1,75 @@
1
+ require 'spec_helper.rb'
2
+
3
+ module Argos
4
+
5
+ describe Diag do
6
+
7
+ VALID_DIAG = File.expand_path(File.dirname(__FILE__)+"/_diag/990660_A.DIA")
8
+
9
+ describe "#type" do
10
+ it do
11
+ Diag.new.type.should == "diag"
12
+ end
13
+ end
14
+
15
+ describe "#parse" do
16
+ before (:each) do
17
+
18
+ @diag = Diag.new
19
+ @diag.log = Logger.new("/dev/null")
20
+ @diag.parse(VALID_DIAG)
21
+ end
22
+
23
+ it "should return Argos::Diag Array" do
24
+ @diag.filter = lambda{|a| true}
25
+ @diag.parse(VALID_DIAG).should be_kind_of Diag
26
+ end
27
+
28
+ describe "#size" do
29
+ it "should == number messages" do
30
+ @diag.size.should == File.read(VALID_DIAG).scan(/Date/i).size #448
31
+ end
32
+ end
33
+
34
+ context "09693 Date : 29.12.99 15:36:28 LC : B IQ : 00
35
+ Lat1 : 78.324N Lon1 : 25.384E Lat2 : 80.326N Lon2 : 30.049E
36
+ Nb mes : 002 Nb mes>-120dB : 000 Best level : -128 dB
37
+ Pass duration : 062s NOPC : 1
38
+ Calcul freq : 401 649594.3 Hz Altitude : 0 m
39
+ 19032 53 352
40
+ " do
41
+ it do
42
+ @diag.parse(VALID_DIAG).select {|diag|
43
+ diag[:measured] == "1999-12-29T15:36:28Z"
44
+ }.first.should == { :platform=>9693, :measured=>"1999-12-29T15:36:28Z", :lc=>"B", :iq=>"00",
45
+ :latitude=>78.324, :longitude=>25.384, :latitude2=>80.326, :longitude2=>30.049,
46
+ :messages=>2, :messages_120dB=>0, :best_level=>-128,
47
+ :pass_duration=>62, :nopc=>1,
48
+ :frequency=>401649594.3, :altitude=>0,
49
+ :sensor_data=>["19032", "53", "352"],
50
+ :li => nil,
51
+ :dist_track => nil,
52
+ :technology=>"argos",
53
+ :type=>"diag",
54
+ :filename=>VALID_DIAG,
55
+ :id => "a4e59580432b7b621f66c0cdc3087127554acd1d",
56
+ :parser => "argos-ruby-#{Argos::VERSION}",
57
+ :source =>"f53ae3ab454f3e210347439aa440c084f775f9a4"}
58
+ end
59
+ end
60
+ end
61
+ #describe '#check_format' do
62
+ # it 'should return true if this is a recognized Diag format' do
63
+ # str ="02170 Date : 03.02.09 17:47:56 LC : 3 IQ : 66 Lat1 : 33.385N Lon1 : 111.811W Lat2 : 35.397N Lon2 : 121.727W Nb mes : 009 Nb mes>-120dB : 000 Best level : -126 dB Pass duration : 811s NOPC : 3 Calcul freq : 401 637664.9 Hz Altitude : 352 m 00 7B 5D E0 C2 51 81 51 14 6A 30 00 3F FC 03 00 03 FF C0 30 00 3F FC 0C 3F FF FF C0"
64
+ # check_format(diag,1).should == true
65
+ # end
66
+ #end
67
+ # it 'should return false if there are errors in the syntax of a Diag data' do
68
+ # diag_with_dateformat_error ="02170 Date : 03.02.094 17:47:56 LC : 3 IQ : 66 Lat1 : 33.385N Lon1 : 111.811W Lat2 : 35.397N Lon2 : 121.727W Nb mes : 009 Nb mes>-120dB : 000 Best level : -126 dB Pass duration : 811s NOPC : 3 Calcul freq : 401 637664.9 Hz Altitude : 352 m 00 7B 5D E0 C2 51 81 51 14 6A 30 00 3F FC 03 00 03 FF C0 30 00 3F FC 0C 3F FF FF C0"
69
+ # res = @diag.check_format(diag_with_dateformat_error,1)
70
+ # res.should == false
71
+ # end
72
+ #end
73
+
74
+ end
75
+ end
@@ -0,0 +1,117 @@
1
+ require 'spec_helper.rb'
2
+
3
+ module Argos
4
+
5
+ describe Ds do
6
+
7
+ VALID_DS = File.expand_path(File.dirname(__FILE__)+"/_ds/990660_A.DAT")
8
+
9
+ before (:each) do
10
+ @ds = Ds.new
11
+ @ds.log = Logger.new("/dev/null")
12
+ @ds.parse(VALID_DS)
13
+ end
14
+
15
+
16
+ describe "#messages" do
17
+ it ".size should == number of messages" do
18
+ @ds.messages.size.should == 449
19
+ end
20
+ end
21
+
22
+ describe "#size" do
23
+ it "should == number of unfolded documents" do
24
+ @ds.size.should == 843
25
+ end
26
+ end
27
+
28
+ describe "#type" do
29
+ it do
30
+ Ds.new.type.should == "ds"
31
+ end
32
+ end
33
+
34
+ describe "#parse" do
35
+
36
+ it "should return Argos::Ds Array" do
37
+ @ds.filter = lambda {|ds|true}
38
+ @ds.parse(VALID_DS).should be_kind_of Ds
39
+ end
40
+
41
+ it "should sort ascending on positioned, measured" do
42
+ positions = @ds.select {|ds|
43
+ ds.key? :positioned and not ds[:positioned].nil?
44
+ }.map {|ds| ds [:positioned] }
45
+ positions.size.should == 340
46
+ positions.first.should == "1999-12-01T10:23:48Z"
47
+ positions.last.should == "1999-12-31T19:18:58Z"
48
+ end
49
+
50
+ it "should create SHA-1 id for each document"
51
+ #id = Digest::SHA1.hexdigest(t.to_json)
52
+
53
+ context "09660 10783 2 3 H A 1999-12-30 18:41:56 79.828 22.319 0.000 401649712
54
+ 1999-12-30 18:43:52 3 78 00 00
55
+ " do
56
+ it do
57
+ @ds.parse(VALID_DS)
58
+ first = @ds.select{ |ds|
59
+ ds[:positioned] == "1999-12-30T18:41:56Z"
60
+ }.should == [{:program=>9660, :platform=>10783, :lines=>2, :sensors=>3, :satellite=>"H", :lc=>"A",
61
+ :positioned=>"1999-12-30T18:41:56Z", :latitude=>79.828,
62
+ :longitude=>22.319, :altitude=>0.0, :headers=>12,
63
+ :measured=>"1999-12-30T18:43:52Z", :identical=>3, :sensor_data=>["78", "00", "00"],
64
+ :technology=>"argos", :type=>"ds", :filename=>VALID_DS, :parser => "argos-ruby-#{Argos::VERSION}",
65
+ :source=>"3a39e0bd0b944dca4f4fbf17bc0680704cde2994", :id=>"4369c31c191bd55a998e6293ff4639da3984a95d"}]
66
+ end
67
+ end
68
+ end
69
+
70
+ describe "filtering" do
71
+
72
+ it "a filter is a lambda that selects messages" do
73
+ @ds.filter = lambda {|ds| ds[:program] == 660 }
74
+ @ds.parse(VALID_DS).size.should == 1
75
+ end
76
+
77
+ it "a filter may also be a string containing a lambda" do
78
+ @ds.filter = 'lambda {|ds| ds[:program] == 660 }'
79
+ @ds.parse(VALID_DS).should == [{:program=>660, :platform=>14747,
80
+ :lines=>2, :sensors=>32, :satellite=>"K", :lc=>nil, :positioned=>nil,
81
+ :latitude=>nil, :longitude=>nil, :altitude=>nil, :headers=>5,
82
+ :measured=>"1999-12-16T00:46:49Z", :identical=>1,
83
+ :sensor_data=>["92", "128", "130", "132"], :technology=>"argos",
84
+ :type=>"ds", :filename=>VALID_DS,
85
+ :source=>"3a39e0bd0b944dca4f4fbf17bc0680704cde2994",
86
+ :warn=>["missing-position", "sensors-count-mismatch"],
87
+ :parser=>"argos-ruby-#{Argos::VERSION}",
88
+ :id=>"f2c82a5ca1330b312925949a15ac300d07452a12"}]
89
+ end
90
+
91
+ end
92
+
93
+ #context "errors" do
94
+
95
+ context "warn" do
96
+
97
+ before(:each) do
98
+ @file = File.expand_path(File.dirname(__FILE__)+"/_ds/sensor_mismatch_ds.txt")
99
+ end
100
+
101
+ it "sensors-count-mismatch" do
102
+ @ds.parse @file
103
+ @ds[1][:warn].should_not include("sensors-count-mismatch")
104
+ @ds[2][:warn].should include("sensors-count-mismatch")
105
+ end
106
+
107
+ it "missing-position" do
108
+ @ds.parse @file
109
+ @ds[0][:warn].should include("missing-position")
110
+ @ds[3][:warn].should == nil
111
+ end
112
+
113
+ end
114
+
115
+
116
+ end
117
+ end
@@ -0,0 +1,14 @@
1
+ require "argos"
2
+
3
+ RSpec.configure do |config|
4
+ # Use color in STDOUT
5
+ config.color_enabled = true
6
+
7
+ # Use color not only in STDOUT but also in pagers and files
8
+ config.tty = true
9
+
10
+ # Use the specified formatter
11
+ config.formatter = :documentation #:progress, :html, :textmate
12
+ end
13
+
14
+
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: argos-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Espen Egeland
9
+ - Conrad Helgeland
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-12-05 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: Parses Argos (http://www.argos-system.org/) DS/DAT and DIAG/DIA files.
32
+ email:
33
+ - data*npolar.no
34
+ executables:
35
+ - argos-ruby
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - .gitignore
40
+ - LICENSE
41
+ - README.md
42
+ - argos-ruby.gemspec
43
+ - bin/argos-ruby
44
+ - lib/argos.rb
45
+ - lib/argos/command.rb
46
+ - lib/argos/diag.rb
47
+ - lib/argos/ds.rb
48
+ - lib/argos/exception.rb
49
+ - spec/argos/_diag/990660_A.DIA
50
+ - spec/argos/_diag/valid_2009-03-02_DB_DIAG.txt
51
+ - spec/argos/_ds/990660_A.DAT
52
+ - spec/argos/_ds/sensor_mismatch_ds.txt
53
+ - spec/argos/diag_spec.rb
54
+ - spec/argos/ds_spec.rb
55
+ - spec/spec_helper.rb
56
+ homepage: http://github.com/npolar/argos-ruby
57
+ licenses:
58
+ - GPL-3.0
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 1.8.25
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Argos satellite tracking data parsers
81
+ test_files: []
82
+ has_rdoc: