PecanProject / pecan

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

Add PFT prior checks #666

Open serbinsh opened 9 years ago

serbinsh commented 9 years ago

It is possible to unintentionally add multiple priors for a single variable in the BETYdb PFT descriptions. When this happens, PEcAn currently will fail with an error related to non-unique row names when requesting trait data and running the meta-analysis. For example:

2015-10-28 17:44:39 DEBUG  [check.settings] :
   Storing pft Optics.Temperate_Late_Hardwood in
   /data/sserbin/Modeling/ED2_Modeling/US-WCr/PEcAn.US-WCr/ED2.git.run/pecan.4/LH/
Warning in file.remove(file.path(settings$outdir, "STATUS")) :
  cannot remove file '/data/sserbin/Modeling/ED2_Modeling/US-WCr/PEcAn.US-WCr/ED2.git.run/pecan.4/STATUS', reason 'No such file or directory'
[1] FALSE
Warning: non-unique values when setting 'row.names': ‘leaf_reflect_nir’, ‘leaf_reflect_vis’, ‘leaf_trans_nir’, ‘leaf_trans_vis’
Error in `row.names<-.data.frame`(`*tmp*`, value = value) :
  duplicate 'row.names' are not allowed
Calls: get.trait.data ... rownames<- -> row.names<- -> row.names<-.data.frame

It would be good to add a check that looks for multiple priors, stops PEcAn, and provides an appropriate error message. We could also add an option to use, say, the first prior and drop the second but warn the user. @dlebauer any thoughts on what the best behavior would be for this issue?

serbinsh commented 9 years ago

By the way, I am now sad that I didn't wait until Saturday to post this given the issue num....

mdietze commented 9 years ago

Shawn, doesn't the current code do what you say -- it checks to see if there are duplicate rows and if there are it stops the code and gives a warning. Are you just asking for a more informative error message?

I think the code choosing which prior to use is a very bad idea. The correct behavior should be to stop and tell you to fix it.

serbinsh commented 9 years ago

@mdietze In this instance, the code did stop with the error message shown above. I am going to test to see if it gives the same general message in other cases. But yes, basically I think it would be helpful to provide a more detailed message that explains why the code stopped, and actually stop the code rather than ending in an error.

github-actions[bot] commented 4 years ago

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