Skip to content

Commit

Permalink
[USGS-R#45], [USGS-R#48] pull aux (flow, water temp) data
Browse files Browse the repository at this point in the history
  • Loading branch information
jsadler2 committed Feb 23, 2022
1 parent 99d9adb commit 83b6d10
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion 1_fetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ p1_targets_list <- list(
p1_daily_data,
get_daily_nwis_data(p1_nwis_sites_daily,pcode_select,stat_cd_select,start_date=earliest_date,end_date=dummy_date),
pattern = map(p1_nwis_sites_daily)),


# Download NWIS daily data for other parameters (flow, temperature, SC) (see codes below)
tar_target(
p1_daily_aux_data,
dataRetrieval::readNWISdv(
siteNumbers = p1_nwis_sites_daily$site_no,
parameterCd=c("00060", "00010", "00095"),
statCd=stat_cd_select,
startDate=earliest_date,
endDate=dummy_date) %>%
dataRetrieval::renameNWISColumns() %>%
select(!starts_with("..2..")),
pattern = map(p1_nwis_sites_daily)),

# Save daily aux data to csv
tar_target(
p1_daily_aux_csv,
write_to_csv(p1_daily_aux_data, outfile="1_fetch/out/daily_aux_data.csv"),
format = "file"),

# Save NWIS daily data
tar_target(
Expand Down Expand Up @@ -181,6 +201,5 @@ p1_targets_list <- list(
read_csv(p1_ntw_adj_matrix_csv,show_col_types = FALSE)
)


)

0 comments on commit 83b6d10

Please sign in to comment.