argos-ruby 1.0.3 → 1.0.4
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.
- data/.gitignore +3 -1
- data/Gemfile +15 -0
- data/README.md +66 -35
- data/bin/argos-ruby +1 -0
- data/lib/argos.rb +1 -1
- data/lib/argos/command.rb +6 -0
- data/lib/argos/diag.rb +4 -3
- data/lib/argos/ds.rb +3 -2
- data/spec/argos/_ds/fragment.ds +3 -0
- data/spec/argos/diag_spec.rb +1 -0
- data/spec/argos/ds_spec.rb +5 -2
- metadata +4 -3
data/.gitignore
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "yajl-ruby", git: "git://github.com/brianmario/yajl-ruby.git"
|
4
|
+
gem "uuidtools"
|
5
|
+
gem "hashie", git: "git://github.com/intridea/hashie.git"
|
6
|
+
#gem "json-schema", git: "git://github.com/hoxworth/json-schema.git"
|
7
|
+
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem "thin"
|
11
|
+
gem "shotgun"
|
12
|
+
gem "rspec"
|
13
|
+
gem "simplecov"
|
14
|
+
gem "ruby-prof"
|
15
|
+
end
|
data/README.md
CHANGED
@@ -1,60 +1,91 @@
|
|
1
1
|
# argos-ruby
|
2
2
|
|
3
|
-
A Ruby library for parsing Argos tracking data
|
3
|
+
A Ruby library and command-line tool for parsing Argos tracking data files.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
(http://npolar.no/en) since 1989.
|
8
|
-
|
9
|
-
Be warned, the Argos file formats have changed over time. No promises are
|
10
|
-
made that the library will work outside of Norway :).
|
11
|
-
|
12
|
-
Currently, the library parses Argos DS/DIAG files dating from August 1990
|
13
|
-
and onwards.
|
14
|
-
|
15
|
-
## Install
|
16
|
-
$ gem install argos-ruby
|
17
|
-
|
18
|
-
## Command-line usage
|
5
|
+
## Usage
|
6
|
+
### DS/DIAG to JSON
|
19
7
|
|
8
|
+
```argos-ruby``` converts Argos files to JSON. DS header data is repeated in each message
|
20
9
|
```sh
|
21
|
-
|
22
|
-
|
10
|
+
curl "https://raw.github.com/npolar/argos-ruby/master/spec/argos/_ds/fragment.ds" > /tmp/fragment.ds
|
11
|
+
argos-ruby /tmp/fragment.ds
|
23
12
|
```
|
24
|
-
JSON output (shortened)
|
25
|
-
|
26
13
|
```json
|
27
|
-
[
|
14
|
+
[
|
15
|
+
{
|
16
|
+
"program": 9660,
|
17
|
+
"platform": 10783,
|
18
|
+
"lines": 3,
|
19
|
+
"sensors": 3,
|
20
|
+
"satellite": "K",
|
21
|
+
"lc": "3",
|
22
|
+
"positioned": "1999-12-30T17:58:26Z",
|
23
|
+
"latitude": 79.824,
|
24
|
+
"longitude": 22.363,
|
25
|
+
"altitude": 0.0,
|
26
|
+
"headers": 12,
|
27
|
+
"measured": "1999-12-30T17:56:30Z",
|
28
|
+
"identical": 2,
|
29
|
+
"sensor_data": [
|
30
|
+
"78",
|
31
|
+
"00",
|
32
|
+
"00"
|
33
|
+
],
|
34
|
+
"technology": "argos",
|
35
|
+
"type": "ds",
|
36
|
+
"location": "file:///tmp/fragment.ds",
|
37
|
+
"source": "a9c02cf81978a9fafecac582309c7c8161e5a76c",
|
38
|
+
"parser": "argos-ruby-1.0.4",
|
39
|
+
"id": "2d833010d13714dfb771f73470417405b887e8f4",
|
40
|
+
"bundle": "bc30f5e5733087f730202bea53fa730092a192e3"
|
41
|
+
},
|
28
42
|
{
|
29
43
|
"program": 9660,
|
30
|
-
"platform":
|
44
|
+
"platform": 10783,
|
31
45
|
"lines": 3,
|
32
46
|
"sensors": 3,
|
33
47
|
"satellite": "K",
|
34
|
-
"lc": "
|
35
|
-
"positioned": "1999-12-
|
36
|
-
"latitude":
|
37
|
-
"longitude":
|
48
|
+
"lc": "3",
|
49
|
+
"positioned": "1999-12-30T17:58:26Z",
|
50
|
+
"latitude": 79.824,
|
51
|
+
"longitude": 22.363,
|
38
52
|
"altitude": 0.0,
|
39
53
|
"headers": 12,
|
40
|
-
"measured": "1999-12-
|
41
|
-
"identical":
|
54
|
+
"measured": "1999-12-30T18:01:20Z",
|
55
|
+
"identical": 5,
|
42
56
|
"sensor_data": [
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
57
|
+
"78",
|
58
|
+
"00",
|
59
|
+
"00"
|
46
60
|
],
|
47
61
|
"technology": "argos",
|
48
62
|
"type": "ds",
|
49
|
-
"location": "file:///tmp/
|
50
|
-
"source": "
|
51
|
-
"parser": "argos-ruby-1.0.
|
52
|
-
"id": "
|
63
|
+
"location": "file:///tmp/fragment.ds",
|
64
|
+
"source": "a9c02cf81978a9fafecac582309c7c8161e5a76c",
|
65
|
+
"parser": "argos-ruby-1.0.4",
|
66
|
+
"id": "26af9092d01fbd49ff8cb9041e63df352886dba6",
|
67
|
+
"bundle": "bc30f5e5733087f730202bea53fa730092a192e3"
|
53
68
|
}
|
54
69
|
]
|
55
70
|
|
56
71
|
```
|
57
|
-
|
72
|
+
|
73
|
+
## About
|
74
|
+
|
75
|
+
[argos-ruby](https://github.com/npolar/argos-ruby) has been developed to parse [Argos](http://www.argos-system.org)
|
76
|
+
satellite tracking data files collected by the [Norwegian Polar Institute]
|
77
|
+
(http://npolar.no/en) since 1989.
|
78
|
+
|
79
|
+
Be warned, the Argos file formats have changed over time. No promises are
|
80
|
+
made that the library will work outside of Norway :).
|
81
|
+
|
82
|
+
Currently, the library parses Argos DS/DIAG files dating from August 1990
|
83
|
+
and onwards.
|
84
|
+
|
85
|
+
## Install
|
86
|
+
$ gem install argos-ruby
|
87
|
+
|
88
|
+
## Links
|
58
89
|
* [http://api.npolar.no/tracking/?q=&filter-technology=argos](http://api.npolar.no/tracking/?q=&filter-technology=argos)
|
59
90
|
* [Argos users manual v1.5](http://www.argos-system.org/files/pmedia/public/r363_9_argos_users_manual-v1.5.pdf) (PDF)
|
60
91
|
* http://alaska.usgs.gov/science/biology/spatial/
|
data/bin/argos-ruby
CHANGED
data/lib/argos.rb
CHANGED
@@ -17,7 +17,7 @@ require_relative "argos/diag"
|
|
17
17
|
#
|
18
18
|
# For information about Argos, see: http://www.argos-system.org
|
19
19
|
module Argos
|
20
|
-
VERSION = "1.0.
|
20
|
+
VERSION = "1.0.4"
|
21
21
|
# Detect Argos type ("ds" or "diag" or nil)
|
22
22
|
#
|
23
23
|
# @param filename [String] Argos (DS or DIAG) file
|
data/lib/argos/command.rb
CHANGED
@@ -19,6 +19,12 @@ module Argos
|
|
19
19
|
def param(argv=ARGV)
|
20
20
|
optparser = OptionParser.new(ARGV) do |opts|
|
21
21
|
|
22
|
+
opts.banner = "argos-ruby [OPTIONS] {filename|glob}
|
23
|
+
For more information and source: https://github.com/npolar/argos-ruby
|
24
|
+
|
25
|
+
Options:\n
|
26
|
+
"
|
27
|
+
|
22
28
|
opts.on_tail("--version", "-v", "Library version") do
|
23
29
|
puts Argos.library_version
|
24
30
|
exit
|
data/lib/argos/diag.rb
CHANGED
@@ -17,9 +17,9 @@ module Argos
|
|
17
17
|
|
18
18
|
LOCATION_CLASS = ["3", "2", "1", "0", "A", "B", "Z"]
|
19
19
|
|
20
|
-
attr_accessor :log, :filename, :programs
|
20
|
+
attr_accessor :log, :filename, :programs, :bundle
|
21
21
|
|
22
|
-
attr_reader :filename, :filter, :filtername, :sha1, :valid, :filesize, :updated, :multiplicates, :errors
|
22
|
+
attr_reader :bundle, :filename, :filter, :filtername, :sha1, :valid, :filesize, :updated, :multiplicates, :errors
|
23
23
|
|
24
24
|
START_REGEX = /^\s*\d{5,6}\s+Date : \d{2}.\d{2}.\d{2} \d{2}:\d{2}:\d{2}/
|
25
25
|
$start_diag ='^\s*\d{5,6}\s+Date : \d{2}.\d{2}.\d{2} \d{2}:\d{2}:\d{2}'
|
@@ -224,7 +224,7 @@ module Argos
|
|
224
224
|
technology: "argos",
|
225
225
|
type: type,
|
226
226
|
location: "file://"+filename,
|
227
|
-
source: "#{sha1}"
|
227
|
+
source: "#{sha1}",
|
228
228
|
}
|
229
229
|
|
230
230
|
idbase = diag.clone
|
@@ -233,6 +233,7 @@ module Argos
|
|
233
233
|
|
234
234
|
diag[:parser] = Argos.library_version
|
235
235
|
diag[:id] = id
|
236
|
+
diag[:bundle] = bundle
|
236
237
|
diag
|
237
238
|
end
|
238
239
|
|
data/lib/argos/ds.rb
CHANGED
@@ -17,9 +17,9 @@ module Argos
|
|
17
17
|
class Ds < Array
|
18
18
|
include Argos
|
19
19
|
|
20
|
-
attr_writer :log, :filename
|
20
|
+
attr_writer :log, :filename, :bundle
|
21
21
|
|
22
|
-
attr_reader :filename, :filter, :filtername, :valid, :filesize, :updated, :sha1, :messages, :multiplicates, :errors
|
22
|
+
attr_reader :bundle, :filename, :filter, :filtername, :valid, :filesize, :updated, :sha1, :messages, :multiplicates, :errors
|
23
23
|
|
24
24
|
START_REGEX = /^\d{5} \d{5,6} +\d+ +\d+/
|
25
25
|
|
@@ -361,6 +361,7 @@ module Argos
|
|
361
361
|
|
362
362
|
m[:parser] = Argos.library_version
|
363
363
|
m[:id] = id
|
364
|
+
m[:bundle] = bundle
|
364
365
|
m
|
365
366
|
end
|
366
367
|
|
data/spec/argos/diag_spec.rb
CHANGED
data/spec/argos/ds_spec.rb
CHANGED
@@ -64,7 +64,8 @@ module Argos
|
|
64
64
|
:location,
|
65
65
|
:source,
|
66
66
|
:parser,
|
67
|
-
:id
|
67
|
+
:id,
|
68
|
+
:bundle]}
|
68
69
|
end
|
69
70
|
|
70
71
|
it "should sort ascending on positioned, measured" do
|
@@ -91,7 +92,8 @@ module Argos
|
|
91
92
|
:longitude=>22.319, :altitude=>0.0, :headers=>12,
|
92
93
|
:measured=>"1999-12-30T18:43:52Z", :identical=>3, :sensor_data=>["78", "00", "00"],
|
93
94
|
:technology=>"argos", :type=>"ds", :location=>"file://"+VALID_DS, :parser => "argos-ruby-#{Argos::VERSION}",
|
94
|
-
:source=>"3a39e0bd0b944dca4f4fbf17bc0680704cde2994", :id=>"c78642c2bbfd4188df8940cd966b40cef33f2881"
|
95
|
+
:source=>"3a39e0bd0b944dca4f4fbf17bc0680704cde2994", :id=>"c78642c2bbfd4188df8940cd966b40cef33f2881",
|
96
|
+
:bundle=>nil}]
|
95
97
|
end
|
96
98
|
end
|
97
99
|
end
|
@@ -114,6 +116,7 @@ module Argos
|
|
114
116
|
:source=>"3a39e0bd0b944dca4f4fbf17bc0680704cde2994",
|
115
117
|
:warn=>["missing-position", "sensors-count-mismatch"],
|
116
118
|
:parser=>"argos-ruby-#{Argos::VERSION}",
|
119
|
+
:bundle=>nil,
|
117
120
|
:id=>"e81e2f255b62fa88e20351de8d5b2de9bf6b3028"}]
|
118
121
|
end
|
119
122
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: argos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
13
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -37,6 +37,7 @@ extensions: []
|
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
39
|
- .gitignore
|
40
|
+
- Gemfile
|
40
41
|
- LICENSE
|
41
42
|
- README.md
|
42
43
|
- argos-ruby.gemspec
|
@@ -52,6 +53,7 @@ files:
|
|
52
53
|
- spec/argos/_diag/valid_2009-03-02_DB_DIAG.txt
|
53
54
|
- spec/argos/_ds/990660_A.DAT
|
54
55
|
- spec/argos/_ds/dup.ds
|
56
|
+
- spec/argos/_ds/fragment.ds
|
55
57
|
- spec/argos/_ds/sensor_mismatch_ds.txt
|
56
58
|
- spec/argos/diag_spec.rb
|
57
59
|
- spec/argos/ds_spec.rb
|
@@ -83,4 +85,3 @@ signing_key:
|
|
83
85
|
specification_version: 3
|
84
86
|
summary: Argos satellite tracking data parsers
|
85
87
|
test_files: []
|
86
|
-
has_rdoc:
|