download_weather() makes it easy to download EnergyPlus weather files (EPW) and design day files (DDY).

download_weather(
  pattern,
  filename = NULL,
  dir = ".",
  type = c("all", "epw", "ddy", "stat"),
  ask = TRUE,
  max_match = 3
)

Arguments

pattern

A regular expression used to search locations, e.g. "los angeles.*tmy3". The search is case-insensitive.

filename

File names (without extension) used to save downloaded files. Internally, make.unique() is called to ensure unique names.

dir

Directory to save downloaded files. Will create if not exist.

type

File type to download. Only applicable to data provided by EnergyPlus website. For OneBuilding.org, "all" will always be used. Should be one of "all", "epw", "ddy" and "stat". If "all", all weather data will be downloaded in a ZIP file. Default: "all".

ask

If TRUE, a command line menu will be shown to let you select which one to download. If FALSE and the number of returned results is less than max_match, files are downloaded automatically without asking.

max_match

The max results allowed to download when ask is FALSE.

Value

A character vector containing paths of downloaded files.

Data sources

There are 2 data sources:

EnergyPlus sources allow downloading EPW, STAT, and DDY files separately while OneBuilding sources can only download them all through a ZIP file.

Author

Hongyuan Jia

Examples

# \dontrun{ download_weather("los angeles.*tmy3", "LosAngeles", tempdir(), ask = FALSE)
#> 2 matched results found. All of them will be downloaded: #> ── [1] USA_CA_Los.Angeles.Intl.AP.722950_TMY3 ────────────────────────────────── #> * Country: United States of America #> * State or Province: CA #> * Location: CA_Los.Angeles.Intl.AP #> * WMO number: 722950 #> * Source type: TMY3 #> * Longitude: -118.4 #> * Latitude: 33.93 #> * Provider: EnergyPlus.net #> #> ── [2] USA_CA_Los.Angeles.Intl.AP.722950_TMY3 ────────────────────────────────── #> * Country: United States of America #> * State or Province: CA #> * Location: Los Angeles Intl AP #> * WMO number: 722950 #> * Source type: TMY3 #> * Longitude: -118.4 #> * Latitude: 33.933 #> * Provider: Climate.OneBuilding.Org
#> [1] "/tmp/RtmpJovYRp/LosAngeles.zip" "/tmp/RtmpJovYRp/LosAngeles_1.zip"
# }