agwx_grids 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/agwx_grids/grid.rb +3 -3
- data/lib/agwx_grids/version.rb +1 -1
- data/test/grid_test.rb +2 -2
- metadata +49 -69
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cc29fff6f84138fcca04a4586b28f7144f7b56c5
|
4
|
+
data.tar.gz: 524bb1dd3c0b9d17c88fa3d8a4bd1f541c076e16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4b53b72fbd8429a0f0cb309bcdc89f03e990ba17caa2efe9d182ed6153661fbb00ac95903a27a8e9c1103219080e05dc29b03c2c03a036922d194f3eaa09302
|
7
|
+
data.tar.gz: 010541111bec78291ecea0d1c90e51a4a4ba01c658a516fc57fb3be87959555145b01cc7b22e0bc3e718a4d3a431ff83c2466c47e609e058fc310fb9528ddbe4
|
data/lib/agwx_grids/grid.rb
CHANGED
@@ -160,7 +160,7 @@ module AgwxGrids
|
|
160
160
|
end
|
161
161
|
|
162
162
|
# Find the nearest index to the given coord (params in real space, return is a zero-based index)
|
163
|
-
def nearest(coord,start,incr)
|
163
|
+
def self.nearest(coord,start,incr)
|
164
164
|
# convert coord to a lower-bound index (i.e. truncating integer conversion)
|
165
165
|
trunc = ((coord - start)/incr).to_i
|
166
166
|
# Does "trunc" the index of the closest real-space coord, or the next one up?
|
@@ -170,8 +170,8 @@ module AgwxGrids
|
|
170
170
|
# Convert coordinates in real XY space to indices. Note that Z is sort-of a real-space coord, but
|
171
171
|
# represents a quantized there-or-not value like a DOY, not a scalar.
|
172
172
|
def realToIndex(x,y,z)
|
173
|
-
@my_ii = nearest(x,@mD.xStart,@mD.xIncr)
|
174
|
-
@my_jj = nearest(y,@mD.yStart,@mD.yIncr)
|
173
|
+
@my_ii = self.nearest(x,@mD.xStart,@mD.xIncr)
|
174
|
+
@my_jj = self.nearest(y,@mD.yStart,@mD.yIncr)
|
175
175
|
@my_doy = z
|
176
176
|
# puts "realToIndex: x #{x}, xStart #{@mD.xStart}, xIncr #{@mD.xIncr} myX #{@my_ii}; y #{y}, myY #{@my_jj} z #{z}, myZ #{@my_doy}"
|
177
177
|
[@my_ii,@my_jj,@my_doy]
|
data/lib/agwx_grids/version.rb
CHANGED
data/test/grid_test.rb
CHANGED
@@ -86,8 +86,8 @@ class TestAgwxGrid < Test::Unit::TestCase
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_nearest
|
89
|
-
assert_equal(0,
|
90
|
-
assert_equal(1,
|
89
|
+
assert_equal(0, Grid.nearest(-97.81,-98.0,0.4))
|
90
|
+
assert_equal(1, Grid.nearest(-97.79,-98.0,0.4))
|
91
91
|
end
|
92
92
|
end
|
93
93
|
# begin # test the Grid class
|
metadata
CHANGED
@@ -1,61 +1,50 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: agwx_grids
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- RickWayne
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: bundler
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
25
17
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 3
|
31
|
-
version: "1.3"
|
32
|
-
prerelease: false
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
33
20
|
type: :development
|
34
|
-
requirement: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
47
34
|
type: :development
|
48
|
-
|
49
|
-
|
50
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: 'UW Soils Ag Weather grid data format (X by Y by DOY) '
|
42
|
+
email:
|
51
43
|
- fewayne@wisc.edu
|
52
44
|
executables: []
|
53
|
-
|
54
45
|
extensions: []
|
55
|
-
|
56
46
|
extra_rdoc_files: []
|
57
|
-
|
58
|
-
files:
|
47
|
+
files:
|
59
48
|
- .gitignore
|
60
49
|
- Gemfile
|
61
50
|
- LICENSE.txt
|
@@ -67,39 +56,30 @@ files:
|
|
67
56
|
- lib/agwx_grids/version.rb
|
68
57
|
- test/grid_test.rb
|
69
58
|
- test/grids/WIMNTMin2002
|
70
|
-
homepage:
|
71
|
-
licenses:
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
72
61
|
- MIT
|
62
|
+
metadata: {}
|
73
63
|
post_install_message:
|
74
64
|
rdoc_options: []
|
75
|
-
|
76
|
-
require_paths:
|
65
|
+
require_paths:
|
77
66
|
- lib
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
none: false
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
hash: 3
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
version: "0"
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
96
77
|
requirements: []
|
97
|
-
|
98
78
|
rubyforge_project:
|
99
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.0.6
|
100
80
|
signing_key:
|
101
|
-
specification_version:
|
81
|
+
specification_version: 4
|
102
82
|
summary: UW Soils Ag Weather grid data format (X by Y by DOY)
|
103
|
-
test_files:
|
83
|
+
test_files:
|
104
84
|
- test/grid_test.rb
|
105
85
|
- test/grids/WIMNTMin2002
|