Skip to content

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

Open
infotroph wants to merge 15 commits intoPecanProject:developfrom
infotroph:rothc-opts
Open

Rothc: Soil file support + read options from settings file#3788
infotroph wants to merge 15 commits intoPecanProject:developfrom
infotroph:rothc-opts

Conversation

@infotroph
Copy link
Member

@infotroph infotroph commented Jan 18, 2026

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
Copy link
Member Author

infotroph commented Jan 20, 2026

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
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.

1 participant