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

Upgrading to PyLCA v2.0 #168

Closed tjlca closed 2 years ago

tjlca commented 2 years ago

This branch updates the PyLCA to v2 with faster calculations, no optimization, better debugged USLCI database and overall better results.

rjhanes commented 2 years ago

@TJTapajyoti

I'm testing code commit 051416c on data commit d7d05a4 (tiny-data).

Line 170 in pylca_opt_background.py is throwing the following error:

FileNotFoundError: [Errno 2] No such file or directory: '../../celavi-data/generated/intermediate_demand_foreground_uslci_data.csv'

I get this error in model year 2050 (or possibly after the DES completes, I can't quite tell) when I use the shortcut LCA calculations; when I delete all the generated files and perform LCA from scratch, I get the error the first time the LCIA calculations are run in model year 2012.

Couple of things to fix here: (1) There should be no hard-coded data file names or directories in the code. Always use the YAML files and the file IO logic in scenario.py. (2) The write mode on line 170 in pylca_opt_background needs to be changed from 'a' for append (it looks for an existing file to add on to) to 'w' or another mode.

tjlca commented 2 years ago

I have added detailed information about the returned dataframes from the functions inside the pylcia.py files for most functions. Some functions are still left. I will keep on adding them. But other than that all other corrections have been completed and the code is running. I will keep an issue open for the final editing for docstrings for me to resolve. However, if you want you can proceed with the merge and conflict resolution. @rjhanes

rjhanes commented 2 years ago

Following PR 170 being merged into the pylcav2.0-upgrade branch, here is the testing & debug status (being updated as I complete steps):

Testing is complete, works great! @TJTapajyoti I think you're OK to merge into develop whenever you're ready. I'll work on updating the data repo branches in the meantime. All data repo branches should now work with the pyLCA2.0/stochastic updates.

For HPC runs, there is a scenario YAML file on OneDrive, under uncertainty/stochastic-yamls, called stochastic-scenario-4states. This will execute 1,000 runs varying the 8 parameters we discussed the other day. If it causes any problems, let me know as usual and I'll work to correct it ASAP.

tjlca commented 2 years ago

Following PR 170 being merged into the pylcav2.0-upgrade branch, here is the testing & debug status (being updated as I complete steps):

* [x]  Test on tiny data using baseline MCiC-MC case with no uncertainty - Complete, no errors, results are as expected (~200 s)

* [x]  Test on tiny data using 10_fgic_oaat.yaml file, 8/16 version on OneDrive - Complete, all good (636 s)

* [x]  Test on tiny data using stochastic-scenario.yaml file, 8/16 version on OneDrive - Complete, all good (756 s _without_ a starting shortcut database)

Testing is complete, works great! @TJTapajyoti I think you're OK to merge into develop whenever you're ready. ~I'll work on updating the data repo branches in the meantime.~ All data repo branches should now work with the pyLCA2.0/stochastic updates.

For HPC runs, there is a scenario YAML file on OneDrive, under uncertainty/stochastic-yamls, called stochastic-scenario-4states. This will execute 1,000 runs varying the 8 parameters we discussed the other day. If it causes any problems, let me know as usual and I'll work to correct it ASAP.

Thanks. I will get to this by tomorrow. I need to push the changes to the warning statements. Will push and perform a check so that it works fine.