Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions in inputObjects should produce a single object only #16

Closed
achubaty opened this issue Nov 29, 2018 · 4 comments
Closed

functions in inputObjects should produce a single object only #16

achubaty opened this issue Nov 29, 2018 · 4 comments

Comments

@achubaty
Copy link
Collaborator

@ianmseddy @CeresBarros @eliotmcintire

loadkNNSpeciesLayers produces a list that contains 2 input objects: speciesLayers and speciesList.

When providing a custom speciesLayers, the speciesList object wasn't being created and/or was being created from the default by running loadkNNSpeciesLayers and overwriting the custom speciesLayers object.

I am splitting the function in twain and reworking .inputObjects of the 3 modules that use loadkNNSpeciesLayers accordingly.

Please ensure to avoid this in the future.

@eliotmcintire
Copy link
Collaborator

Seems unnecessary, at this point. Just extract the two objects in the code:

a <- loadkNNSpeciesLayers(...)
if (!suppliedElsewhere("speciesLayers", sim) && (!suppliedElsewhere("speciesList", sim))) {
  sim$speciesLayers <- a$speciesLayers
  sim$speciesList <- a$speciesList
} else if (!(exists("speciesList", envir = sim) && exists("speciesLayers", envir = sim))) {
  stop("You must provide both speciesList and speciesLayers")
}

@CeresBarros
Copy link
Member

CeresBarros commented Nov 29, 2018

@achubaty loadKnnSpeciesLayers should no longer be in Boreal_LBMRDataPrep, but only in pemisc. Are you putting it back then?
Also, the behoviour of loadKnnSpeciesLayers has changed. Please use BiomassSpeciesData as a basis too replicate the use of loadKnnSpeciesLayers in Boreal_LBMRDataPrep

Finally, due to the use of equivalentNames the object speciesList had to be replaced in BiomassSpeciesData with a vector of species names sppNameVector. I didn't have time to do this in Boreal_LBMRDataPrep, but I can do it today if you prefer that I do this. Please let me know @achubaty.

@achubaty
Copy link
Collaborator Author

To clarify, I'm fixing the version in pemisc (master branch) which is used in 3 modules. I cannot use the development version as it breaks to many things at this point. Likewise BiomassSpeciesData.

@achubaty
Copy link
Collaborator Author

This issue was moved to PredictiveEcology/pemisc#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants