You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#' @description Download realtime discharge data from the Meteorological Service of Canada (MSC) datamart. The function will prioritize
17
17
#' downloading data collected at the highest resolution. In instances where data is not available at high (hourly or higher) resolution
18
-
#' daily averages are used. Currently, if a station does not exist or is not found, no data is returned. Both the province and the station number
19
-
#' should be specified.
18
+
#' daily averages are used. Currently, if a station does not exist or is not found, no data is returned.
20
19
#'
21
-
#' @param STATION_NUMBER Water Survey of Canada station number. No default. Can also take the "ALL" argument.
22
-
#' @param PROV_TERR_STATE_LOC Province, state or territory. See also for argument options.
20
+
#' @param STATION_NUMBER Water Survey of Canada station number. If this argument is omitted from the function call, the value of \code{PROV_TERR_STATE_LOC}
21
+
#' is returned.
22
+
#' @param PROV_TERR_STATE_LOC Province, state or territory. If this argument is omitted from the function call, the value of \code{STATION_NUMBER}
23
+
#' is returned. See \code{unique(realtime_network_meta()$PROV_TERR_STATE_LOC)}
23
24
#'
24
25
#' @return A tibble of water flow and level values
#' @description Returns all stations in the Realtime Water Survey of Canada hydrometric network operated by Environment and Cliamte Change Canada
159
189
#'
160
-
#' @param PROV_TERR_STATE_LOC Province/State/Territory or Location. See examples for list of available options. Use "ALL" for all stations.
190
+
#' @param PROV_TERR_STATE_LOC Province/State/Territory or Location. See examples for list of available options. realtime_network_meta() for all stations.
161
191
#'
162
192
#' @export
163
193
#'
164
194
#' @examples
165
195
#' ## Available inputs for PROV_TERR_STATE_LOC argument:
## Need to output a warning to see if any stations weren't retrieved
333
383
}
334
384
385
+
#' @title A function to download hydat
386
+
#'
387
+
#' @description Download the hydat sqlite database. The function will check for a existing sqlite file and stop if the same version
388
+
#' is already present. \code{download_hydat} also looks to see if you have the hydat environmental variable set.
389
+
#'
390
+
#' @param dl_hydat_here Directory to the hydat database. The hydat path can also be set in the \code{.Renviron} file so that it doesn't have to specified every function call. The path should
391
+
#' set as the variable \code{hydat}. Open the \code{.Renviron} file using this command: \code{file.edit("~/.Renviron")}.
392
+
#'
393
+
#' @export
394
+
#'
395
+
#' @examples \donttest{
396
+
#' download_hydat()
397
+
#' }
398
+
#'
399
+
400
+
download_hydat<-function(dl_hydat_here=NULL) {
401
+
402
+
response<- readline(prompt="Downloading HYDAT will take approximately 10 minutes. Are you sure you want to continue? (Y/N) ")
403
+
404
+
if(!response%in% c("Y","Yes","yes","y")){
405
+
stop("Maybe another day...")
406
+
}
407
+
408
+
if(is.null(dl_hydat_here)){
409
+
hydat_path= Sys.getenv("hydat")
410
+
if(is.na(hydat_path)){
411
+
stop("No Hydat.sqlite3 path set either in this function or in your .Renviron file. See tidyhydat for more documentation.")
0 commit comments