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, [email protected]

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)'
#> Error: lexical error: invalid char in json text. #> <p>Your access is blocked due t #> (right here) ------^
# no warning Melbourne_weather <- get_current_weather("Melbourne (Olympic Park)")
#> Error: lexical error: invalid char in json text. #> <p>Your access is blocked due t #> (right here) ------^
# Get weather by latitude and longitude: get_current_weather(latlon = c(-34, 151))
#> Error: lexical error: invalid char in json text. #> <p>Your access is blocked due t #> (right here) ------^
#> Using station_name = 'HOLSWORTHY AERODROME AWS', at latitude = -33.9925, longitude = 150.9489 (4.78 km away).
# }