-
Notifications
You must be signed in to change notification settings - Fork 97
Add tzone attribute to all time columns #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
38cd972
abc80b3
2bfde8f
b1bc77d
d43ab4b
265900b
733ecd3
d0afc64
d40c7d7
fad6db1
5ba4e0d
9eafea3
ff73ff6
e3b4749
4af88be
a14be24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,3 +73,7 @@ vignettes/Reference_Lists.Rmd | |
| environment.yml | ||
| ^\.positai$ | ||
| ^\.claude$ | ||
| requirements.txt | ||
| ^\.venv$ | ||
| .env | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,5 @@ vignettes/*.R | |
| /.quarto/ | ||
| **/*.quarto_ipynb | ||
| .positai | ||
| /.venv/ | ||
| /.env/ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this is kinda "fringe" behavior, I feel like it could use a unit test in incomplete_dates <- read_waterdata_peaks(monitoring_location_id = "USGS-06334330")
expect_type(incomplete_dates$time, "character") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,11 @@ | |
| #' `r dataRetrieval:::get_properties_for_docs("peaks", "peak_id")`. | ||
| #' The default (`NA`) will return all columns of the data. | ||
| #' | ||
| #' @param allow_incomplete_dates Logical whether to allow incomplete dates | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this description is concise and good, but I do think more emphasis could be placed on the fact that the default argument setting may return a |
||
| #' in the "time" column to be converted to date objects (`TRUE`), or whether | ||
| #' to use the available year, month, day to get a character date only using | ||
| #' known values (`FALSE`). Default is `FALSE`. If `FALSE` but all dates are | ||
| #' complete the "time" column will remain a Date object. | ||
| #' @inheritParams check_arguments_api | ||
| #' @inheritParams check_arguments_non_api | ||
| #' | ||
|
|
@@ -45,6 +50,10 @@ | |
| #' monitoring_location_id = wi_peaks$monitoring_location_id[1], | ||
| #' parameter_code = "00060") | ||
| #' | ||
| #' incomplete_dates <- read_waterdata_peaks( | ||
| #' monitoring_location_id = "USGS-06334330", | ||
| #' parameter_code = "00060") | ||
| #' | ||
| #' } | ||
| read_waterdata_peaks <- function( | ||
| monitoring_location_id = NA_character_, | ||
|
|
@@ -64,6 +73,7 @@ read_waterdata_peaks <- function( | |
| time = NA_character_, | ||
| bbox = NA, | ||
| ..., | ||
| allow_incomplete_dates = FALSE, | ||
| convertType = getOption("dataRetrieval.convertType"), | ||
| no_paging = getOption("dataRetrieval.no_paging"), | ||
| chunk_size = getOption("dataRetrieval.site_chunk_size_meta"), | ||
|
|
@@ -75,7 +85,27 @@ read_waterdata_peaks <- function( | |
| rlang::check_dots_empty() | ||
|
|
||
| args <- mget(names(formals())) | ||
| args[["allow_incomplete_dates"]] <- NULL | ||
| return_list <- get_ogc_data(args, output_id, service) | ||
|
|
||
| if (anyNA(return_list[, c("year", "month", "day")])) { | ||
| if (allow_incomplete_dates) { | ||
| warning("Incomplete dates are included in time column.") | ||
| } else { | ||
| parse_time <- as.character(return_list$year) | ||
| parse_time[!is.na(return_list$month)] <- paste( | ||
| parse_time[!is.na(return_list$month)], | ||
| zeroPad(return_list$month[!is.na(return_list$month)], 2), | ||
| sep = "-" | ||
| ) | ||
| parse_time[!is.na(return_list$day)] <- paste( | ||
| parse_time[!is.na(return_list$day)], | ||
| zeroPad(return_list$day[!is.na(return_list$day)], 2), | ||
| sep = "-" | ||
| ) | ||
| return_list$time <- parse_time | ||
| } | ||
| } | ||
|
|
||
| return(return_list) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.