PecanProject / pecan

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

Default when `<ensembles>` is missing is not functional #3024

Open Aariq opened 2 years ago

Aariq commented 2 years ago

Bug Description

According to the PEcAn documentation, "As with meta.analysis, if [ensemble] is missing, then PEcAn will not do an ensemble analysis."

What actually happens is check.ensemble.settings() adds the following into the settings xml:


 <ensemble>
  <samplingspace>
   <parameters>
    <method>uniform</method>
   </parameters>
   <met>
    <method>sampling</method>
   </met>
  </samplingspace>
 </ensemble>

This is missing a <size> tag though, and errors uninformatively when run.write.config() is run with Error in if (settings$ensemble$size == 1) { : argument is of length zero

This might only happen if there is also no sensitivity analysis specified. Either way the error should at least be informative.

To Reproduce

pecan.xml:

``` xml Test Data for PEcAn.ED2 /home/ericrscott/model-vignettes/ED2/testoutput/no_ensemble/outdir PostgreSQL bety bety postgres bety FALSE /data/dbfiles SetariaWT 1 ebifarm.c3grass 5 3000 TRUE 1.2 TRUE ED2 /groups/dlebauer/ed2_results/global_inputs/ed2_2.2.0_singularity.sh 14 /pecan/models/ed/inst/ED2IN.r2.2.0 0.01 12 0 0 0 0 0 1 76 2004-09-01 00:00:00 2005-01-02 00:00:00 /data/sites/ebifarm/ED_MET_DRIVER_HEADER /data/oge2OLD/OGE2_ /data/faoOLD/FAO_ /data/ed_inputs/glu/ /data/ed_inputs/ 2004-09-01 2005-01-01 puma /groups/dlebauer/ed2_results/pecan_remote sbatch --job-name=@NAME@ --account=dlebauer --ntasks=28 --nodes=3 --time=25:00:00 -o @STDOUT@ -e @STDERR@ .* ([0-9]+) 'squeue --job @JOBID@ &> /dev/null || echo DONE' module load openmpi3 /groups/dlebauer/ed2_results/pecan/contrib/modellauncher/modellauncher --partition=standard module load openmpi3; mpirun ```

Expected behavior

Either a sensible default for settings$ensemble or an informative error about a missing settings$ensemble

Additional context:

Comment from @mdietze on Slack:

So the possible exceptions would be: 1) if one is just running a sensitivity analysis. In that case I can't remember if the SA will run the "default" case itself or whether it relies on an ensemble of size=1 to provide that default. 2) if one is doing a PDA run, which should take care of parameter sampling and model execution on it's own and you don't want to do an ensemble run first. SDA runs would be similar, but there I think you do need to include the ensemble tag since the SDA runs are all ensemble-based

Aariq commented 2 years ago

Same behavior when a sensitivity analysis is specified without an ensemble tag.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 365 days with no activity.