Repository navigation
fix(SIPNET): apply plantStorageNInit default conditionally (#4114) - #4117
coder-Yash886 wants to merge 19 commits into
Conversation
9e48e89 to
7c9825e
Compare
|
@dlebauer Please review the Pr When you have free time |
59bae89 to
3f187af
Compare
|
@divine7022 @infotroph @dlebauer I have addressed all your comments Please Review the PR when you have free time |
|
@coder-Yash886 run |
divine7022
left a comment
There was a problem hiding this comment.
@coder-Yash886 thanks for turning this round quickly!
CI fails isn't only .Rd sync that @S1DDHEY flagged; devtools::document
will fix that one, but test file also doesn't pass. the new plantStorageNInit precedence in v2 test matches on the literal string plantStorageNInit 5.0 while the writer emits plantStorageNInit 5, and carbon-limited leaf flush block is still have the computed behaviour this PR removes
not blocking -- update News.md and it still describe the computed default
|
plantStorageNInit here is sipnet parameter name rather than a standard_vars one, so this branch only fires for a hand built poolinitcond file. meanwhile soil_organic_nitrogen_content is standard var that read from the IC nc, it's not in this list. fine by me if the sipnet name is what you agreed on, but #4116 is going to add the soil and litter side and it'd be good if the two don't end up on different naming conventions |
|
@divine7022 @dlebauer Changes addressed Please review the Pr when you have free time |
infotroph
left a comment
There was a problem hiding this comment.
Posting some comments I had started before your last commit, with apologies if you resolved / changed these already.
@divine7022 I don't know of any documented names for storage pools in the existing standard vars, so I'd say the choice is between "make up something that looks similar" ( I lean weakly[*] toward the former today, but will go along with what you like. The existing IC.nc names are such a mess that I don't think we can make it worse here -- I mean look at this, we have camelcase and snake case AND spaces! 😉 [*] So weakly I came back to edit my vote after posting... |
|
@divine7022 @infotroph @dlebauer Please review the pr |
|
@dlebauer @divine7022 Sir please review the Pr |
- Fix expect_match
6a85923 to
5da8cc2
Compare
divine7022
left a comment
There was a problem hiding this comment.
@coder-Yash886 thanks, this looks good. few things before i approve
please resolve conflict, keeping develop’s test and dropping the old block should do it
…d restore events check
|
@infotroph @divine7022 @dlebauer Please review the Pr when you have free time |
There was a problem hiding this comment.
This looks good to me but let's get an explicit 👍 / 👎 from @divine7022: Have your comments been addressed and are you happy with where we landed on plantStorageNInit as the name to use in the IC file?
divine7022
left a comment
There was a problem hiding this comment.
@infotroph 👍, since there's no standard var for plant storage N pool, and it's sipnet's conceptual pool anyway. one thing to keep in mind, since it isn't in standard_vars, IC prep can't write it today. fine for this PR, and if we want IC files to carry it that's when to decide on name, probably alongside soil N in #4116 ( which is still open)
@coder-Yash886 thanks, ci still failing and doc being out of sync
|
Hi @divine7022 @infotroph @dlebauer Please review the pr when you have the free time. |
divine7022
left a comment
There was a problem hiding this comment.
thanks @coder-Yash886! could you please just drop it and keep the plantStorageNInit part ?
make sure you run make document after
…d resolve test conflict
divine7022
left a comment
There was a problem hiding this comment.
thanks @coder-Yash886. one small suggestion on test, not blocking
| run.id = "run_v2_default" | ||
| ) | ||
| param_default <- readLines(file.path(pth, "run", "run_v2_default", "sipnet.param")) | ||
| expect_match(param_default, "plantStorageNInit 5", fixed = TRUE, all = FALSE) |
There was a problem hiding this comment.
since this is a substring match, it also passes with the old computed 5.04 in place, so nothing here fails if the template value gets overwritten again. checking the value itself would catch that:
| expect_match(param_default, "plantStorageNInit 5", fixed = TRUE, all = FALSE) | |
| p <- utils::read.table(file.path(pth, "run", "run_v2_default", "sipnet.param")) | |
| expect_equal(p[p[[1]] == "plantStorageNInit", 2], 5) |
Closes #4114
What Changed
1.
inst/template.param_v2— Static default value set to5.0Changed
plantStorageNInitfrom0.0→5.0g N m⁻². This value (derived from the Niwot-specific template:plantWoodInit = 30000g C m⁻² →~5.04g N m⁻²) ensures the first leafon event is not suppressed when the nitrogen cycle is active, without requiring any computation insidewrite.config.2.
R/write.configs.SIPNET.R— Dropped dynamic unconditional overwriteplantStorageNInitthat previously overwrote template values unconditionally (violating the pattern used by all other parameters inwrite.config.SIPNET).has_n_cycle = rev_str == "v2"to thecapslist (suggested by @infotroph) — replacing the implicit and misleading"plantStorageNInit" %in% param[, 1]check.ICprecedence handling forplantStorageNInitvia both theICargument andpoolinitcond, including explicit zero values.plantStorageNInitsupport viatrait.valuesfor v2.3.
tests/testthat/test-write.config.SIPNET.R— Cleaned up + new tests5.0is preserved when no IC is provided.IC = 0(intentional nitrogen-limited start) is respected.IC = 12.5(explicit non-zero) is respected.4.
man/write.config.SIPNET.Rd— Documented precedenceAdded a Parameter precedence section explaining the override order:
template →
defaults$constants→trait.values→IC/poolinitcond(highest, including explicit zero).