Parse local BOM daily précis forecast XML file(s) and return a data frame of the seven-day town forecasts for a specified state or territory or all Australia.

parse_precis_forecast(state, filepath)

Arguments

state

Required value of an Australian state or territory as full name or postal code. Fuzzy string matching via agrep is done.

filepath

A string providing the directory location of the précis file(s) to parse. See Details for more.

Value

A data.table of Australia BOM précis seven day forecasts for BOM selected towns. For full details of fields and units returned see Appendix 2 in the bomrang vignette, use
vignette("bomrang", package = "bomrang") to view.

Details

Allowed state and territory postal codes, only one state per request or all using AUS.

ACT

Australian Capital Territory (will return NSW)

NSW

New South Wales

NT

Northern Territory

QLD

Queensland

SA

South Australia

TAS

Tasmania

VIC

Victoria

WA

Western Australia

AUS

Australia, returns forecast for all states, NT and ACT

The filepath argument will only accept a directory where files are located for parsing. DO NOT supply the full path including the file name. This function will only parse the requested state or all of Australia in the same fashion as get_precis_forecast, provided that the files are all present in the directory.

References

Forecast data come from Australian Bureau of Meteorology (BOM) Weather Data Services
http://www.bom.gov.au/catalogue/data-feeds.shtml

Location data and other metadata for towns come from the BOM anonymous FTP server with spatial data
ftp://ftp.bom.gov.au/anon/home/adfd/spatial/, specifically the DBF file portion of a shapefile,
ftp://ftp.bom.gov.au/anon/home/adfd/spatial/IDM00013.dbf

See also

Author

Adam H. Sparks, [email protected] and Keith Pembleton, [email protected] and Paul Melloy, [email protected]

Examples

# \donttest{ # parse the short forecast for Queensland # download to tempfile() using basename() to keep original name download.file(url = "ftp://ftp.bom.gov.au/anon/gen/fwo/IDQ11295.xml", destfile = file.path(tempdir(), basename("ftp://ftp.bom.gov.au/anon/gen/fwo/IDQ11295.xml")), mode = "wb") BOM_forecast <- parse_precis_forecast(state = "QLD", filepath = tempdir()) BOM_forecast
#> index product_id state town aac lat lon elev #> 1: 0 IDQ11295 QLD Brisbane QLD_PT001 -27.48080 153.0389 8.1 #> 2: 1 IDQ11295 QLD Brisbane QLD_PT001 -27.48080 153.0389 8.1 #> 3: 2 IDQ11295 QLD Brisbane QLD_PT001 -27.48080 153.0389 8.1 #> 4: 3 IDQ11295 QLD Brisbane QLD_PT001 -27.48080 153.0389 8.1 #> 5: 4 IDQ11295 QLD Brisbane QLD_PT001 -27.48080 153.0389 8.1 #> --- #> 787: 2 IDQ11295 QLD Port Douglas QLD_PT254 -16.48681 145.4635 70.4 #> 788: 3 IDQ11295 QLD Port Douglas QLD_PT254 -16.48681 145.4635 70.4 #> 789: 4 IDQ11295 QLD Port Douglas QLD_PT254 -16.48681 145.4635 70.4 #> 790: 5 IDQ11295 QLD Port Douglas QLD_PT254 -16.48681 145.4635 70.4 #> 791: 6 IDQ11295 QLD Port Douglas QLD_PT254 -16.48681 145.4635 70.4 #> start_time_local end_time_local utc_offset start_time_utc #> 1: 2021-10-01 05:00:00 2021-10-02 10:00 2021-09-30 19:00:00 #> 2: 2021-10-02 00:00:00 2021-10-03 10:00 2021-10-01 14:00:00 #> 3: 2021-10-03 00:00:00 2021-10-04 10:00 2021-10-02 14:00:00 #> 4: 2021-10-04 00:00:00 2021-10-05 10:00 2021-10-03 14:00:00 #> 5: 2021-10-05 00:00:00 2021-10-06 10:00 2021-10-04 14:00:00 #> --- #> 787: 2021-10-03 00:00:00 2021-10-04 10:00 2021-10-02 14:00:00 #> 788: 2021-10-04 00:00:00 2021-10-05 10:00 2021-10-03 14:00:00 #> 789: 2021-10-05 00:00:00 2021-10-06 10:00 2021-10-04 14:00:00 #> 790: 2021-10-06 00:00:00 2021-10-07 10:00 2021-10-05 14:00:00 #> 791: 2021-10-07 00:00:00 2021-10-08 10:00 2021-10-06 14:00:00 #> end_time_utc minimum_temperature maximum_temperature #> 1: 2021-10-01 14:00:00 NA 25 #> 2: 2021-10-02 14:00:00 14 28 #> 3: 2021-10-03 14:00:00 15 30 #> 4: 2021-10-04 14:00:00 16 33 #> 5: 2021-10-05 14:00:00 19 30 #> --- #> 787: 2021-10-03 14:00:00 23 32 #> 788: 2021-10-04 14:00:00 23 31 #> 789: 2021-10-05 14:00:00 23 31 #> 790: 2021-10-06 14:00:00 22 30 #> 791: 2021-10-07 14:00:00 23 29 #> lower_precipitation_limit upper_precipitation_limit precis #> 1: 10 20.0 Showers. Storm likely. #> 2: NA NA Sunny. #> 3: NA NA Sunny. #> 4: NA NA Sunny. #> 5: NA NA Sunny. #> --- #> 787: NA NA Sunny. #> 788: NA NA Sunny. #> 789: NA NA Sunny. #> 790: 0 0.2 Mostly sunny. #> 791: NA NA Partly cloudy. #> probability_of_precipitation #> 1: 90 #> 2: 5 #> 3: 0 #> 4: 5 #> 5: 20 #> --- #> 787: 10 #> 788: 10 #> 789: 10 #> 790: 30 #> 791: 20
# }