NREL / celavi

Codebase for the Circular Economy Lifecycle Assessment and VIsualization (CELAVI) modeling framework.
https://nrel.github.io/celavi/
GNU General Public License v3.0
9 stars 7 forks source link

add array-based uncertainty capability to develop #159

Closed rjhanes closed 2 years ago

rjhanes commented 2 years ago

See issue #156

@akey7 I have a specific question on this PR. I have a static method currently in CostMethods called apply_array_uncertainty. It takes the current model run and a quantity that can be a scalar or list, and if the quantity is a list it returns quantity[model run]. I'd like to have this method accessible throughout CELAVI (by the DES, Component, and PylcaCelavi modules) so we can more easily implement array-based uncertainty in parameters other than costs. Where do you recommend I locate this method so it's accessible everywhere? I first tried defining the method in scenario.py but got a circular import error.

akey7 commented 2 years ago

@rjhanes Have you tried turning the method apply_array_uncertainty into a standalone function in the scenario.py file? Then it could be imported from celavi.scenario with something like from celavi.scenario import apply_array_uncertainty.

rjhanes commented 2 years ago

@akey7 Aha! I had tried putting it in scenario.py, but I hadn't tried defining it before the from celavi.X import Y statement block. (which... I dislike having code before import statements, but I dislike broken code more) I tested commit f841e97 and apply_array_uncertainty imported successfully and worked where it was supposed to. Thanks!

rjhanes commented 2 years ago

Here are the YAML files for the array-based uncertainty runs (for use with the tiny dataset only) and a README with nomenclature and basic info. Each YAML file varies a single parameter. I've tested all 17 files and checked that results are generating correctly and look reasonable, i.e. costs are varying as expected.

tiny-array-yamls.zip README.txt

As before, the tiny-array-uncertainty data branch should be used for testing. I've updated the branch with the lca_db file that I was using, for quicker testing runs.

For non-tiny-data runs, I have another set of YAML files in our OneDrive, under the uncertainty/array-yamls directory. The main difference is that the YAMLs in OneDrive have location filtering turned on and reference the MidCase capacity projection file. I'm doing a final check on those files so they're not ready for use just yet; I'll send a message to the group once they're all set.