forked from DOI-USGS/dataRetrieval
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAAA.R
More file actions
76 lines (64 loc) · 2.65 KB
/
AAA.R
File metadata and controls
76 lines (64 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
pkg.env <- new.env()
.onLoad <- function(libname, pkgname) {
suppressMessages(setAccess("public"))
pkg.env$nldi_base <- "https://api.water.usgs.gov/nldi/linked-data/"
pkg.env$local_sf <- requireNamespace("sf", quietly = TRUE)
options("dataRetrieval" = list("api_version" = "v0"))
services <- c("server", "daily", "time-series-metadata",
"monitoring-locations", "latest-continuous",
"field-measurements", "latest-daily",
"continuous")
collections <- c("parameter-codes", "agency-codes", "altitude-datums", "aquifer-codes",
"aquifer-types", "coordinate-accuracy-codes", "coordinate-datum-codes",
"coordinate-method-codes", "medium-codes", "counties",
"hydrologic-unit-codes", "states",
"national-aquifer-codes", "reliability-codes", "site-types", "statistic-codes",
"topographic-codes", "time-zone-codes")
pkg.env$api_endpoints <- services
pkg.env$metadata <- collections
}
#' Is this a dataRetrieval user
#'
#' Reveals if this is a user or not
#' @export
#' @examples
#' is_dataRetrieval_user()
is_dataRetrieval_user <- function() {
interactive() ||
!identical(Sys.getenv("CI"), "") ||
identical(Sys.getenv("NOT_CRAN"), "true")
}
wqp_message <- function(){
message("NEWS: Data does not include USGS data newer than March 11, 2024. More details:
https://doi-usgs.github.io/dataRetrieval/articles/Status.html")
}
wqp_message_beta <- function(){
message("WQX3 services are in-development, use with caution.")
}
only_legacy <- function(service){
legacy <- service %in% c("Organization",
"ActivityMetric", "SiteSummary",
"Project", "ProjectMonitoringLocationWeighting",
"ResultDetectionQuantitationLimit", "BiologicalMetric")
return(legacy)
}
is_legacy <- function(service){
legacy <- service %in% c("Result", "Station",
"Activity", "Organization",
"ActivityMetric", "SiteSummary",
"Project", "ProjectMonitoringLocationWeighting",
"ResultDetectionQuantitationLimit", "BiologicalMetric")
return(legacy)
}
nwis_message <- function(){
return("WARNING: whatNWISdata does not include
discrete water quality data newer than March 11, 2024.
For additional details, see:
https://doi-usgs.github.io/dataRetrieval/articles/Status.html")
}
new_nwis_message <- function(){
return("ALERT: All NWIS services are slated for decommission
and new dataRetrieval functions will be added.
For up-to-date information, see:
https://doi-usgs.github.io/dataRetrieval/articles/Status.html")
}