gribr 0.2.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.
Files changed (40) hide show
  1. data/.document +5 -0
  2. data/.gitignore +11 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +42 -0
  5. data/Rakefile +43 -0
  6. data/VERSION +1 -0
  7. data/gribr.gemspec +68 -0
  8. data/lib/gribr/core_ext/file.rb +38 -0
  9. data/lib/gribr/core_ext.rb +1 -0
  10. data/lib/gribr/degrib/cube.rb +15 -0
  11. data/lib/gribr/degrib/file.rb +78 -0
  12. data/lib/gribr/degrib/index.rb +51 -0
  13. data/lib/gribr/degrib/inventory.rb +24 -0
  14. data/lib/gribr/degrib/inventory_record.rb +44 -0
  15. data/lib/gribr/degrib/probe_record.rb +56 -0
  16. data/lib/gribr/degrib.rb +21 -0
  17. data/lib/gribr/executeable.rb +26 -0
  18. data/lib/gribr/inventory.rb +62 -0
  19. data/lib/gribr/utils.rb +23 -0
  20. data/lib/gribr/wgrib/inventory.rb +24 -0
  21. data/lib/gribr/wgrib/inventory_record.rb +51 -0
  22. data/lib/gribr/wgrib.rb +15 -0
  23. data/lib/gribr.rb +6 -0
  24. data/spec/fixtures/wind.grib +0 -0
  25. data/spec/gribr_spec.rb +9 -0
  26. data/spec/lib/gribr/core_ext/file_spec.rb +48 -0
  27. data/spec/lib/gribr/degrib/cube_spec.rb +20 -0
  28. data/spec/lib/gribr/degrib/file_spec.rb +69 -0
  29. data/spec/lib/gribr/degrib/index_spec.rb +83 -0
  30. data/spec/lib/gribr/degrib/inventory_record_spec.rb +121 -0
  31. data/spec/lib/gribr/degrib/inventory_spec.rb +47 -0
  32. data/spec/lib/gribr/degrib/probe_record_spec.rb +103 -0
  33. data/spec/lib/gribr/degrib_spec.rb +17 -0
  34. data/spec/lib/gribr/executeable_spec.rb +25 -0
  35. data/spec/lib/gribr/inventory_spec.rb +21 -0
  36. data/spec/lib/gribr/wgrib/inventory_record_spec.rb +60 -0
  37. data/spec/lib/gribr/wgrib/inventory_spec.rb +17 -0
  38. data/spec/lib/gribr/wgrib_spec.rb +17 -0
  39. data/spec/spec_helper.rb +9 -0
  40. metadata +127 -0
