ROpenGov
From Testiwiki
FMI package
FMI package belongs to the family of sorvi packages. It is used to browse and download data from the Finnish Meteorological Institute.
Example code:
FMI package belongs to the family of sorvi packages. It is used to browse and download data from the Finnish Meteorological Institute.
Example code:
library(OpasnetUtils) library(fmi) request <- FMIWFSRequest$new(apiKey=apiKey) request$setParameters(request="getFeature", storedquery_id="fmi::observations::weather::daily::timevaluepair", starttime="2014-01-01T00:00:00Z", endtime="2014-01-02T00:00:00Z", bbox="19.09,59.3,31.59,70.13", parameters="rrday,snow,tday,tmin,tmax") request client <- FMIWFSClient$new(request=request) layers <- client$listLayers() layers ##### library(raster) request <- FMIWFSRequest$new(apiKey=apiKey) request$setParameters(request="getFeature", storedquery_id="fmi::observations::weather::monthly::grid", starttime="2012-01-01", endtime="2012-01-01") client <- FMIWFSClient$new(request=request) response <- client$getRaster(parameters=list(splitListFields=TRUE)) # The response is returned as a RasterBrick object of the raster package: response #### response <- client$getLayer(layer=layers[1], crs="+proj=longlat +datum=WGS84", swapAxisOrder=TRUE, parameters=list(splitListFields=TRUE)) library(sp) head(cbind(coordinates(response), response@data[,c("name1","time1","result_MeasurementTimeseries_point_MeasurementTVP_value1","time2","result_MeasurementTimeseries_point_MeasurementTVP_value2")])) ## client <- FMIWFSClient$new(request=request) response <- client$getDailyWeather(startDateTime="2014-01-01", endDateTime="2014-01-02", bbox=getFinlandBBox()) response |