Skip to content
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

Merged
merged 34 commits into from
Jan 10, 2025

Conversation

JElchison
Copy link
Contributor

Expose key query fields in riem_measures() as parameters, including:

  • data (defaults to all as before)
  • elev (defaults to no as before)
  • latlon (defaults to yes as before)
  • report_type (new default is 3,4, which skips HFMETAR)

Update date_start to have safer default (2024 instead of 2014). Specify missing nometa query field. Update comments, self-documentation, and lintr exceptions accordingly.

@JElchison JElchison marked this pull request as draft December 16, 2024 20:18
@JElchison JElchison marked this pull request as ready for review December 16, 2024 20:38
Copy link
Member

@maelle maelle left a 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 Show resolved Hide resolved
R/measures.R Outdated Show resolved Hide resolved
R/measures.R Outdated Show resolved Hide resolved
R/measures.R Outdated Show resolved Hide resolved
R/measures.R Show resolved Hide resolved
R/measures.R Outdated Show resolved Hide resolved
@JElchison JElchison marked this pull request as draft December 17, 2024 15:29
@JElchison JElchison marked this pull request as ready for review December 17, 2024 16:17
@JElchison
Copy link
Contributor Author

Ready for review, pending my outstanding question on default value for latlon. Thanks!

@JElchison
Copy link
Contributor Author

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!

@maelle
Copy link
Member

maelle commented Dec 19, 2024

@JElchison Thank you!! I made a few changes

  • use of rlang::is_character() since the package is importing rlang anyway.
  • made report_type hopefully more readable.
  • added some tests.

I have two requests for you:

  • do you agree with these changes?
  • I was not able to find a test case for "report_type". Could you help? It also might be that my refactoring of report_type's handling inadvertently broke it.

Afterwards I'll update the NEWS file and will plan a new release in January. Thanks again!

R/measures.R Outdated Show resolved Hide resolved
NAMESPACE Outdated Show resolved Hide resolved
R/measures.R Show resolved Hide resolved
@JElchison
Copy link
Contributor Author

  • do you agree with these changes?

Yes, they look good! I asked a couple clarifying questions as comments.

  • I was not able to find a test case for "report_type". Could you help? It also might be that my refactoring of report_type's handling inadvertently broke it.

Yes, will do!

date_end = "2013-12-01"))
})

# TODO validate 'data' against [all, tmpf, dwpf, relh, drct, sknt, p01i, alti, mslp, vsby, gust, skyc1, skyc2, skyc3, skyc4, skyl1, skyl2, skyl3, skyl4, wxcodes, ice_accretion_1hr, ice_accretion_3hr, ice_accretion_6hr, peak_wind_gust, peak_wind_drct, peak_wind_time, feel, metar, snowdepth] # nolint: line_length_linter
Copy link
Member

Choose a reason for hiding this comment

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

should we tackle this in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Short answer: I don't think so.

Longer answer: I left this TODO here as a placeholder while I ponder the merits of such a check. The more I think about it, the less I'm convinced of its value. data is the closest thing we have to a pass-through parameter. Since the only value our code counts in is all, and since we already test that case with a snapshot, I'm not sure what additional benefit that adding this check would provide. Certainly it would increase our dependence on IEM's data structure, as this test would need updated if IEM ever added, renamed, or removed any fields. Unless you object, I'm in favor to remove the TODO and instead rely on the existing snapshot to test what we care about.

@maelle
Copy link
Member

maelle commented Dec 20, 2024

@JElchison Thank you! Are you happy with my own changes to the checks on the data arguments? I'll come back to this PR in the new year, merge it and work on a release (I might also tackle the other breaking change at the same time). Thank you and happy holidays!

…ssociated test); Add/update comments for clarity
R/measures.R Outdated
#' @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")`.
#' The report is then in the `metar` column of the output.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The report is then in the metar column of the output.

FYI I'm removing this comment since it's untrue. A "report" in this context is a single line of reported weather data. Each report (line) is one of the 3 available report types. It's true that IEM modifies the METAR column in the case of hfmetar, but no observable changes are made in the METAR column for either routine or specials.

@JElchison
Copy link
Contributor Author

Are you happy with my own changes to the checks on the data arguments?

I sure am, thanks!

I've made a few final changes of my own ... mainly documentation, but also one fix (data needs to accept multiple fields). Please review at your leisure.

It looks like we are down to 2 "unresolved" conversations. If you're okay with their outcomes, then I'm good to button this up for merging in the new year.

Happy holidays to you as well!

@maelle maelle merged commit cda83b4 into ropensci:main Jan 10, 2025
5 checks passed
@maelle
Copy link
Member

maelle commented Jan 10, 2025

Happy New Year @JElchison! Thanks again for this PR!

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