Skip to contents

Accesses and downloads Oregon State University's PRISM data from the PRISM Climate Group Web Service

Usage

download_prism(
  time,
  element = c("ppt", "tmin", "tmax", "tmean", "tdmean", "vpdmin", "vpdmax", "solslope",
    "soltotal", "solclear", "soltrans"),
  data_type = c("ts", "normals_800", "normals"),
  format = c("nc", "asc", "grib2"),
  directory_to_save = NULL,
  acknowledgement = FALSE,
  download = FALSE,
  remove_command = FALSE,
  hash = FALSE
)

Arguments

time

character(1). Length of 2, 4, 6, or 8. Time period for time series or normals. According to the PRISM Web Service Guide, acceptable formats include (disclaimer: the following is a direct quote; minimal formatting is applied): Time Series:

  • YYYYMMDD for daily data (between yesterday and January 1st, 1981) – returns a single grid in a .zip file

  • YYYYMM for monthly data (between last month and January 1981) – returns a single grid in a .zip file

  • YYYY for annual data (between last year and 1981) - returns a single grid in a .zip file

  • YYYY for historical data (between 1980 and 1895) - returns a single zip file containing 12 monthly grids for YYYY plus the annual.

Normals:

  • Monthly normal: date is MM (i.e., 04 for April) or the value 14, which returns the annual normal

  • Daily normal: date is MMDD (i.e., 0430 for April 30)

element

character(1). Data element. One of c("ppt", "tmin", "tmax", "tmean", "tdmean", "vpdmin", "vpdmax") For normals, c("solslope", "soltotal", "solclear", "soltrans") are also accepted.

data_type

character(1). Data type.

  • "ts": 4km resolution time series.

  • "normals_800": 800m resolution normals.

  • "normals": 4km resolution normals.

format

character(1). Data format. Only applicable for data_type = "ts".

directory_to_save

character(1). Directory to download files.

acknowledgement

logical(1). By setting TRUE the user acknowledges that the data downloaded using this function may be very large and use lots of machine storage and memory.

download

logical(1). FALSE will generate a *.txt file containing all download commands. By setting TRUE the function will download all of the requested data files.

remove_command

logical(1). Remove (TRUE) or keep (FALSE) the text file containing download commands.

hash

logical(1). By setting TRUE the function will return an rlang::hash_file() hash character corresponding to the downloaded files. Default is FALSE.

Value

  • For hash = FALSE, NULL

  • For hash = TRUE, an rlang::hash_file character.

  • .bil (normals) or single grid files depending on the format choice will be stored in directory_to_save.

References

article_daly2000prismamadeus

Author

Insang Song

Examples

download_prism(
  time = "202104",
  element = "ppt",
  data_type = "ts",
  format = "nc",
  directory_to_save = tempdir(),
  acknowledgement = TRUE,
  download = FALSE, # NOTE: download skipped for examples,
  remove_command = TRUE
)
#> Skipping data download.
#> Requests were processed.