argos-ruby 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -16,16 +16,46 @@ and onwards.
16
16
  $ gem install argos-ruby
17
17
 
18
18
  ## Command-line usage
19
+
19
20
  ```sh
20
21
  $ curl "https://raw.github.com/npolar/argos-ruby/master/spec/argos/_ds/990660_A.DAT" > /tmp/990660_A.DAT
21
- $ ./bin/argos-ruby /tmp/990660_A.DAT --filter "lambda {|a| a[:program] == 660 }"
22
+ $ ./bin/argos-ruby /tmp/990660_A.DAT
22
23
  ```
23
- This will output (the lambda filter is of course optional):
24
+ JSON output (shortened)
24
25
 
25
26
  ```json
26
- [{"program":660,"platform":14747,"lines":2,"sensors":32,"satellite":"K","lc":null,"positioned":null,"latitude":null,"longitude":null,"altitude":null,"headers":5,"measured":"1999-12-16T00:46:49Z","identical":1,"sensor_data":["92","128","130","132"],"technology":"argos","type":"ds","filename":"/tmp/990660_A.DAT","source":"3a39e0bd0b944dca4f4fbf17bc0680704cde2994","warn":["missing-position","sensors-count-mismatch"],"parser":"argos-ruby-1.0.0","id":"f2c82a5ca1330b312925949a15ac300d07452a12"}]
27
+ [ { .. },
28
+ {
29
+ "program": 9660,
30
+ "platform": 2173,
31
+ "lines": 3,
32
+ "sensors": 3,
33
+ "satellite": "K",
34
+ "lc": "B",
35
+ "positioned": "1999-12-31T19:18:58Z",
36
+ "latitude": 77.562,
37
+ "longitude": 40.341,
38
+ "altitude": 0.0,
39
+ "headers": 12,
40
+ "measured": "1999-12-31T19:19:28Z",
41
+ "identical": 1,
42
+ "sensor_data": [
43
+ "18729",
44
+ "17",
45
+ "149"
46
+ ],
47
+ "technology": "argos",
48
+ "type": "ds",
49
+ "location": "file:///tmp/990660_A.DAT",
50
+ "source": "3a39e0bd0b944dca4f4fbf17bc0680704cde2994",
51
+ "parser": "argos-ruby-1.0.3",
52
+ "id": "5185906d06859457786753459894bd33fdd8cd0a"
53
+ }
54
+ ]
27
55
 
28
56
  ```
29
57
  Links
30
58
  * [http://api.npolar.no/tracking/?q=&filter-technology=argos](http://api.npolar.no/tracking/?q=&filter-technology=argos)
31
59
  * [Argos users manual v1.5](http://www.argos-system.org/files/pmedia/public/r363_9_argos_users_manual-v1.5.pdf) (PDF)
60
+ * http://alaska.usgs.gov/science/biology/spatial/
61
+ * http://gis-lab.info/programs/argos/argos-manual-eng.html
data/bin/argos-ruby CHANGED
@@ -126,7 +126,7 @@ elsif "source" == param[:action]
126
126
  s
127
127
  }
128
128
  if argosfiles != result.size
129
- log.fatal "Argos file count: #{argosfiles} differs from parsed files: #{result.size}"
129
+ log.warn "Argos file count: #{argosfiles} differs from parsed files: #{result.size}"
130
130
  end
131
131
  log.info "Documents (Σcount): #{sum_count}, sources: #{result.size} (ds: #{ds_count}, diag: #{diag_count}), bundle: #{bundle}, glob: #{glob}"
132
132
  end
data/lib/argos.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bigdecimal"
2
2
  require "date"
3
+ require "time" # for iso8601
3
4
  require "digest/sha1"
4
5
  require "json"
5
6
  require "logger"
@@ -16,7 +17,7 @@ require_relative "argos/diag"
16
17
  #
17
18
  # For information about Argos, see: http://www.argos-system.org
18
19
  module Argos
19
- VERSION = "1.0.2"
20
+ VERSION = "1.0.3"
20
21
  # Detect Argos type ("ds" or "diag" or nil)
21
22
  #
22
23
  # @param filename [String] Argos (DS or DIAG) file
@@ -87,7 +88,7 @@ module Argos
87
88
  # Source fingerprint of Argos file (sha1 hash, segment and document counts, etc.)
88
89
  #
89
90
  # @param  [Argos::Ds Argos::Diag] argos
90
- # @return [Hash]
91
+ # @return [Hash] Source hash
91
92
  def self.source(argos)
92
93
 
93
94
  argos.parse(argos.filename)
@@ -100,7 +101,7 @@ module Argos
100
101
  longitude_mean = (argos.longitudes.inject{ |sum, longitude| sum + longitude } / argos.latitudes.size).round(3)
101
102
  end
102
103
 
103
-
104
+
104
105
  source = {
105
106
  id: argos.source,
106
107
  technology: "argos",
@@ -118,7 +119,7 @@ module Argos
118
119
  longitude_mean: longitude_mean,
119
120
  location: "file://"+argos.filename,
120
121
  bytes: argos.filesize,
121
- updated: argos.updated.xmlschema,
122
+ updated: argos.updated.utc.iso8601,
122
123
  messages: argos.messages.size,
123
124
  filter: argos.filtername.nil? ? argos.filter : argos.filtername,
124
125
  size: argos.size,
data/lib/argos/diag.rb CHANGED
@@ -93,7 +93,7 @@ module Argos
93
93
  contact = []
94
94
  file = File.open(filename)
95
95
  @filesize = file.size
96
- @updated = file.mtime
96
+ @updated = file.mtime.utc
97
97
 
98
98
  log.debug "Parsing Argos DIAG file #{filename} sha1:#{sha1} (#{filesize} bytes)"
99
99
  if filter?
data/lib/argos/ds.rb CHANGED
@@ -79,7 +79,7 @@ module Argos
79
79
  contact = []
80
80
  file = File.open(filename)
81
81
  @filesize = file.size
82
- @updated = file.mtime
82
+ @updated = file.mtime.utc
83
83
 
84
84
  log.debug "Parsing ARGOS DS file #{filename} source:#{sha1} (#{filesize} bytes)"
85
85
  if filter?
data/spec/argos_spec.rb CHANGED
@@ -28,7 +28,7 @@ module Argos
28
28
  :messages=>449,
29
29
  :filter=>nil,
30
30
  :size=>843,
31
- :updated => "2013-10-21T19:02:32+02:00",
31
+ :updated => "2013-10-21T17:02:32Z",
32
32
  :parser=>Argos.library_version }
33
33
  end
34
34
  end
@@ -53,7 +53,7 @@ module Argos
53
53
  :longitude_mean=>30.752,
54
54
  :location=>"file://#{diagfile("990660_A.DIA")}",
55
55
  :bytes=>222056,
56
- :updated=>"2013-10-21T20:31:55+02:00",
56
+ :updated=>"2013-10-21T18:31:55Z",
57
57
  :messages=>448,
58
58
  :filter=>nil,
59
59
  :size=>448,
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.2
4
+ version: 1.0.3
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-08 00:00:00.000000000 Z
13
+ date: 2014-01-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec