get_daymet_featureids: get_daymet_featureids

Description Usage Arguments Details Value Examples

View source: R/retrieve_db.R

Description

get_daymet_featureids Queries and retrieves daymet data from postgres database stored in an array format

Usage

1
get_daymet_featureids(con, featureids)

Arguments

con

database connection returned from RPostgreSQL::dbConnect

featureids

numeric or character vector of featureids

Details

Intended for use with the sheds_new database on the osensei server

Value

Returns Dreturns data frame of daymet data with columns: [featureid, date, tmax, tmin, prcp, dayl, srad, vp, swe]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
con <- dbConnect(dbDriver("PostgreSQL"), dbname="daymet")

x0 <- get_daymet_featureids(con)                  # throws error: missing featureids
x0 <- get_daymet_featureids(con, featureids = "") # returns empty dataframe
x1 <- get_daymet_featureids(con, featureids = c(201407698))
x2 <- get_daymet_featureids(con, featureids = c(201407698, 201407699))
x3 <- get_daymet_featureids(con, featureids = c("201407698", "201407699"))
x5 <- get_daymet_featureids(con, featureids = c(201407698, 201407699, 201407700, 201407701, 201407702))
dbDisconnect(con)

# ggplot(x2, aes(date, tmin)) +
#   geom_line() +
#   facet_wrap(~featureid)

## End(Not run)

Conte-Ecology/conteStreamTemperature documentation built on Oct. 12, 2021, 10:26 p.m.