Update DepthProfile.R#923
Draft
hillarymarler wants to merge 26 commits intodevelopfrom
Draft
Conversation
cristinamullin
previously approved these changes
Apr 27, 2026
Contributor
|
coverage-report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8267739 |
Collaborator
Author
|
Any thoughts on this error @cefergus or @cristinamullin?
|
Collaborator
This is an error the USGS dataRetrieval R package puts out when the services are not working properly. We can add dontrun to this example. |
for more information, see https://pre-commit.ci
surfacevalue or bottomvalue as NULL or "null" are treated as NA; only the categories that can be determined are assigned. If both are NA, the function won’t assign Surface/Middle/Bottom by thresholds but can still fall back to ActivityRelativeDepthName via ARD ref; otherwise “No depth info” is used where appropriate. Ensures depth units are single/consistent and errors otherwise (so you fail fast if upstream unit conversion was missed).
for more information, see https://pre-commit.ci
Behavior after the change dailyagg = "min" or "max": aggregatedonly = FALSE: All original rows are preserved for each group; the selected row is flagged as “Selected as min/max aggregate value …”, and all other rows in the same group are flagged as “Considered in minimum/maximum aggregation … but not selected.” aggregatedonly = TRUE: Only the selected rows are returned (no new IDs, no duplicates). dailyagg = "avg": Remains unchanged (still creates a separate aggregate row). If you want this to also avoid creating a new row, let me know and I’ll provide a parallel patch.
for more information, see https://pre-commit.ci
Unique depth counts: fully addressed (you replaced all occurrences with dplyr::n_distinct(..., na.rm = TRUE)). -Inf bottom guard: addressed via has_depths/case_when (once the pipe above is fixed). Optional: You can safely remove length.units, which is unused.
…PATADA into depth_profile_secchi_bug
for more information, see https://pre-commit.ci
This change ensures that if only some required columns are present, the code reliably falls into the else branch to add the missing columns by calling TADA_FlagDepthCategory.
for more information, see https://pre-commit.ci
This change prevents if(NA) errors by removing all string comparisons to "null" and using is.na(...) to branch on missing thresholds.
Only the unit-conversion branching is changed from a nested if (which can never execute) to an if/else so the conversion actually runs when units don’t match. Everything else remains the same.
…PATADA into depth_profile_secchi_bug
Column‑presence check should use all(...) with an else branch
Keep bind_rows and rm inside the “depth params present” block (brace fix)
for more information, see https://pre-commit.ci
TADA_DepthProfilePlot: fix critical runtime bugs and unreachable logic Add fail-fast argument validation for location, activity_date, and groups; remove unreachable code and verify values exist in the input data. Treat ActivityStartDateTime as optional: auto-create the column if missing and expand required columns to include fields used in hover text. Restrict depth-unit consistency check to non–depth-parameter rows, allowing later conversion of depth-parameter (e.g., Secchi) rows; stop if non-depth units don’t match the requested unit. Ensure profile.data is always defined by using depthprofile.avail when no requested groups are depth-parameter characteristics. Use is.na instead of is.null for surfacevalue and bottomvalue in depth category annotation logic to correctly handle “null” inputs normalized to NA.
for more information, see https://pre-commit.ci
Contributor
|
Spelling check failed. Details: |
1 similar comment
Contributor
|
Spelling check failed. Details: |
for more information, see https://pre-commit.ci
Contributor
|
Spelling check failed. Details: |
1 similar comment
Contributor
|
Spelling check failed. Details: |
Contributor
|
Spelling check failed. Details: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Pull Request Checklist (convert PR to draft if in progress)
Closes USEPA/TADAShiny#301
Bug fix for plot error if secchi depth is first characteristic selected. There was an erroneous reference to the 3rd param in the code chunk that build the scatterplot trace for the 1st param. This is now corrected. This should not require any changes in the Shiny app, but should allow the depth profile to work correctly even when secchi is selected as the first param.
Required
Update your branch from the latest
developand resolve any merge conflictsRun devtools::test(), devtools::check(), and devtools::document() locally; ensure tests pass and fix any errors, warnings, or notes. Add new dependencies to
DESCRIPTIONand document appropriatelyAdd/update vignettes for corresponding changes in functionality, list these under articles in _pkgdown.yml, and ensure added/updated vignettes run and build with proper formatting locally
Request review from at least one developer team member (convert PR to ready for review if it was designated as in progress)
Best practices
Include a summary of the changes made and relevant context/motivation
Link issues to auto-close on merge (use Development sidebar or include "Closes #" in the PR)
Refresh inline/block comments for clarity
Update roxygen docs and include examples; review help pages
Add/update tests in
tests/testthat; review the bot's coverage report from test-coverage and confirm all changes are coveredConditional
If there is a bot spelling comment, run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist()
If tests fail suggesting internal reference files need a refresh, run
.TADA_UpdateRefFiles()and.TADA_UpdateExampleData()locally viaMaintenanceScheduled.Ror trigger the Component File Update GitHub ActionIf new example data files were added, document them in
ExampleData.Rand include them inMaintenanceScheduled.Rfor regular refreshIf columns were added/updated, update
RequiredCols.RIf changes affect other package or the shiny app functions, update those impacted functions accordingly