@@ -0,0 +1,60 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+
3
+ module Gribr::Wgrib
4
+
5
+ describe ShortInventoryRecord do
6
+
7
+ it "should be kind of wgrib inventory record" do
8
+ ShortInventoryRecord.new.should be_kind_of(InventoryRecord)
9
+ end
10
+
11
+ shared_examples_for "Parsing a short wgrib record" do
12
+
13
+ it 'should assign the number' do
14
+ @record.number.should == 22
15
+ end
16
+
17
+ it 'should assign the start position' do
18
+ @record.start_position.should == 1057378
19
+ end
20
+
21
+ it 'should assign nil as end position' do
22
+ @record.end_position.should be_nil
23
+ end
24
+
25
+ it 'should assign the element' do
26
+ @record.element.should == 'DIRSW'
27
+ end
28
+
29
+ it 'should assign the valid time' do
30
+ @record.valid_time.should == Time.utc(2009, 11, 4, 0)
31
+ end
32
+
33
+ it 'should assign the reference time' do
34
+ @record.reference_time.should == @record.valid_time + (3 * 60 * 60)
35
+ end
36
+
37
+ end
38
+
39
+ describe "Parsing a short wgrib record having a 2 digit year" do
40
+
41
+ before(:each) do
42
+ @record = ShortInventoryRecord.parse('22:1057378:d=09110400:DIRSW:sfc:3hr fcst:NAve=0')
43
+ end
44
+
45
+ it_should_behave_like "Parsing a short wgrib record"
46
+
47
+ end
48
+
49
+ describe "Parsing a short wgrib record having a 4 digit year" do
50
+
51
+ before(:each) do
52
+ @record = ShortInventoryRecord.parse('22:1057378:d=2009110400:DIRSW:sfc:3hr fcst:NAve=0')
53
+ end
54
+
55
+ it_should_behave_like "Parsing a short wgrib record"
56
+
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../inventory_spec')
3
+ require 'tempfile'
4
+
5
+ module Gribr::Wgrib
6
+
7
+ describe "A wgrib inventory" do
8
+
9
+ before(:each) do
10
+ @inventory = Inventory.file(File.expand_path(File.dirname(__FILE__) + '/../../../fixtures/wind.grib'))
11
+ end
12
+
13
+ it_should_behave_like "An inventory"
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ module Gribr
4
+
5
+ describe Wgrib do
6
+
7
+ it "should return executeable" do
8
+ Wgrib.executeable.should be_kind_of(Executable)
9
+ end
10
+
11
+ it "should return the wgrib executeable" do
12
+ Wgrib.executeable.name.should == "wgrib"
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'gribr'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gribr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Roman Scherer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-04 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: Ruby wrapper to read gridded binary (GRIB) files with degrib.
36
+ email: roman.scherer@burningswell.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
51
+ - gribr.gemspec
52
+ - lib/gribr.rb
53
+ - lib/gribr/core_ext.rb
54
+ - lib/gribr/core_ext/file.rb
55
+ - lib/gribr/degrib.rb
56
+ - lib/gribr/degrib/cube.rb
57
+ - lib/gribr/degrib/file.rb
58
+ - lib/gribr/degrib/index.rb
59
+ - lib/gribr/degrib/inventory.rb
60
+ - lib/gribr/degrib/inventory_record.rb
61
+ - lib/gribr/degrib/probe_record.rb
62
+ - lib/gribr/executeable.rb
63
+ - lib/gribr/inventory.rb
64
+ - lib/gribr/utils.rb
65
+ - lib/gribr/wgrib.rb
66
+ - lib/gribr/wgrib/inventory.rb
67
+ - lib/gribr/wgrib/inventory_record.rb
68
+ - spec/fixtures/wind.grib
69
+ - spec/gribr_spec.rb
70
+ - spec/lib/gribr/core_ext/file_spec.rb
71
+ - spec/lib/gribr/degrib/cube_spec.rb
72
+ - spec/lib/gribr/degrib/file_spec.rb
73
+ - spec/lib/gribr/degrib/index_spec.rb
74
+ - spec/lib/gribr/degrib/inventory_record_spec.rb
75
+ - spec/lib/gribr/degrib/inventory_spec.rb
76
+ - spec/lib/gribr/degrib/probe_record_spec.rb
77
+ - spec/lib/gribr/degrib_spec.rb
78
+ - spec/lib/gribr/executeable_spec.rb
79
+ - spec/lib/gribr/inventory_spec.rb
80
+ - spec/lib/gribr/wgrib/inventory_record_spec.rb
81
+ - spec/lib/gribr/wgrib/inventory_spec.rb
82
+ - spec/lib/gribr/wgrib_spec.rb
83
+ - spec/spec_helper.rb
84
+ has_rdoc: true
85
+ homepage: http://github.com/r0man/gribr
86
+ licenses: []
87
+
88
+ post_install_message:
89
+ rdoc_options:
90
+ - --charset=UTF-8
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ requirements: []
106
+
107
+ rubyforge_project:
108
+ rubygems_version: 1.3.5
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: Ruby wrapper to read gridded binary (GRIB) files with degrib.
112
+ test_files:
113
+ - spec/gribr_spec.rb
114
+ - spec/lib/gribr/degrib/index_spec.rb
115
+ - spec/lib/gribr/degrib/cube_spec.rb
116
+ - spec/lib/gribr/degrib/probe_record_spec.rb
117
+ - spec/lib/gribr/degrib/inventory_spec.rb
118
+ - spec/lib/gribr/degrib/inventory_record_spec.rb
119
+ - spec/lib/gribr/degrib/file_spec.rb
120
+ - spec/lib/gribr/wgrib_spec.rb
121
+ - spec/lib/gribr/inventory_spec.rb
122
+ - spec/lib/gribr/wgrib/inventory_spec.rb
123
+ - spec/lib/gribr/wgrib/inventory_record_spec.rb
124
+ - spec/lib/gribr/degrib_spec.rb
125
+ - spec/lib/gribr/executeable_spec.rb
126
+ - spec/lib/gribr/core_ext/file_spec.rb
127
+ - spec/spec_helper.rb