Skip to content

Add tzone attribute to all time columns#894

Merged
ldecicco-USGS merged 16 commits into
DOI-USGS:developfrom
ldecicco-USGS:develop
May 15, 2026
Merged

Add tzone attribute to all time columns#894
ldecicco-USGS merged 16 commits into
DOI-USGS:developfrom
ldecicco-USGS:develop

Conversation

@ldecicco-USGS
Copy link
Copy Markdown
Collaborator

No description provided.

Make the default for incomplete dates in peak endpoint return as char…
@ldecicco-USGS
Copy link
Copy Markdown
Collaborator Author

Also added new argument to peaks:

#' @param allow_incomplete_dates Logical whether to allow incomplete dates
#' 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.

Can try it out with this:

incomplete_dates <- read_waterdata_peaks(
               monitoring_location_id = "USGS-06334330",
               parameter_code = "00060")
incomplete_dates$time
 [1] "1972"       "1973"       "1974-01-16" "1975-03-25" "1976-02-14"
 [6] "1977"       "1978-03-22" "1979-07-25" "1980"       "1981"      
[11] "1982-06-06" "1982-10-09" "1984-07-07" "1985-03-17" "1986-03-17"
[16] "1987"       "1988"       "1989-03-10" "1990-06-16" "1991"      
[21] "1992-06-29" "1993-03-26" "1994-03-04" "1995-03-11" "1996-03-10"
[26] "1997-03-20" "1998-03-25" "1999-03-14" "2000-02-28" "2001-03-15"
[31] "2002-06-23" "2003"       "2004-08-03" "2005-08-11" "2006"      
[36] "2007-02-17" "2008-07-05" "2009-04-28" "2010-03-12" "2011-03-16"
[41] "2012"       "2013"       "2014-03-08" "2015-09-04" "2016-03-19"
[46] "2017"       "2018-04-23" "2019-03-23" "2019-10-20" "2020-02-28"
[51] "2020-06-30" "2021-04-09" "2022-05-30" "2023-06-27" "2024"      
[56] "2025-08-05"

Copy link
Copy Markdown
Collaborator

@jzemmels jzemmels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good. Just a couple notes/suggestions

Comment thread R/read_waterdata_combined_meta.R Outdated
Comment thread R/read_waterdata_peaks.R Outdated
#' `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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 time character column. Is this is the only read_waterdata function where that is the default behavior?

Comment thread R/read_waterdata_peaks.R
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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 tests_userFriendly_fxns.R to check that it works as-expected. Something like:

incomplete_dates <- read_waterdata_peaks(monitoring_location_id = "USGS-06334330")
expect_type(incomplete_dates$time, "character")

Co-authored-by: Joe Zemmels (he/him) <jzemmels@gmail.com>
@ldecicco-USGS ldecicco-USGS merged commit 41cb51a into DOI-USGS:develop May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants