extract_huc_data_gauge: extract huc data listed by attribute

Description Usage Arguments Value Examples

View source: R/CAMELS.R

Description

This function takes a list of watershed Huc 8s and extracts daily mean forcing daymet data as well as relevant climate, geology, hyrdology, area, soil, topography and vegetation data

Usage

1
extract_huc_data_gauge(daymet_dir, attr_dir, huc8_names)

Arguments

daymet_dir

directory path to daymet data should look something like: "~/basin_dataset_public_v1p2/basin_mean_forcing/daymet" this directory pathway MUST end with the daymet/ folder – within this folder there should more directories (labeled '01', '02', '03' etc) representing different huc2 watersheds

attr_dir

directory path for attributes data (e.g: "~/camels_attributes_v2.0")

huc8_names

vector of huc8 watershed IDs

Value

named list for each huc8 with 8 nested named lists, one for each attribut of interest

Examples

 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
## Not run: 
daymet_dir <- "~/CAMELS/basin_dataset_public_v1p2/basin_mean_forcing/daymet"
attr_dir <- "~/CAMELS/camels_attributes_v2.0"
huc8_names <- c("01013500", "08269000")

data <- extract_huc_data_gauge(daymet_dir = daymet_dir, attr_dir = attr_dir, huc8_names = huc8_names)

## list of hucs queried
> names(data)
[1] "01013500" "08269000"

## names of dataframes within first list item
> names(data[[1]])
[1] "daymet"       "camels_clim"  "camels_geol"  "camels_hydro"
[5] "camels_name"  "camels_soil"  "camels_topo"  "camels_vege"

## same results using the huc ID for first ID in entered vector
> names(data[["01013500"]])
[1] "daymet"       "camels_clim"  "camels_geol"  "camels_hydro"
[5] "camels_name"  "camels_soil"  "camels_topo"  "camels_vege"

## getting data for specific attribute from huc 01013500
> data[["01013500"]]$camels_name
gauge_id huc_02 gauge_name
   <chr>    <chr>  <chr>
 1 01013500 01     Fish River near Fort Kent, Maine

## similarly using the $ syntax:
> data$`08269000`$camels_name
A tibble: 1 x 3
gauge_id huc_02 gauge_name
   <chr>    <chr>  <chr>
 1 08269000 13     RIO PUEBLO DE TAOS NEAR TAOS, NM
 
## End(Not run)

kylemonper/CamelsQuery documentation built on Aug. 30, 2020, 12:34 p.m.