write.config.SIPNET warns about multiple vegetation PFTs when there's only one

Open Beginner friendly
#4,225 8 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@aarmens702-hub is already working on this.

Since Nov 4, 2026.

  • #4229 by @aarmens702-hub — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
backend

Research direction

Read models/sipnet/R/write.configs.SIPNET.R around lines 94–102 and compare how the ed and dalec couplers handle env. Then inspect test-write.config.SIPNET.R and add coverage for one vegetation PFT with empty env and for two real vegetation PFTs. Done when the empty env case produces no warning while two vegetation PFTs still trigger it; run the SIPNET tests.

Written by the indexing model from the issue text.

Description

Running Demo 1 (Basic Run) on develop (22ab283, macOS arm64, R 4.5.2), I get this warning once per ensemble member, so 10 times:

WARN [write.config.SIPNET] : SIPNET can only handle one vegetation PFT and one optional soil PFT. Passing multiple vegetation PFTs may lead to unexpected behavior.

The demo only has one PFT (temperate.coniferous), so I looked for where the second one comes from. The ensemble sampler always adds an env entry to the samples, even when it's empty:

https://github.com/PecanProject/pecan/blob/22ab2838613129f2c02c936f0fea29582aefc17c/modules/uncertainty/R/ensemble.R#L93-L94

So write.config.SIPNET receives trait.values with two names, temperate.coniferous and env. The check counts everything that isn't soil, so env looks like a second vegetation PFT:

https://github.com/PecanProject/pecan/blob/22ab2838613129f2c02c936f0fea29582aefc17c/models/sipnet/R/write.configs.SIPNET.R#L94-L102

Other couplers already skip env (for example write.configs.ed.R line 494 and write.configs.dalec.R line 87), so I think SIPNET's check just needs to do the same. Unless counting it is intentional?

What I'd suggest: leave soil and env out of the count before checking.

n_veg_pfts <- length(trait.values) - sum(names(trait.values) %in% c("soil", "env"))
if (n_veg_pfts > 1) {
  # existing warning
}

Plus a test in test-write.config.SIPNET.R: one PFT with an empty env shouldn't warn, and two real PFTs still should. I have this ready locally: the new test fails on develop and passes with the change, the rest of the SIPNET tests still pass, and Demo 1 goes from 10 warnings to 0.

I didn't find an existing issue for this. Happy to open a PR if this sounds right.

Disclosure: I used Claude Code (an AI coding agent) to run the demo on my machine, trace the cause, test the fix and draft this note.

@infotroph @divine7022

Dominant language
R
Stars
246
Forks
322
Avg merge
4d 22h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PecanProject/pecan

All issues in PecanProject/pecan

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.