Changelog
Source:NEWS.md
rfaR 0.5.1
Summary
Fixes a bug reported by a tester where hydrograph_setup() produced NA for obs_vol when the input CSV contained trailing empty rows — a common artifact of read.csv() on Excel-exported files.
Root cause
read.csv() reads the full padded row range from Excel exports, producing trailing rows with NA in the Flow column and "" in Date/Time. These propagated through zoo::rollmeanr() as NA, poisoning obs_vol, and broke the routing extension’s time sequence.
Fix
Truncate each input hydrograph at the last row with a valid (non-NA) flow value. Interior NAs are preserved so malformed inputs fail loudly downstream, rather than being silently dropped. Emits a cli::cli_inform per hydrograph noting how many trailing rows were dropped.
Testing
Added tests/testthat/test-hydrograph_setup.R with two tests:
- Confirms
obs_volis finite when input has trailing empty rows, and matches the result from clean input - Confirms the
cli_informmessage fires with the correct row count
Both pass locally under devtools::test() and devtools::check().