PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 235 forks source link

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

Closed Aariq closed 1 year ago

Aariq commented 1 year ago

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.

Aariq commented 1 year ago

The code that triggers the latter error is here: https://github.com/PecanProject/pecan/blob/24d86aea844cbb58451e2fce5c204258f6bd7778/modules/uncertainty/R/run.sensitivity.analysis.R#L103-L109

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.

Aariq commented 1 year ago

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.