PecanProject / pecan

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

`write.config.xml.ED2()` doesn't use correct ED2 default dataset. #3080

Closed Aariq closed 1 year ago

Aariq commented 1 year ago

Bug Description

Because the datasets history, history.r46, etc. are non-exported, data() doesn't work on them. Current code to find the correct dataset based on the <revision> tag is therefore broken

https://github.com/PecanProject/pecan/blob/ab55731c300e7eb0d97b04fe30b97cb405dccba5/models/ed/R/write.configs.ed.R#L451

Proposed solution

Internal data should be referenced with packagename:::dataset, so I'll replace the non-functioning code with a switch() statement like:

edhistory <- switch(revision, "85" = PEcAn.ED2:::history.r85, ...)