Repository navigation
Fix CTD index subsets that select fewer observations - #2382
Merged
richardsc merged 1 commit intoOct 18, 2026
Merged
Conversation
Collaborator
|
Tests pass, I'll merge. |
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.
Problem
The documented
subset(ctd, indices = ...)path compares the length of every data/flag vector with the number of selected indices, rather than the number of observations in the input. Selecting two rows from a five-row CTD therefore silently returns all five rows (and their original flags).Change
Use the input temperature-vector length to identify observation-length data and flags. This retains the existing treatment of uncommon-length items from #2250. Add synthetic public-API regression coverage for shorter, single-row, reordered, negative and empty selections, flags and station metadata.
Validation
131d14e99fe5ad3fbce68823ca33a28291fffe25and passes with this change; new testthat file passes.as.ctdexample passed.R CMD check --no-tests --no-examples --no-vignettes --no-manual: completed with 2 warnings (unbuilt vignettes) and 3 notes (unavailable suggests/xrefs and installed size). Full upstream tests/examples and vignette execution were not run; no private observation files, external data services or instruments were used.