knmi

Ruby API to access Royal Netherlands Meteorological Institute daily climate data

Access climatological data as provided by the Royal Netherlands Meteorological Institute through the http get form. www.knmi.nl/climatology/daily_data/getdata_day.cgi

Please Note the disclaimer included in the header! # DEZE GEGEVENS MOGEN VRIJ WORDEN GEBRUIKT MITS DE VOLGENDE BRONVERMELDING WORDT GEGEVEN: # KONINKLIJK NEDERLANDS METEOROLOGISCH INSTITUUT (KNMI) # # THESE DATA CAN BE USED FREELY PROVIDED THAT THE FOLLOWING SOURCE IS ACKNOWLEDGED: # ROYAL NETHERLANDS METEOROLOGICAL INSTITUTE

  • Details about data here

www.knmi.nl/climatology/daily_data/scriptxs-en.html)

  • Station list here

www.knmi.nl/climatology/daily_data/scriptxs-en.html

  • data is parsed into a array of hashes with keys for each element

{ [ “STN” => 210, “YYYMMDD” => 20110427, “TG” => 25 ] }

Installation

gem install knmi

Dependancies

  • httparty >= 0.7.4

List of Recorded Parameters and group name

When entering parameters in method call use groupname for collection of variables of use individual parameter names # Name - GroupName => [“Parameter”] * Wind - “WIND” => [“DDVEC”, “FG”, “FHX”, “FHX”, “FX”] * Temperature - “TEMP” => [“TG”, “TN”, “TX”, “T10N”] * Sunshine and global radiation - “SUNR” => [“SQ”, “SP”, “Q”] * Precipitation - “PRCP” => [“DR”, “RH”, “EV24”] * Sea-Level Pressure - “PRES” => [“PG”, “PGX”, “PGN”] * Visibility and Cloud Cover - “VICL” => [“VVN”, “VVX”, “NG”] * Humidity - “MSTR” => [“VVN”, “VVX”, “NG”] * “ALL” => [“DDVEC”, “FHVEC”, “FG”, “FHX”,

"FHXH", "FHN", "FHNH", "FXX", "FXXH", "TG", "TN", 
"TNH", "TX", "TXH", "T10N", "T10NH", "SQ", "SP", 
"Q", "DR", "RH", "RHX", "RHXH", "EV24", "PG", "PX", 
"PXH", "PN", "PNH", "VVN", "VVNH", "VVX", "VVXH", 
"NG", "UG", "UX", "UXH", "UN", "UNH"]

List of Method Parameters

  • station_number = number or array of numbers eg 210 or [210, 225]

  • vars = optional parameters to select measure parameters of interest if not defined all recorded parameters will be returned

  • response = KNMI.get_station(station_number, vars) this will return all daily values from the begining of the month to current

  • start = date in the form YYYYMMDD

  • end = date in the form YYYYMMDD

Method calls

response = KNMI.get_station(station_number, vars) this will return all daily values from the begining of the month to current for selected vars

response = KNMI.get_station_start_to_current(station_number, start, vars) this will return all daily values from defined start date to current

response = KNMI.get_station_range(station_number, start, end, vars) this will return all daily values from defined start date to defined end date

response = KNMI.get_station_seasonal(station_number, start, end, vars) this will return all daily values from seasonally defined start date to defined end date eg start = 19800123, end = 19840427 will return data between January 23 and April 27th for 1980 to 1984

KNMI.to_csv(“path/to/filename”, response) convenience function for writing response array to a csv

Copyright © 2011 Patrick Galvin Schmitz [email protected]. See LICENSE.txt for further details.