knmi 0.0.0 → 0.1.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.
- data/README.rdoc +37 -13
- data/VERSION +1 -1
- data/knmi.gemspec +1 -1
- data/lib/knmi.rb +10 -9
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -2,36 +2,60 @@
|
|
2
2
|
|
3
3
|
Ruby API to access ROYAL NETHERLANDS METEOROLOGICAL INSTITUTE daily climate data
|
4
4
|
|
5
|
-
Access
|
5
|
+
Access climatological data as provided by the ROYAL NETHERLANDS METEOROLOGICAL INSTITUTE
|
6
6
|
through their http get form details of data here (http://www.knmi.nl/climatology/daily_data/scriptxs-en.html) and
|
7
7
|
station list here http://www.knmi.nl/climatology/daily_data/scriptxs-en.html, data is parsed into a array of hashes
|
8
8
|
with keys for each element { [ "STN" => 210, "YYYMMDD" => 20110427, "TG" => 25 ] }
|
9
9
|
|
10
|
+
= Installation
|
11
|
+
gem install knmi
|
12
|
+
|
13
|
+
= Dependancies
|
14
|
+
* httparty >= 0.7.4
|
15
|
+
|
16
|
+
|
10
17
|
= List of Recorded Parameters and group name
|
18
|
+
When entering parameters in method call use groupname for collection of variables of use individual parameter names
|
19
|
+
# Name - GroupName => ["Parameter"]
|
20
|
+
* Wind - "WIND" => ["DDVEC", "FG", "FHX", "FHX", "FX"]
|
21
|
+
* Temperature - "TEMP" => ["TG", "TN", "TX", "T10N"]
|
22
|
+
* Sunshine and global radiation - "SUNR" => ["SQ", "SP", "Q"]
|
23
|
+
* Precipitation - "PRCP" => ["DR", "RH", "EV24"]
|
24
|
+
* Sea-Level Pressure - "PRES" => ["PG", "PGX", "PGN"]
|
25
|
+
* Visibility and Cloud Cover - "VICL" => ["VVN", "VVX", "NG"]
|
26
|
+
* Humidity - "MSTR" => ["VVN", "VVX", "NG"]
|
27
|
+
* "ALL" => ["DDVEC", "FHVEC", "FG", "FHX",
|
28
|
+
"FHXH", "FHN", "FHNH", "FXX", "FXXH", "TG", "TN",
|
29
|
+
"TNH", "TX", "TXH", "T10N", "T10NH", "SQ", "SP",
|
30
|
+
"Q", "DR", "RH", "RHX", "RHXH", "EV24", "PG", "PX",
|
31
|
+
"PXH", "PN", "PNH", "VVN", "VVNH", "VVX", "VVXH",
|
32
|
+
"NG", "UG", "UX", "UXH", "UN", "UNH"]
|
11
33
|
|
12
|
-
= Method calls
|
13
|
-
station_number = number or array of numbers eg 210 or [210, 225]
|
14
|
-
vars = optional parameters to select measure parameters of interest
|
15
|
-
if not defined all recorded parameters will be returned
|
16
|
-
response = KNMI.get_station(station_number, vars)
|
17
|
-
this will return all daily values from the begining of the month to current
|
18
|
-
start = date in the form YYYYMMDD
|
19
|
-
end = date in the form YYYYMMDD
|
20
34
|
|
35
|
+
= List of Method Parameters
|
21
36
|
|
22
|
-
|
37
|
+
* station_number = number or array of numbers eg 210 or [210, 225]
|
38
|
+
* vars = optional parameters to select measure parameters of interest if not defined all recorded parameters will be returned
|
39
|
+
* response = KNMI.get_station(station_number, vars) this will return all daily values from the begining of the month to current
|
40
|
+
* start = date in the form YYYYMMDD
|
41
|
+
* end = date in the form YYYYMMDD
|
42
|
+
|
43
|
+
= Method calls
|
44
|
+
response = KNMI.get_station(station_number, vars)
|
23
45
|
this will return all daily values from the begining of the month to current for selected vars
|
24
46
|
|
25
|
-
response = KNMI.get_station_start_to_current(station_number, start, vars)
|
47
|
+
response = KNMI.get_station_start_to_current(station_number, start, vars)
|
26
48
|
this will return all daily values from defined start date to current
|
27
49
|
|
28
|
-
response = KNMI.get_station_range(station_number, start, end, vars)
|
50
|
+
response = KNMI.get_station_range(station_number, start, end, vars)
|
29
51
|
this will return all daily values from defined start date to defined end date
|
30
52
|
|
31
|
-
response = KNMI.get_station_seasonal(station_number, start, end, vars)
|
53
|
+
response = KNMI.get_station_seasonal(station_number, start, end, vars)
|
32
54
|
this will return all daily values from seasonally defined start date to defined end date
|
33
55
|
eg start = 19800123, end = 19840427 will return data between January 23 and April 27th for 1980 to 1984
|
34
56
|
|
57
|
+
KNMI.to_csv("path/to/filename", response)
|
58
|
+
convenience function for writing response array to a csv
|
35
59
|
|
36
60
|
== Contributing to knmi
|
37
61
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/knmi.gemspec
CHANGED
data/lib/knmi.rb
CHANGED
@@ -33,15 +33,6 @@ class KNMI
|
|
33
33
|
"end=#{_end}"
|
34
34
|
end
|
35
35
|
|
36
|
-
# Variable Options
|
37
|
-
#WIND = DDVEC:FG:FHX:FHX:FX wind
|
38
|
-
#TEMP = TG:TN:TX:T10N temperature
|
39
|
-
#SUNR = SQ:SP:Q Sunshine and global radiation
|
40
|
-
#PRCP = DR:RH:EV24 precipitation and potential evaporation
|
41
|
-
#PRES = PG:PGX:PGN sea-level pressure
|
42
|
-
#VICL = VVN:VVX:NG visibility and cloud cover
|
43
|
-
#MSTR = UG:UX:UN humidity
|
44
|
-
#ALL = all variables including those not in a collection
|
45
36
|
def variables(vars)
|
46
37
|
|
47
38
|
if vars.empty? == true
|
@@ -178,4 +169,14 @@ class KNMI
|
|
178
169
|
puts query
|
179
170
|
get("", { :query => query } )
|
180
171
|
end
|
172
|
+
|
173
|
+
def self.to_csv(filename, response)
|
174
|
+
CSV.open(filename, "wb") do |csv|
|
175
|
+
csv << response[0].keys
|
176
|
+
response[(1..(response.length - 1))].each do |line|
|
177
|
+
csv << line.values
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
181
182
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: knmi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- bullfight
|
@@ -101,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
hash: -
|
104
|
+
hash: -2720597774601715726
|
105
105
|
segments:
|
106
106
|
- 0
|
107
107
|
version: "0"
|