Get current weather observations of a BOM station

get_current_weather(
  station_name,
  strict = FALSE,
  latlon = NULL,
  emit_latlon_msg = TRUE
)

Arguments

station_name

The name of the weather station. Fuzzy string matching via agrep is done.

strict

(logical) If TRUE, station_name must match the station name exactly, except that station_name need not be upper case. Note this may be different to full_name in the response. See Details.

latlon

A length-2 numeric vector giving the decimal degree latitude and longitude (in that order), e.g., latlon = c(-34, 151) for Sydney. When given instead of station_name, the nearest station (in this package) is used, with a message indicating the nearest such station. (See also sweep_for_stations.) Ignored if used in combination with station_name, with a warning.

emit_latlon_msg

Logical. If TRUE (the default), and latlon is selected, a message is emitted before the table is returned indicating which station was actually used (i.e., which station was found to be nearest to the given coordinate).

Value

A bomrang_tbl object (extension of a data.frame) of requested BOM station's current and prior 72hr data. For full details of fields and units returned, see Appendix 1 in the bomrang vignette, use
vignette("bomrang", package = "bomrang") to view.

Details

Station names are not consistently named within the Bureau, so the response may contain a different full_name to the one matched, even if strict = TRUE. For example,
get_current_weather("CASTLEMAINE PRISON")[["full_name"]][1]
is Castlemaine, not Castlemaine Prison.

Note that the column local_date_time_full is set to a POSIXct object in the local time of the user. For more details see “Appendix 1 - Output from get_current_weather()” in the bomrang vignette
vignette("bomrang", package = "bomrang")
for a complete list of fields and units.

References

Weather data observations are retrieved from: Australian Bureau of Meteorology (BOM) Weather Data Services, Observations - individual stations: http://www.bom.gov.au/catalogue/data-feeds.shtml

Station location and other metadata are sourced from the Australian Bureau of Meteorology (BOM) webpage, Bureau of Meteorology Site Numbers: http://www.bom.gov.au/climate/cdo/about/site-num.shtml

See also

Author

Hugh Parsonage, hugh.parsonage@gmail.com

Examples

# \donttest{ # warning Melbourne_weather <- get_current_weather("Melbourne")
#> Warning: Multiple stations match station_name. Using #> station_name = 'MELBOURNE AIRPORT' #> Did you mean any of the following? #> station_name = 'MELBOURNE (OLYMPIC PARK)'
# no warning Melbourne_weather <- get_current_weather("Melbourne (Olympic Park)") # Get weather by latitude and longitude: get_current_weather(latlon = c(-34, 151))
#> Using station_name = 'HOLSWORTHY AERODROME AWS', at latitude = -33.9925, longitude = 150.9489 (4.78 km away).
#> --- Australian Bureau of Meteorology (BOM) Data Resource --- #> (Original Request Parameters) #> Station: HOLSWORTHY AERODROME AWS [066161] #> Location: lat: -33.9925, lon: 150.9489 #> Measurement / Origin: All / Current #> Timespan: 2012 -- 2021 [9 years] #> --------------------------------------------------------------- #> sort_order wmo full_name history_product local_date_time #> 1: 0 95761 Holsworthy IDN60801 11/02:30pm #> 2: 1 95761 Holsworthy IDN60801 11/02:00pm #> 3: 2 95761 Holsworthy IDN60801 11/01:59pm #> 4: 3 95761 Holsworthy IDN60801 11/01:30pm #> 5: 4 95761 Holsworthy IDN60801 11/01:04pm #> --- #> 159: 158 95761 Holsworthy IDN60801 08/05:00pm #> 160: 159 95761 Holsworthy IDN60801 08/04:30pm #> 161: 160 95761 Holsworthy IDN60801 08/04:00pm #> 162: 161 95761 Holsworthy IDN60801 08/03:30pm #> 163: 162 95761 Holsworthy IDN60801 08/03:00pm #> local_date_time_full aifstime_utc lat lon apparent_t #> 1: 2021-04-11 14:30:00 2021-04-11 04:30:00 -33.9925 150.9489 9.8 #> 2: 2021-04-11 14:00:00 2021-04-11 04:00:00 -33.9925 150.9489 10.2 #> 3: 2021-04-11 13:59:00 2021-04-11 03:59:00 -33.9925 150.9489 10.1 #> 4: 2021-04-11 13:30:00 2021-04-11 03:30:00 -33.9925 150.9489 11.7 #> 5: 2021-04-11 13:04:00 2021-04-11 03:04:00 -33.9925 150.9489 10.0 #> --- #> 159: 2021-04-08 17:00:00 2021-04-08 07:00:00 -33.9925 150.9489 22.8 #> 160: 2021-04-08 16:30:00 2021-04-08 06:30:00 -33.9925 150.9489 22.9 #> 161: 2021-04-08 16:00:00 2021-04-08 06:00:00 -33.9925 150.9489 24.3 #> 162: 2021-04-08 15:30:00 2021-04-08 05:30:00 -33.9925 150.9489 24.3 #> 163: 2021-04-08 15:00:00 2021-04-08 05:00:00 -33.9925 150.9489 24.1 #> cloud cloud_base_m cloud_oktas cloud_type cloud_type_id delta_t gust_kmh #> 1: Clear NA 0 - NA 7.4 44 #> 2: - NA NA - NA 7.5 46 #> 3: - NA NA - NA 7.5 46 #> 4: - NA NA - NA 7.6 39 #> 5: - NA NA - NA 7.3 56 #> --- #> 159: - NA NA - NA 3.7 19 #> 160: - NA NA - NA 4.0 20 #> 161: - NA NA - NA 4.7 17 #> 162: - NA NA - NA 5.1 15 #> 163: - NA NA - NA 4.7 17 #> gust_kt air_temp dewpt press press_msl press_qnh press_tend rain_trace #> 1: 24 17.1 -0.1 1009.9 1009.9 1010.0 - 0 #> 2: 25 17.5 0.2 1009.9 1009.9 1010.0 - 0 #> 3: 25 17.4 0.1 1009.8 1009.8 1009.9 - 0 #> 4: 21 17.8 0.5 1009.5 1009.5 1009.6 - 0 #> 5: 30 17.2 0.4 1009.5 1009.5 1009.6 - 0 #> --- #> 159: 10 22.9 16.9 1009.4 1009.4 1009.5 - 0 #> 160: 11 23.4 16.9 1009.2 1009.2 1009.3 - 0 #> 161: 9 24.2 16.5 1009.2 1009.2 1009.3 - 0 #> 162: 8 24.4 16.1 1009.7 1009.7 1009.8 - 0 #> 163: 9 24.3 16.6 1009.9 1009.9 1010.0 - 0 #> rel_hum sea_state swell_dir_worded swell_height swell_period vis_km #> 1: 31 - - NA NA 10 #> 2: 31 - - NA NA 10 #> 3: 31 - - NA NA 10 #> 4: 31 - - NA NA 10 #> 5: 32 - - NA NA 10 #> --- #> 159: 69 - - NA NA 10 #> 160: 67 - - NA NA 10 #> 161: 62 - - NA NA 10 #> 162: 60 - - NA NA 10 #> 163: 62 - - NA NA 10 #> weather wind_dir wind_spd_kmh wind_spd_kt #> 1: - W 28 15 #> 2: - WSW 28 15 #> 3: - WSW 28 15 #> 4: - W 22 12 #> 5: - WSW 28 15 #> --- #> 159: - E 13 7 #> 160: - E 15 8 #> 161: - E 11 6 #> 162: - E 11 6 #> 163: - E 13 7
# }