R/nearest_stations_ogimet.R
nearest_stations_ogimet.RdReturns a data frame of meteorological stations with their coordinates and distance from a given location based on the ogimet webpage. The returned list is valid only for a given day.
country name; It is possible to provide more than one country combined into a vector
optionally, a day when measurements were done in all available locations; Sys.Date used by default
logical - whether to draw a map for a returned data frame (requires maps/mapdata packages)
a vector of two coordinates (longitude, latitude) for a point we want to find nearest stations to (e.g. c(0, 0))
how many nearest stations will be returned from the given geographical coordinates
logical - whether to proceed or stop on failure. By default set to TRUE (i.e. don't stop on error). For debugging purposes change to FALSE
extra arguments to be provided to the graphics::plot() function (only if add_map = TRUE)
A data.frame with number of nearest station according to given point columns describing stations parameters
(e.g. ID station, distance from point in km, geographic coordinates, etc.). Each row represent a measurement,
each station which has a measurements on selected date. If add_map = TRUE additional map of downloaded data is added.
# \donttest{
nearest_stations_ogimet(country = "United Kingdom",
point = c(-2, 50),
add_map = TRUE,
no_of_stations = 50,
allow_failure = TRUE,
main = "Meteo stations in UK")
#> wmo_id station_names lon lat alt distance
#> 180 03857 Isle Of Portland -2.450009 50.51668 52 76.87423
#> 181 03862 Bournemouth Airport -1.833350 50.76668 12 88.02782
#> 188 03896 Saint Helier -2.100002 49.20000 54 90.45543
#> 187 03895 Jersey Airport -2.183337 49.20000 84 92.08374
#> 186 03894 Guernsey Airport -2.583345 49.41667 102 92.55780
#> 182 03866 Saint Catherine'S Point -1.283339 50.56668 20 102.50669
#> 163 03746 Boscombe Down -1.750015 51.15000 124 132.03977
#> 3 ----- Gosport, Fleetlands -1.166670 50.83335 1 132.22610
#> 179 03853 Yeovilton -2.633346 51.00000 23 132.80632
#> 164 03749 Middle Wallop -1.566678 51.13334 91 136.13384
#> 162 03743 Larkhill -1.800016 51.20000 132 136.49329
#> 183 03872 Thorney Island -0.916685 50.80002 4 151.09510
#> 177 03840 Dunkeswell Aerodrome -3.233338 50.85002 252 168.05741
#> 161 03740 Lyneham -1.983353 51.50001 145 168.30649
#> 178 03844 Exeter Airport No2 -3.400008 50.73335 31 177.32121
#> 165 03761 Odiham -0.933352 51.23334 123 182.94804
#> 197 03930 Almondsbury -2.550011 51.55001 75 184.53014
#> 43 ----- Alice Holt Lodge (Aut) -0.833350 51.16667 115 185.11401
#> 151 03649 Brize Norton -1.566678 51.75001 88 202.27540
#> 152 03658 Benson -1.083335 51.61668 62 208.51460
#> 150 03647 Little Rissington -1.683347 51.85002 210 210.58428
#> 160 03717 Cardiff, Bute Park (Aut) -3.183337 51.48334 9 212.89575
#> 184 03876 Shoreham Airport -0.283339 50.83335 2 214.09869
#> 158 03710 Liscombe -3.600012 51.08333 348 216.79385
#> 159 03716 St. Athan -3.433342 51.40001 50 224.79946
#> 166 03769 Charlwood -0.216671 51.13334 67 237.07008
#> 142 03529 Pershore -2.033334 52.13334 35 239.38242
#> 168 03772 London / Heathrow Airport -0.450009 51.46668 24 239.41862
#> 176 03827 Plymouth -4.116669 50.35001 50 240.70808
#> 153 03672 Northolt -0.416675 51.53334 38 247.29281
#> 141 03522 Hereford/Credenhill -2.800016 52.06667 76 248.64013
#> 21 ----- Astwood Bank (Aut) -1.933352 52.23334 137 250.68464
#> 15 ----- Kew Gardens (Aut) -0.283339 51.46668 6 253.32765
#> 169 03781 Kenley -0.083335 51.30001 170 259.84178
#> 157 03707 Chivenor -4.133336 51.08333 8 268.44650
#> 140 03520 Shobdon -2.883351 52.23334 99 269.46146
#> 167 03770 London, St James Park -0.116669 51.50001 5 270.13468
#> 154 03680 Rothamsted -0.350007 51.80002 128 273.96522
#> 144 03544 Church Lawford -1.316673 52.35001 107 274.58330
#> 45 ----- Coventry, Coundon (Aut) -1.533344 52.41667 119 276.15168
#> 185 03882 Herstmonceux 0.316673 50.88335 52 278.17723
#> 143 03535 Coleshill -1.683347 52.46668 96 279.02389
#> 139 03507 Sennybridge -3.600012 52.05000 307 291.76620
#> 9 ----- High Beach (Aut) 0.033334 51.65001 110 293.79658
#> 145 03559 Cardington (Aut) -0.416675 52.10000 29 295.07781
#> 24 ----- Llysdinam (Aut) -3.450009 52.20000 196 295.62373
#> 38 ----- Bude (Aut) -4.533344 50.81668 15 298.63717
#> 4 ----- Goudhurst (Aut) 0.450009 51.06667 85 299.80506
#> 27 ----- Market Bosworth, Bosworth Park -1.383341 52.61668 129 301.62500
#> 146 03560 Bedford -0.450009 52.21667 85 303.47286
# }