agroclimatology 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/agroclimatology.gemspec +1 -1
- data/lib/agroclimatology/version.rb +1 -1
- data/lib/agroclimatology.rb +7 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67a1d196fe995c26ea25be5a2690bd7e7d219a1f
|
4
|
+
data.tar.gz: c8a8c65d62236cfa72a7b8138de5b745e7f6baca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cbfd885da778503f479caecfee920a635cb81872a07b3d0060da6962c239473f6e5ed736242250f2c6fdfeec1911997c0f1dd572c0fa95eb7659477556a754e
|
7
|
+
data.tar.gz: 19a681c22a9006be01fffea90b51d700cd99ff5040131cba03a620728ba1a46420e1a3fa4075eabe26067db40c03c13c95a7e1c420b1c1bacd8a245a936a70a5
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Ruby client for interacting with the [NASA (POWER) Agroclimatology Web Resource](http://power.larc.nasa.gov/cgi-bin/agro.cgi)
|
6
6
|
|
7
|
-
Initial functionality is focused on getting solar radiation
|
7
|
+
Initial functionality is focused on getting solar radiation data
|
8
8
|
for a given latitude and longitude. Other solar radiation and meteorological query parameters will be available in subsequent versions.
|
9
9
|
|
10
10
|
## Installation
|
@@ -51,10 +51,12 @@ Agroclimatology.fetch(-26.660446, 152.964647, 2015, 2016)
|
|
51
51
|
|
52
52
|
### Output
|
53
53
|
|
54
|
-
Returns
|
55
|
-
- year - Year
|
56
|
-
- day - Day of Year
|
57
|
-
-
|
54
|
+
Returns JSON output containing records for every day included in year_start - year_end range
|
55
|
+
- **year** - Year
|
56
|
+
- **day** - Day of Year
|
57
|
+
- **rad_atmosphere** - Average Top-of-atmosphere Insolation (MJ/m^2/day)
|
58
|
+
- **rad_surface** - Average Insolation Incident On A Horizontal Surface (MJ/m^2/day)
|
59
|
+
- **rad_flux** - Average Downward Longwave Radiative Flux (MJ/m^2/day)
|
58
60
|
|
59
61
|
## Development
|
60
62
|
|
@@ -62,7 +64,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
62
64
|
|
63
65
|
## Contributing
|
64
66
|
|
65
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
67
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/brycejohnston/agroclimatology.
|
66
68
|
|
67
69
|
## License
|
68
70
|
|
data/agroclimatology.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "
|
20
|
+
spec.add_dependency "httparty", "~> 0.13.7"
|
21
21
|
spec.add_dependency "oj", "~> 2.15"
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.12"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/agroclimatology.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "agroclimatology/version"
|
2
2
|
require "csv"
|
3
|
-
require "
|
3
|
+
require "httparty"
|
4
4
|
require "oj"
|
5
5
|
|
6
6
|
module Agroclimatology
|
@@ -10,10 +10,10 @@ module Agroclimatology
|
|
10
10
|
url << "&lat=#{lat.to_s}&lon=#{lon.to_s}"
|
11
11
|
url << "&ms=1&ds=1&ys=#{year_start.to_s}"
|
12
12
|
url << "&me=12&de=31&ye=#{year_end.to_s}"
|
13
|
-
url << "&p=swv_dwn&submit=Submit"
|
13
|
+
url << "&p=toa_dwn&p=swv_dwn&p=lwv_dwn&submit=Submit"
|
14
14
|
|
15
|
-
response =
|
16
|
-
if response.
|
15
|
+
response = HTTParty.get(url)
|
16
|
+
if response.code == 200
|
17
17
|
page_data = response.body.split("-END HEADER-").last
|
18
18
|
data = []
|
19
19
|
page_data.split("\n").each do |line|
|
@@ -22,7 +22,9 @@ module Agroclimatology
|
|
22
22
|
daily_record = {
|
23
23
|
"year": row[0],
|
24
24
|
"day_of_year": row[1],
|
25
|
-
"
|
25
|
+
"rad_atmosphere": row[2],
|
26
|
+
"rad_surface": row[3],
|
27
|
+
"rad_flux": row[4]
|
26
28
|
}
|
27
29
|
data << daily_record
|
28
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agroclimatology
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Johnston
|
@@ -11,19 +11,19 @@ cert_chain: []
|
|
11
11
|
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.13.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.13.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: oj
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|