Skip to contents

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 DESCRIPTION already 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 in inst/CITATION, CITATION.cff, README.md, both vignettes and the @references of R/model.R and R/physics.R. citation("soilFlux") now prints the right paper with all twelve authors.

Data provenance

  • swrc_example claimed 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 by data-raw/create_example_data.R from set.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.R rebuilds it from the accompanying article’s outputs and reproduces it byte for byte. make_swrc_figure.R was renamed make_swrc_curves_figure.R so 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 in if (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() and plot_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_n made the loss NaN, every gradient NaN, and every weight NaN after a single step. From then on the model predicted NaN for every input. Nothing reported it: the loop ran to the last epoch, and early stopping could not intervene because best_val starts at Inf and NaN < Inf is not TRUE, so no “best” weights were ever stored and the restore step was a no-op. fit_swrc() returned an ordinary swrc_fit and evaluate_swrc() then reported R2 = NA, n = 0.

    This was not an edge case. The bundled swrc_example carries 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_head or theta_n, reports how many, and records rows_kept and n_dropped as attributes so a caller can realign to its own data frame. Rows are tested with is.finite(), so infinities are caught as well as NA. It also now requires matric_head and theta_n to 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 returning R2, RMSE, MAE, Bias; it returns R2, RMSE, MAE, n, and has never had a Bias column 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 inserted monotone as the third parameter, ahead of val_df. A positional call fit_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 inside build_swrc_model(); for a single-row, single-column val_df it silently selected the free output head and trained a non-monotone model while reporting a monotone one. monotone now sits after K, 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

  • monotone is now validated in fit_swrc() and build_swrc_model(): it must be a non-missing logical scalar. This matters beyond a clearer error, because predict_theta_s(), print() and summary() read it back with isFALSE(), which is FALSE for any non-logical value. An unvalidated monotone made those three guards silently wrong: a free-head model could be reported as monotone and predict_theta_s() would return values from a theta_s layer that never received a gradient.

  • fit_swrc() also validates train_df, x_inputs and val_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() and residual_to_tensors() now require length(knot_grid) == K. The default knot_grid tracks K, so the two only disagree when both are supplied; that mismatch previously recycled the knot column into a K-row slice without complaint.

Documentation

  • predict_swrc_dense()’s pf_range was documented as defaulting to c(-2, 7.6). It defaults to NULL, 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 excluding param_model, which it does reconstruct.

  • fit_swrc()’s w_wet and w_dry now state that they are a second wet/dry weighting, multiplying with lambda_wet and lambda_dry over the same wet_split_cm split: w_dry = 10 on top of lambda_dry = 10 weights the dry end a hundredfold.

  • Every exported function now has an example (eight had none). The fit_swrc() example additionally exercises s3_form = "equality" and monotone = FALSE, the two options 0.1.6 introduced, and compute_physics_loss() gained an example contrasting the two S3 forms.

Testing

  • New test-arg-contracts.R locks the public signature of fit_swrc() – including val_df in third position – and covers every validation added here. It needs no TensorFlow.

soilFlux 0.1.6

New features

  • fit_swrc(s3_form = ) and compute_physics_loss(s3_form = ): the S3 dry-end residual can now be imposed as an equality, penalising mean |theta(pF1)| instead of mean 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 drags theta(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–S4 of 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, and compute_physics_loss() returned NaN from tf$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 default hidden and dropout regardless of what the saved model used, because fit_swrc() never recorded them. Any model trained with a non-default architecture therefore came back with a different topology. monotone, hidden, dropout and s3_form are 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 with monotone = FALSE instead of returning numbers. The free output head bypasses the theta_s branch, so that branch receives no gradient and keeps its random initialisation; the returned values were meaningless.
  • train.R: print() and summary() of an swrc_fit now 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.
    1. reference; corrected journal name from Journal of Hydrology to Water Resources Research.
  • Documentation: added missing \value tags to predict.Rd, predict.swrc_fit.Rd, print.swrc_fit.Rd, and summary.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 from save_swrc_model() to comply with CRAN policy against writing to the user’s home filespace by default; updated examples to use tempdir().

soilFlux 0.1.4

Bug fixes

  • Updated cran-comments.md to reflect version 0.1.4 submission.
  • Minor whitespace normalization in project configuration files.

soilFlux 0.1.3

Bug fixes

  • Added prebuilt vignette index (inst/doc/index.html) to fix CRAN NOTE “VignetteBuilder field but no prebuilt vignette index”.
  • Quoted technical acronyms ('CNN1D-PINN', 'SWRC', 'pF') in DESCRIPTION to reduce spell-check NOTEs on CRAN incoming checks.

soilFlux 0.1.2

Bug fixes

  • Fixed LaTeX PDF build error caused by Unicode character ≈ (U+2248) in .Rd documentation. Replaced with \eqn{\approx} in make_obs_matrices and swrc_example man pages.
  • Added inst/WORDLIST with domain-specific terms (SWRC, PINN, pF, Norouzi, matric, convolutional, positivity) to suppress spell-check NOTEs on CRAN incoming checks.

soilFlux 0.1.1

Bug fixes

  • Pre-built vignette output added to inst/doc/ to avoid LaTeX/Pandoc WARNINGs during CRAN checks.
  • Updated .Rbuildignore accordingly.

soilFlux 0.1.0

  • Initial CRAN submission.

New features