Skip to content
Merged

Pdas #76

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^vignettes/precompile\.R$
^reviews$
^\.claude$
\.qmd$
2,349 changes: 1,636 additions & 713 deletions R/get_preliminary_damage_assessments.R

Large diffs are not rendered by default.

29 changes: 20 additions & 9 deletions R/get_usgs_gage.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,26 @@ get_usgs_gage = function(
## daily_max must be computed from the continuous ("Instantaneous") record.
## Each series' period-of-record start is retained: the continuous endpoint
## needs explicit time bounds (see below)
site_inventory = dataRetrieval::read_waterdata_ts_meta(
monitoring_location_id = site_metadata$monitoring_location_id,
parameter_code = parameter_code,
computation_identifier = dplyr::if_else(
statistic == "daily_mean", "Mean", "Instantaneous"),
computation_period_identifier = dplyr::if_else(
statistic == "daily_mean", "Daily", "Points"),
skipGeometry = TRUE) %>%
tibble::as_tibble() %>%
## request the inventory in batches of ten sites. dataRetrieval 2.7.25 splits
## long site lists into several requests itself, but if any one request
## matches no series it types that batch's begin_utc/end_utc columns as
## character rather than datetime and fails when combining batches ("Corrupt
## POSIXct" from vctrs). Ten site IDs always fit in a single request, and
## keeping only the columns used here avoids the mistyped ones
site_inventory = site_metadata$monitoring_location_id %>%
split(ceiling(seq_along(.) / 10)) %>%
purrr::map(
~ dataRetrieval::read_waterdata_ts_meta(
monitoring_location_id = .x,
parameter_code = parameter_code,
computation_identifier = dplyr::if_else(
statistic == "daily_mean", "Mean", "Instantaneous"),
computation_period_identifier = dplyr::if_else(
statistic == "daily_mean", "Daily", "Points"),
skipGeometry = TRUE) %>%
tibble::as_tibble() %>%
dplyr::select(monitoring_location_id, begin)) %>%
purrr::list_rbind() %>%
## a site can have several series (e.g. sublocations); keep the earliest
dplyr::summarize(
record_begin_date = as.Date(min(begin, na.rm = TRUE)),
Expand Down
1 change: 0 additions & 1 deletion man/climateapi-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

233 changes: 167 additions & 66 deletions man/get_preliminary_damage_assessments.Rd

Large diffs are not rendered by default.

27 changes: 6 additions & 21 deletions man/scrape_pda_pdfs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading