inmet_download: Download INMET historical data archives

View source: R/download.R

inmet_downloadR Documentation

Download INMET historical data archives

Description

Downloads one or more annual ZIP files from INMET's historical data portal. Complete archives already in the cache are reused. Interrupted downloads are kept in a .part file and resumed on the next attempt.

Usage

inmet_download(
  years = as.integer(format(Sys.Date(), "%Y")),
  dest_dir = tools::R_user_dir("rmet", "cache"),
  max_tries = 15L,
  quiet = FALSE,
  force = FALSE
)

Arguments

years

Integer vector of years to download. Available years start in 2000. Defaults to the current year.

dest_dir

Character. Cache directory. It is created when necessary.

max_tries

Positive integer. Maximum attempts per year.

quiet

Logical. Suppress progress messages.

force

Logical. Download again even when a valid archive is cached.

Details

Files are first written to ⁠<year>.zip.part⁠. A partial file is never exposed as a complete ZIP. After an integrity check succeeds, the file is atomically moved to ⁠<year>.zip⁠ whenever the operating system permits it.

Value

Invisibly, a named character vector containing the paths of all successfully downloaded archives.

See Also

inmet_read(), inmet_get(), inmet_extract()

Examples


paths <- inmet_download(2023, dest_dir = tempdir())


rmet documentation built on Sept. 21, 2026, 5:08 p.m.