Skip to content

Rothc: Soil file support + read options from settings file#3788

Merged
infotroph merged 26 commits into
PecanProject:developfrom
infotroph:rothc-opts
Jun 25, 2026
Merged

Rothc: Soil file support + read options from settings file#3788
infotroph merged 26 commits into
PecanProject:developfrom
infotroph:rothc-opts

Conversation

@infotroph

@infotroph infotroph commented Jan 18, 2026

Copy link
Copy Markdown
Member

Description

  • Reads texture, bulk density, soil C from a soil_physics file (currently with no fallback)
    • TODO let carbon values from IC override these
  • Reads hydrology options and soil depth from settings$model, with fallback to RothC 2.1's out-of-the-box defaults.

Both were using constants hardcoded in write.config.RothC until now.

New utils function

Also adds PEcAn.utils::netcdf2df(), intended to be a general-purpose "please just dump this netcdf into a dataframe" function. So far I've tested it on files with only one dimension that varies (e.g. site-level files that might have a constant lat/lon alongside the depth or time); I'd love if it worked for higher dimensions too but did not tackle that today.

I use it here to read soil files -- I know PEcAn.data.land::pool_ic_netcdf2list() would work for this, but I'd rather not pull all the data.land dependencies into a model package if I don't have to.

Opinions requested on whether this is an improvement and where else it might come in handy.

Motivation and Context

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@infotroph

infotroph commented Jan 20, 2026

Copy link
Copy Markdown
Member Author

Current test failure is for not declaring a data.land import (for pool_ic_netcdf2list), but on consideration that's avoidable. I'll refactor Now refactored.

@infotroph infotroph marked this pull request as draft January 20, 2026 16:42
@github-actions github-actions Bot added the base label Jan 22, 2026
@infotroph infotroph marked this pull request as ready for review January 22, 2026 23:16

@abbylewis abbylewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infotroph this all seems very reasonable to me. I added two very minor suggestions.

Comment thread models/rothc/R/read_soil_physics.R Outdated
Comment thread models/rothc/R/read_soil_physics.R Outdated
Comment thread models/rothc/R/read_soil_physics.R Outdated
Comment thread models/rothc/R/read_soil_physics.R Outdated
@infotroph infotroph enabled auto-merge June 23, 2026 13:49
@infotroph infotroph disabled auto-merge June 25, 2026 07:33
@infotroph infotroph merged commit 3a8c485 into PecanProject:develop Jun 25, 2026
19 of 25 checks passed
@infotroph infotroph deleted the rothc-opts branch June 25, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants