It downloads monthly data from NOAA National Centers for Environmental Information (NCEI; https://www.ncdc.noaa.gov/cag/statewide/time-series), reshape the data to one column, and save the data to a specified location. It returns a dataframe with 2 columns. One column contains raw values and the other column contains scaled values with specified outpSut range. The values are average values from all states.

download_ncei(
  years,
  states,
  states_id,
  parameter,
  output_dir,
  scale_range = c(0, 2)
)

Arguments

years

a vector of years.

states

a vector of state names.

states_id

a vector of corresponding state ids from the NCEI website.

parameter

name of the parameter. Either "pcp" or "pdsi". pcp means precipitation and pdsi means Palmer Drought Severity Index.

output_dir

path to output csv file.

scale_range

output range (numeric vector of length two).