-
Notifications
You must be signed in to change notification settings - Fork 14
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
Parameterize key query fields in riem_measures() #48
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!
R/measures.R
Outdated
latlon = "yes", | ||
date_start = "2024-01-01", | ||
date_end = as.character(Sys.Date()), | ||
# skip HFMETAR by default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why, by the way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, the IEM download page defaults to routine and specials, but not HFMETAR. They describe their rationale:
When in doubt, pick both routine and specials.
It seems to me that IEM is specifying their desired default behavior. Tangential, I've also found this IEM news article.
Second, there is a bandwidth/size penalty (9.1x) and time penalty (6.4x) when selecting HFMETAR. It seems like an unsafe default.
I compared two single data points:
I'm sure our friends at IEM would appreciate the bandwidth savings from users who don't really need HFMETAR.
Third, as a token consumer of this data, my specific application is hampered by the extra time required to download HFMETAR data ... but I'd be happy to set a parameter if I actually needed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, it makes sense!
…t values for station, date_start args (thus making them required); Convert elev and latlon to logicals; Update DESCRIPTION and documentation
Ready for review, pending my outstanding question on default value for |
I'm unsure what your standard practice is, but I'll leave it to you to click "Resolve conversation" on any items resolved to your liking. Thanks! |
@JElchison Thank you!! I made a few changes
I have two requests for you:
Afterwards I'll update the NEWS file and will plan a new release in January. Thanks again! |
@@ -1,9 +1,15 @@ | |||
#' Get weather data from one station | |||
#' | |||
#' @importFrom rlang `%||%` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -7,4 +7,5 @@ importFrom(jsonlite,read_json) | |||
importFrom(magrittr,"%>%") | |||
importFrom(rlang,"!!!") | |||
importFrom(rlang,"%||%") | |||
importFrom(rlang,`%||%`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line duplicative of the previous? (See comment below.) I'm uncertain about the nuance of backticks vs. double-quotes.
|
||
report_type <- report_type %||% c("routine", "specials") | ||
report_type <- tolower(report_type) # not case-sensitive | ||
report_type <- rlang::arg_match( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your use of a map to abstract away the literals!
One side effect of rlang::arg_match(multiple = TRUE)
, however, is that the error message can be misleading in terms of the number required:
! `report_type` must be one of "hfmetar", "routine", or "specials", not "3,4".
It's the one of
that throws me for a mild loop. I wonder if we could reduce any misleading by making line 12 a more clear comment, perhaps:
#' @param report_type A vector of strings, representing report types to query. The available options are "hfmetar", "routine", "specials". Default value is c("routine", "specials"). # nolint: line_length_linter
Yes, they look good! I asked a couple clarifying questions as comments.
Yes, will do! |
Expose key query fields in
riem_measures()
as parameters, including:data
(defaults toall
as before)elev
(defaults tono
as before)latlon
(defaults toyes
as before)report_type
(new default is3,4
, which skips HFMETAR)Update
date_start
to have safer default (2024 instead of 2014). Specify missingnometa
query field. Update comments, self-documentation, and lintr exceptions accordingly.