fix(utils): accept NULL as synonym for NA in read.output start/end year#3987
Merged
infotroph merged 4 commits intoMay 16, 2026
Merged
Conversation
Fixes PecanProject#3864. Previously start.year and end.year used NA as the sentinel for 'read all years', while variables, ncfiles, and pft.name used NULL. This inconsistency made the API confusing. Now NULL is silently converted to NA at the top of read.output(), so both sentinels work. Default values and existing behavior are unchanged. Adds a test confirming NULL and NA produce identical results.
The shared testdir accumulates files from previous tests, causing the year count assertion to fail. Use a fresh local_tempdir() so the test only sees exactly the two years it creates.
Regenerates the man page to reflect the NA/NULL synonym note added to the start.year/end.year parameter documentation.
Contributor
Author
Summary of changesThis PR fixes issue #3864 by accepting What was changed
CI notesThe
All base/utils tests pass: |
infotroph
requested changes
May 16, 2026
Member
infotroph
left a comment
There was a problem hiding this comment.
Thanks! Two quick tweaks in the inline comments, and can you please also add a bullet in NEWS.md?
Per infotroph review: change defaults from NA to NULL so the interface is consistent with other "use all" parameters (variables, ncfiles, pft.name). Both NULL and NA continue to work identically. Update docs to advertise NULL as the canonical sentinel, and add a NEWS.md entry.
Contributor
Author
|
Done - applied all three suggestions:
Both |
infotroph
approved these changes
May 16, 2026
Merged
via the queue into
PecanProject:develop
with commit May 16, 2026
672d5e4
19 of 25 checks passed
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.
For non-difftime inputs,
start.yearandend.yearusedNAas the sentinel for "read all years", whilevariables,ncfiles, andpft.nameall usedNULL. This inconsistency was confusing and undocumented.NULLis now silently converted toNAat the top ofread.output()so both sentinels work identically. Default values and all existing behavior are unchanged.Motivation and Context
Fixes #3864, flagged by @infotroph. The inconsistency made it easy to accidentally pass
NULLexpecting "read all years" and get unexpected behavior instead. Aligning the sentinel values makes the API consistent with every other parameter in the same function.Types of changes
Checklist