soilFlux 0.1.10 (development)
Documentation corrections found while tidying the repository. No code changes, and no fitted result is affected.
The paper this package is built on was miscited everywhere
-
Four of the cited authors are not on it, and the journal was wrong. Every reference in the package named “Norouzi, A. M., Feyereisen, G. W., Papanicolaou, A. N., & Wilson, C. G. (2025) … Journal of Hydrology”. The paper is Norouzi, S., Pesch, C., Arthur, E., Norgaard, T., Moldrup, P., Greve, M. H., Beucher, A. M., Sadeghi, M., Zaresourmanabad, M., Tuller, M., Iversen, B. V., & de Jonge, L. W. (2025), Water Resources Research, 61(3), e2024WR038149, and the
DESCRIPTIONalready carried its DOI, doi:10.1029/2024WR038149, which is a Water Resources Research DOI. The citation was therefore contradicted by the package’s own metadata. Corrected against Crossref ininst/CITATION,CITATION.cff,README.md, both vignettes and the@referencesofR/model.RandR/physics.R.citation("soilFlux")now prints the right paper with all twelve authors.
Data provenance
-
swrc_exampleclaimed a tie to a database it has no tie to. Its documentation said the data “mimics the structure of the Florida Soil Characterization Database (FSCD) used in Rodrigues et al. / Norouzi et al. (2025)”, which can be read as implying that records from that database are bundled here. None are. The dataset is fully synthetic, generated bydata-raw/create_example_data.Rfromset.seed(2025), and the wording now says so and states explicitly that no third-party or institutional data are included in or distributed with this package.
Repository
-
Every generated artefact now has a generator in
data-raw/. The performance figure on the README,man/figures/pred_obs.png, was a binary with no script behind it;data-raw/make_pred_obs_figure.Rrebuilds it from the accompanying article’s outputs and reproduces it byte for byte.make_swrc_figure.Rwas renamedmake_swrc_curves_figure.Rso each script names the file it writes.
soilFlux 0.1.9
CRAN release: 2026-11-29
Restores the example style CRAN asked for and accepted, which the package had silently reverted, and makes five examples run that were hidden for no reason.
Documentation
\dontrun{}is gone again. The CRAN reviewer of the 0.1.5 submission asked for\donttest{}instead of\dontrun{}; 0.1.5 complied and was accepted on 2026-03-26. Commit 84c93d3, titled “Fix R CMD check errors”, then reverted all of it, so by 0.1.8 the package carried 15\dontrun{}blocks and none at all in\donttest{}– a regression against a point already settled with CRAN. All ten blocks that need TensorFlow are now\donttest{}and every one of them is wrapped inif (reticulate::py_module_available("tensorflow")), so on a machine without TensorFlow they are no-ops rather than failures.Five examples now simply run.
prepare_swrc_data(),build_residual_sets(),plot_swrc(),plot_pred_obs()andplot_swrc_metrics()were wrapped in\dontrun{}although none of them needs TensorFlow. Timed before unwrapping, they take 0.01 s to 0.18 s. They are ordinary executable examples now, and are checked on every run.build_swrc_model()’s example gained the TensorFlow guard the others had. It was the only block that both required TensorFlow and lacked one, which would have turned it from a skipped example into a failing one.
soilFlux 0.1.8
Fixes a silent training failure and three false claims on the package’s front page. Found by running the README’s own Quick start, which did not work.
Bug fixes
-
Training silently produced a dead model when any target was missing. The data loss is a sum over each batch, so one non-finite
theta_nmade the lossNaN, every gradientNaN, and every weightNaNafter a single step. From then on the model predictedNaNfor every input. Nothing reported it: the loop ran to the last epoch, and early stopping could not intervene becausebest_valstarts atInfandNaN < Infis notTRUE, so no “best” weights were ever stored and the restore step was a no-op.fit_swrc()returned an ordinaryswrc_fitandevaluate_swrc()then reportedR2 = NA, n = 0.This was not an edge case. The bundled
swrc_examplecarries 48 missing water contents by design, so the Quick start in the README – the first thing a new user runs – produced a dead model.make_obs_matrices()now drops rows with a missing covariate,matric_headortheta_n, reports how many, and recordsrows_keptandn_droppedas attributes so a caller can realign to its own data frame. Rows are tested withis.finite(), so infinities are caught as well asNA. It also now requiresmatric_headandtheta_nto be present at all, instead of silently producing zero-length vectors. fit_swrc()now aborts when the epoch loss is not finite, naming the two usual causes, rather than training on to the last epoch with dead weights. Any divergence – not only from missing data – is now loud.
Neither change affects a dataset with no missing values: no rows are dropped and the matrices are identical. The analysis behind the accompanying article filters missing water contents upstream when it builds its modelling table, so every published result is unchanged.
Documentation
The README advertised accuracy the package has never achieved. A “Performance” table claimed R² >= 0.97, RMSE < 0.030 and MAE < 0.020 on “held-out test pedons”, which is the setting the accompanying article reports as R² 0.765 pooled, 0.521 within-pedon, RMSE 0.054 and MAE 0.039. The table now carries those measured values, states the test set (2616 points, 462 curves, 113 held-out pedons of the NCSS Lab Data Mart) and compares against the Rosetta baselines on the same split. The figure above it displayed “R² = 0.944, RMSE = 0.0296” from a run whose provenance could not be established, and has been replaced. The new one is drawn from the saved M1 weights on the same held-out pedons, and the reconstruction was checked against the published metrics before it was used: n = 2616, R² = 0.7647, RMSE = 0.0540, MAE = 0.0393, all matching to four decimals. It prints only quantities reproduced that way – a curve count is omitted because no definition tried reproduced the published 462.
The README’s example output showed a column that does not exist.
evaluate_swrc()was shown returningR2, RMSE, MAE, Bias; it returnsR2, RMSE, MAE, n, and has never had aBiascolumn in any released version. The Quick start output is now a transcript of an actual run, and the function table was corrected in the same way.The Quick start now says up front that it runs on synthetic data, that the accuracy it shows says nothing about real soil, and that exact values differ between machines.
The citation named the wrong version and the wrong DOI. The block asked readers to cite “version 0.1.4” while giving 10.5281/zenodo.18990856, which is neither 0.1.4’s DOI nor the concept DOI but the version DOI of v0.1.0. The DOI badge pointed at the same v0.1.0 record, frozen there since March. Both now use the concept DOI, 10.5281/zenodo.18990855, which always resolves to the newest release.
soilFlux 0.1.7
A correctness release. No fitting behaviour changes: every result produced with 0.1.6 reproduces under 0.1.7, because the only functional changes reject input that 0.1.6 accepted and then mishandled.
Breaking change (restores the pre-0.1.6 signature)
-
fit_swrc()argument order. 0.1.6 insertedmonotoneas the third parameter, ahead ofval_df. A positional callfit_swrc(train, x, valid)that was correct in every earlier version therefore passed the validation frame into the architecture switch. In most cases that failed with an opaque “the condition has length > 1” from deep insidebuild_swrc_model(); for a single-row, single-columnval_dfit silently selected the free output head and trained a non-monotone model while reporting a monotone one.monotonenow sits afterK, so positions 1-11 are identical to 0.1.5 and earlier. Calls that named their arguments – including every script used for the accompanying article – are unaffected.
Bug fixes
monotoneis now validated infit_swrc()andbuild_swrc_model(): it must be a non-missing logical scalar. This matters beyond a clearer error, becausepredict_theta_s(),print()andsummary()read it back withisFALSE(), which isFALSEfor any non-logical value. An unvalidatedmonotonemade those three guards silently wrong: a free-head model could be reported as monotone andpredict_theta_s()would return values from atheta_slayer that never received a gradient.fit_swrc()also validatestrain_df,x_inputsandval_df, and now does all of its argument checking before initialising Python, so a bad call is rejected with a useful message where TensorFlow is absent.make_obs_matrices(),make_profile_array()andresidual_to_tensors()now requirelength(knot_grid) == K. The defaultknot_gridtracksK, so the two only disagree when both are supplied; that mismatch previously recycled the knot column into aK-row slice without complaint.
Documentation
predict_swrc_dense()’spf_rangewas documented as defaulting toc(-2, 7.6). It defaults toNULL, which inherits the range the model was fitted over – the same thing only when the fit used the default boundaries.load_swrc_model()’s return value was documented as excludingparam_model, which it does reconstruct.fit_swrc()’sw_wetandw_drynow state that they are a second wet/dry weighting, multiplying withlambda_wetandlambda_dryover the samewet_split_cmsplit:w_dry = 10on top oflambda_dry = 10weights the dry end a hundredfold.Every exported function now has an example (eight had none). The
fit_swrc()example additionally exercisess3_form = "equality"andmonotone = FALSE, the two options 0.1.6 introduced, andcompute_physics_loss()gained an example contrasting the two S3 forms.
Testing
- New
test-arg-contracts.Rlocks the public signature offit_swrc()– includingval_dfin third position – and covers every validation added here. It needs no TensorFlow.
soilFlux 0.1.6
New features
-
fit_swrc(s3_form = )andcompute_physics_loss(s3_form = ): the S3 dry-end residual can now be imposed as an equality, penalisingmean |theta(pF1)|instead ofmean relu(theta(pF1)). The default remains"inequality", exactly as published by Norouzi et al. (2025), so replication is unaffected.The published inequality asks only for
theta(pF 7.6) <= 0, which any non-positive value satisfies at zero cost. Under a monotone decreasing curve the penalty therefore pushes the whole dry end below zero, which dragstheta(pF 6.2)negative and puts S3 in direct conflict with S2 (theta(pF 6.2) >= 0). Measured over 462 test horizons, S3 is satisfied in 100% of curves at every lambda while S2 never exceeds 90.7%: S2 is the constraint that gives way. Since the physical statement is that water content at oven dryness is zero rather than at most zero, the equality form expresses the intended constraint and removes the conflict.Neither form excludes the degenerate solution
theta == 0, which satisfies all four residuals exactly; only the data term does.
Bug fixes
-
physics.R:S1–S4of zero now genuinely switch a residual term off.build_residual_sets()previously failed with replacement has 1 row, data has 0 when a count was zero, andcompute_physics_loss()returnedNaNfromtf$reduce_mean()over an empty tensor, silently poisoning the total loss. Both are fixed and covered by tests, which makes physics-free ablations possible for the first time. -
io.R:load_swrc_model()rebuilt the network with defaulthiddenanddropoutregardless of what the saved model used, becausefit_swrc()never recorded them. Any model trained with a non-default architecture therefore came back with a different topology.monotone,hidden,dropoutands3_formare now stored in the metadata and restored, with fallbacks so that models saved by earlier versions still load. -
predict.R:predict_theta_s()now aborts on a fit made withmonotone = FALSEinstead of returning numbers. The free output head bypasses thetheta_sbranch, so that branch receives no gradient and keeps its random initialisation; the returned values were meaningless. -
train.R:print()andsummary()of answrc_fitnow report which output head and which S3 form were used.
soilFlux 0.1.5
CRAN release: 2026-03-26
Bug fixes (CRAN reviewer requests)
-
DESCRIPTION: removed single quotes around acronyms (
CNN1D-PINN,SWRC,pF) — CRAN policy requires single quotes only for package/software names. -
DESCRIPTION: added
<doi:10.1029/2024WR038149>link to the Norouzi et al.- reference; corrected journal name from Journal of Hydrology to Water Resources Research.
-
Documentation: added missing
\valuetags topredict.Rd,predict.swrc_fit.Rd,print.swrc_fit.Rd, andsummary.swrc_fit.Rd. -
Examples: replaced all
\dontrun{}with\donttest{}throughout the package, as the examples can in principle be executed (they require TensorFlow, but are not inherently unrunnable). -
io.R: removed the default
dir = "./models/swrc"path fromsave_swrc_model()to comply with CRAN policy against writing to the user’s home filespace by default; updated examples to usetempdir().
soilFlux 0.1.2
Bug fixes
- Fixed LaTeX PDF build error caused by Unicode character
≈(U+2248) in.Rddocumentation. Replaced with\eqn{\approx}inmake_obs_matricesandswrc_exampleman pages. - Added
inst/WORDLISTwith domain-specific terms (SWRC,PINN,pF,Norouzi,matric,convolutional,positivity) to suppress spell-check NOTEs on CRAN incoming checks.
soilFlux 0.1.0
- Initial CRAN submission.
New features
-
build_swrc_model()— CNN1D monotone-integral architecture (Norouzi et al. 2025). -
fit_swrc()— Full training loop with physics constraints, early stopping, and configurable loss weights. -
predict_swrc()— Point predictions at arbitrary pF / matric-head values. -
predict_swrc_dense()— Dense continuous SWRC curves for any number of soil profiles. -
predict_theta_s()— Extract modelled saturated water content (θs). -
evaluate_swrc()— Compute R², RMSE, MAE on a test set. -
swrc_metrics()/swrc_metrics_by_group()— Regression performance metrics. -
norouzi_lambdas()— Loss-weight configurations from Norouzi et al. (2025) Table 1. -
build_residual_sets()/residual_to_tensors()— Physics collocation points (S1–S4). -
compute_physics_loss()— Evaluate the four physics constraints. -
fit_minmax()/apply_minmax()/invert_minmax()— Column-wise min-max scaling. -
prepare_swrc_data()— Standardise raw soil data (units, depth parsing, theta normalisation). -
make_obs_matrices()/make_profile_array()— Build 3-D sequence arrays for the CNN1D. -
parse_depth()/parse_depth_column()— Parse depth strings to midpoint and label. -
pf_from_head()/head_from_pf()/pf_normalize()/head_normalize()— pF / matric-head conversion helpers. -
fix_bd_units()/theta_unit_factor()— Automatic unit correction. -
save_swrc_model()/load_swrc_model()/swrc_model_exists()— Model persistence (weights + metadata). -
plot_swrc()— Publication-quality SWRC curve figure. -
plot_pred_obs()— Predicted vs. observed scatter plot with metrics. -
plot_swrc_metrics()— Bar chart comparing model performance. -
plot_training_history()— Training / validation loss curves. -
classify_texture()/add_texture()/texture_triangle()— USDA texture classification and ternary diagram. -
swrc_example— Example soil characterization dataset.
