PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.

Home Page:www.pecanproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`run.sensitivity.analysis()` not creating `sensitivity.results.Rdata`

Aariq opened this issue · comments

Bug Description

I'm working on runs with sensitivity analysis of ± 1 SD and run.sensitivity.analysis() generates plots correctly but does not save sensitivity.results.Rdata. In addition, I get error messages from splinefun such as:

Error in stats::splinefun(quantiles.input, quantiles.output, method = "monoH.FC") : 
  length(m) must be at least two

or

Error in stats::splinefun(quantiles.input, quantiles.output, method = "monoH.FC") : 
  zero non-NA points
In addition: Warning message:
In run.sensitivity.analysis(settings) :
  missing >2 runs for 'quantum_efficiency','cuticular_cond','SLA','stomatal_slope','fineroot2leaf','Vcmax' 
 sensitivity analysis or variance decomposition will be performed on these trait(s) 
 it is likely that the runs did not complete, this should be fixed !!!!!!

But as far as I can tell, neither of these is true. The latter error didn't happen when I stepped through the function in debug, I'm pretty sure. Still haven't pinned this one down, but I'll edit this issue when I figure out the problem.

The code that triggers the latter error is here:

good.saruns <- sapply(sensitivity.output[[pft$name]], function(x) sum(is.na(x)) <=2)
if(!all(good.saruns)) { # if any bad saruns, reduce list of traits and print warning
bad.saruns <- !good.saruns
warning(paste('missing >2 runs for', vecpaste(traits[bad.saruns]),
'\n sensitivity analysis or variance decomposition will be performed on these trait(s)',
'\n it is likely that the runs did not complete, this should be fixed !!!!!!'))
}

But if I load sensitivity.output manually and inspect it, it has 3 rows and no NAs, so this shouldn't be triggering an error.

Oh, this is likely because I deleted the run folders generated for SA for one of the PFTs, which I think is the only way to "turn off" sensitivity analysis for a PFT. I'll still try to see if there is a solution that still exports the data in some form.