Changelog
Source:NEWS.md
nwsrfsr 1.0.4
- Fix
forcing_adjbeing ignored byload_example()andnwsrfs_run(). The argument was accepted and stored on the returned object, but the model chain always calledfa_nwrfc()with the calibrated adjustment parameters, soforcing_adj = FALSEreturned the adjusted simulation. Python’sforcing_adj=Falsechanges the NRKW1 simulation by about 6 percent, which is why R and Python disagreed on the same call. -
forcing_adjnow also accepts a character vector naming a subset of “map”, “mat”, “ptps” and “pet”, matching the Python package.fa_nwrfc()andfa_adj_nwrfc()gained a correspondingadjustargument;dry_run = TRUEis unchanged and remains shorthand for adjusting nothing. - Add
return_insttoload_example(),nwsrfs_run()anduh(), matching Python. Withreturn_inst = FALSEthe unit hydrograph returns period average flow, the mean of each timestep and the one after it with the final value carried forward, computed before theshift_sfshift and before Lag-K routing is added. Default TRUE, which is the previous behaviour. - Drop the
n_clmodsbookkeeping row from theparstable carried on an “nwsrfs_run” object, so it matches the Python parameter table row for row.chanloss()now infers the module count from thecl_factor_##rows when that row is absent, and still honours it when present.
nwsrfsr 1.0.3
CRAN release: 2026-07-22
- Fix a segfault (
memory not mapped) reached by thersnwelev()example on the CRAN gcc build. The example passed zero-lengthtalr/pxtempvectors to the Fortran routine, which reads them asdimension(n_hrus), causing an out-of-bounds read.rsnwelev()now selects one parameter value per forcing zone and raises a clear R error whenelev,talrorpxtempare missing, and the example supplies the required parameters. - Fix uninitialised-memory reads reported by valgrind in the Lag/K routines.
pin7/fka7compared an uninitialised dimension string (setup calls were disabled in the wrapper port) andflag7read unwritten slots of its scratch array; all three are now initialised. Model output is unchanged. - Fix two
-Wlto-type-mismatchwarnings reported by the CRAN LTO and gcc-ASAN builds. The SNOW-17/SNUP19/common block left its first memberMFCimplicitly typed (INTEGER) inaesc19while it is REAL elsewhere, and/SNCO19/carried an extra trailingTAPREVmember inzero19that the other units do not (in this portTAPREVis a subroutine argument, not a common member). Both are now declared consistently. Model output is unchanged. - Declare the
umemstdummy array as assumed-size (IARRAY(*)) instead of the legacyIARRAY(1), which made agfortran -fcheck=allbuild abort with a spurious out-of-bounds error on the first real write. This lets the package run under Fortran runtime bounds checking. Model output is unchanged. - Disable floating-point expression contraction so simulation results agree across platforms. Compilers may fuse
a*b+cinto a single-rounding fused multiply-add, and whether they do varies by compiler version and CPU; in this iterated single-precision model chain the one-ulp differences are amplified by snow model thresholds into visibly different simulations (macOS/arm64 vs Linux/x86-64 differed by up to a few hundred cfs at individual flow peaks over a 43 year run). A newconfigurescript probes the Fortran compiler for-ffp-contract=offand applies it via a generatedsrc/Makevars(Makevars.winsets it directly since Rtools is always gfortran). With contraction off, results agree across macOS, Linux, x86-64 and arm64 to within libm rounding, which totals ~1e-4 mm of runoff over four decades. Model output changes very slightly on platforms that previously contracted.
nwsrfsr 1.0.2
CRAN release: 2026-07-17
- Fix installation failure under parallel make (
make -j) by declaring the missing Fortran module dependencies (sorting.o: types.oandsac_snow.o: utilities.o) insrc/Makevarsandsrc/Makevars.win.
nwsrfsr 1.0.0
CRAN release: 2026-07-16
- Initial CRAN release
- Low-level Fortran wrappers: sac_snow(), uh(), lagk(), chanloss(), consuse(), fa_nwrfc()
- High-level orchestration: nwsrfs_run(), load_example(), update_pars()
- AdjustQ preprocessing: adjustq(), adjustq_load_example()
- Bundled example data for NRKW1 and SFLN2 stations