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

TypeError: Could not convert blade manufacturing to numeric #195

Closed rjhanes closed 7 months ago

rjhanes commented 7 months ago

Error traces back to line 468 in compute_locations.py

Reproduced and identified error using master and tiny-data of celavi-data, fresh install following instructions in this repo's README

groupby.mean() is trying to average columns containing string values, resulting in the error

Fix: Specify that only the lat and long columns should be averaged during this groupby

Related fix: Pull out only the locations of power plants to calculate average lat/longs (by state), instead of all facility type locations

Related fix: At least one to_csv in scenario.py (line 518) has an unexpected keyword argument "line_terminator" - looks like this keyword changed to "lineterminator" at some point, per pandas.to_csv documentation.

After fixing lineterminator, now postprocessing hangs indefinitely after generating count_cumulative_histories.csv ...

Tracked down the hanging to line 164 of diagnostic_viz.py where the figure is written to file. Appears to be the same issues as here: https://community.plotly.com/t/static-image-export-hangs-using-kaleido/61519/4 The fix as per the webpage is to install Kaleido 0.1.0 (via conda, that's conda install python-kaleido==0.1.0) in the environment

(in the environment installed using the repo instructions, Kaleido 0.2.0 gets installed)

Had to use the conda-forge channel and it took an unnerving amount of time to solve the environment, but installation was successful

Almost, figure creation no longer hangs but there's one more line_terminator keyword in costgraph.py

Successfully completed simulation, diagnostic graphs created:

component_counts_0 material_mass_0

Before marking this solved and merging, I'll create a brand new environment with a fresh celavi install to make sure the kaleido issue was cleared up in 61d475c - and test again on tiny-data

Revised the exact version (0.1.0.post1 rather than 0.1.0) and successfully completed a full tiny-data run

rjhanes commented 7 months ago

Resolved in Release v1.3.2