You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
write.config.RothC() ignores opt_SMDbare (reads opt_RMmoist for both options) #4217
In models/rothc/R/write.config.RothC.R the bare-soil option is read from the wrong setting:
rmmoist<-settings$model$opt_RMmoist %||% 1...smdbare<-settings$model$opt_RMmoist %||% 1# should be opt_SMDbare
The RothC book page (book_source/03_topical_pages/05_models/rothc.Rmd) and models/rothc/inst/workflow_example/template.xml both name the setting opt_SMDbare. As written, @OPT_SMDBARE@ in the input file always equals the opt_RMmoist value, and <opt_SMDbare> is silently ignored.
Reproduction
Run write.config.RothC() with <opt_RMmoist>1</opt_RMmoist> and <opt_SMDbare>2</opt_SMDbare>: the options line of RothC_input.dat is 1 1 instead of 1 2.
Proposed fix
Read settings$model$opt_SMDbare. I have a branch with a small test (it fails on current develop and passes with the fix); happy to send a PR if wanted.
I noticed model_depth_cm is computed but not passed to read_soil_physics(). There is a TODO: FIXME about soil depth there already, so I have left that alone.
@madhavzanwar Thanks for the report. Yes, PR welcome or I'll make a note to fix this in an upcoming refactor (new features coming, plus fixing how RothC currently expects to find options directly under settings$model rather than in settings$model$options as specified by the PEcAn documentation).
2. @madhavzanwar Thanks for the report. Yes, PR welcome or I'll make a note to fix this in an upcoming refactor (new features coming, plus fixing how RothC currently expects to find options directly under settings$model rather than in settings$model$options as specified by the PEcAn documentation).
Thanks @infotroph! PR is up: #4222. I kept the options directly under settings$model (matching the current code and the example template), so this stays a one-word fix. Happy to follow up on settings$model$options separately if you’d like.
Activity
madhavzanwar commentedon Nov 2, 2026
@infotroph a one-word fix plus a test is ready: https://github.com/madhavzanwar/pecan/tree/GH-4217-rothc-opt-smdbare (the test fails on develop and passes with the fix; the RothC suite passes). Happy to open the PR whenever you’d like. I left the soil-depth item alone because of the existing TODO: FIXME.
infotroph commentedon Nov 2, 2026
@madhavzanwar Thanks for the report. Yes, PR welcome or I'll make a note to fix this in an upcoming refactor (new features coming, plus fixing how RothC currently expects to find options directly under settings$model rather than in settings$model$options as specified by the PEcAn documentation).
madhavzanwar commentedon Nov 3, 2026
Thanks @infotroph! PR is up: #4222. I kept the options directly under settings$model (matching the current code and the example template), so this stays a one-word fix. Happy to follow up on settings$model$options separately if you’d like.
Merge upstream develop into PecanProjectGH-4217-rothc-opt-smdbare
Merge upstream develop into PecanProjectGH-4217-rothc-opt-smdbare