downloadNWS: Function bulk downloads National Weather Service...

View source: R/downloadNWS.R

downloadNWSR Documentation

Function bulk downloads National Weather Service precipitation geotiff files

Description

Useful for automating download of large numbers of NWS spatial precipitation layers, and easily download new data. Stage 3 and Stage 4 data can be found at https://water.noaa.gov/resources/downloads/precip/

Usage

downloadNWS(
  data_folder,
  overwrite_data = FALSE,
  stage3_filename = "nws_precip_mtd_YYYYMMDD.tif",
  stage4_filename = "nws_precip_mtd_YYYYMMDD_conus.tif",
  day_range = 1,
  month_range = 1:12,
  year_range = 2005:as.numeric(format(Sys.Date(), format = "%Y"))
)

Arguments

data_folder

parent directory for data to be deposited. If this does not exist, it will be created.

overwrite_data

TRUE/FALSE value indicating whether existing files should be overwritten. If TRUE, all data are downloaded fresh.

stage3_filename

example of a stage 3 filename. YYYYMMDD is a token that will be replaced with actual dates. Adjusting this can accommodate odd filenames (e.g., stage 3 2017; stage 4 2016) and download different data types (e.g., 1 day, last 180 days)

stage4_filename

example of a stage 4 filename. YYYYMMDD is a token that will be replaced with actual dates.

day_range

numeric range of days, used in identifying files to download. Default only downloads data from the first of the month.

month_range

numeric range of months, used in identifying files to download. Default downloads data from all months.

year_range

numeric range of years, used in identifying files to download. Default downloads data from all years (filtered by available Stage 3/Stage 4 data).

Value

NULL downloadNWS downloads files to the provided 'data_folder' directory.

Examples

2+2

troyhill/SFNRC documentation built on Dec. 30, 2024, 4:32 p.m.