wrcc_loadMultiple: Load multiple WRCC RAWS timeseries objects from a local...

View source: R/wrcc_loadMultiple.R

wrcc_loadMultipleR Documentation

Load multiple WRCC RAWS timeseries objects from a local directory

Description

Loads WRCC station metadata and data from the rawsDataDir. If the data is not in this directory, this will download and save the data.

Usage

wrcc_loadMultiple(
  wrccIDs = NULL,
  meta = NULL,
  year = NULL,
  newDownload = NA,
  password = NULL,
  baseUrl = "https://wrcc.dri.edu/cgi-bin/wea_list2.pl",
  verbose = TRUE
)

Arguments

wrccIDs

Vector of RAWS station identifiers (will be upcased).

meta

Tibble of WRCC station metadata.

year

Year to access station data for.

newDownload

Logical flag stating whether or not to download and override existing data.

password

Password required for access to archival data.

baseUrl

Base URL for data queries.

verbose

Logical flag controlling detailed progress statements.

Value

List of timeseries objects each containing 'meta' and 'data'.

Note

The 'newDownload' parameter has three possible settings:

  • NA – Download data if it is not found in rawsDataDir

  • TRUE – Always download data, overwriting existing data in rawsDataDir. This is useful for updating data files with more recent data.

  • FALSE – Never download data. This is useful when working with wrcc_loadMultiple and archival data to avoid continually requesting data for stations which have no data over a particular time period.

References

Program for Climate, Ecosystem and Fire Applications

See Also

wrcc_createRawsObject

wrcc_load

setRawsDataDir

Examples

## Not run: 
# Fail gracefully if any resources are not available
try({

library(MazamaSpatialUtils)

setSpatialDataDir("~/Data/Spatial")
loadSpatialData("NaturalEarthAdm1")

library(RAWSmet)
setRawsDataDir("~/Data/RAWS")

wa_meta <- wrcc_loadMeta(stateCode = "WA")

wrccIDs <- c("waWENU", "waWASH", "waWALD")
stationData <-
  wrcc_loadMultiple(
    wrccIDs = wrccIDs,
    meta = wa_meta,
    year = 2020,
    newDownload = NA,
    password = MY_PASSWORD
  )

dplyr::glimpse(stationData)

}, silent = FALSE)

## End(Not run)


MazamaScience/RAWSmet documentation built on May 6, 2023, 6:57 a.m.