Repository navigation
write sipnet.param at 17 digits - #4285
divine7022 wants to merge 5 commits into
Conversation
|
My preference would be to round values to four significant figures when writing to SIPNET input files (three would probably be sufficient). For allocation, adjust largest allocation param to enforce sum to 1 after rounding. Advantages:
Are there disadvantages to this approach? |
|
Seconding David here -- I don't think any Sipnet parameter is actually sensitive enough to need that many sigfigs. But (1) emphasis on "significant"; need to allow for params on scales far from unity (e.g. Where allocations sum to >1 I support adjusting them down, but I remember suggesting something like that before and having @mdietze list a bunch of cautions that showed that was trickier than it initially sounded. |
Description
write.config.SIPNET()writessipnet.paramwithwrite.table, which keeps 15 significant digits. Allocations that sum to exactly 1 can sum past 1 once written:0.25758166726134457, 0.4742485584847288, 0.26816977425392663comes out as0.257581667261345, 0.474248558484729, 0.268169774253927, and Sipnet exits at setup.sprintf("%.17g"), which always reads back to the same double. Note this changes param files in the last digits (0.6comes out0.59999999999999998), so the tests that matched param lines as strings now compare numbers.<constants>lost the same digits earlier: they come from XML as strings, soc()turned every value into 15 digit text. Each string constant now goes throughtype.convert()on its own, so a number set from R next to them isn't rounded either.I hit this with joint crop priors from an
ensemble.samples, where the coarse root share is 0 or within an eps of it. On Sipnet effadf3, 108 of those rows exit at setup on develop and run with this PR. Rewriting 20 members of an existing ensemble with both writers gave byte identicalsipnet.outin all 20 (andevents.outin 19; the other prints-0.00for0.00once).This moves the constants extraction, so whichever lands second carries the
type.convert()line.Not addressed here: harvest fractions from
write.events.SIPNET()have the same 15 digit problem, and the writer's ownsum_alloc > 1warning has no slack, so it can still warn on rows that now run.Motivation and Context
Review Time Estimate
Types of changes
Checklist: