new `fw13_load()` function
Closed this issue · 0 comments
jonathancallahan commented
The whole point of providing support for rawsDataDir
is to save already downloaded data for easy reuse. Now it's time to make that reuse easy. A new fw13_load()
function should accept the same arguments as fw13_timeseriesObject()
but should first look to see if it has already been saved. This implies that we have a standardized naming scheme for these datasets.
Ideally, a user would just type myStation <- fw13_load(<nwsID>, meta)
and get back the object. The second time they do this it will be lightning fast because they are getting the pre-downloaded, pre-generated object from their local computer.
Let me suggest the following structure for this function:
fw13_load(
nwsID = NULL,
meta = NULL,
baseUrl = "https://cefa.dri.edu/raws/fw13/",
verbose = TRUE
) {
# ----- Validate parameters -----
...
dataDir <- getRawsDataDir()
# ----- Check for local data -----
year <- lubridate::year(lubridate::now(tone = "UTC"))
fileName = sprintf("fw13_%s_%d.rda", nwsID, year)
# if found, get and return the data
# ----- Obtain data from WRCC -----
# rawsObject <- fw13_createTimeseriesObject()
# save this to dataDir
# ----- Return ------
}|