NREL / altrios

https://nrel.github.io/altrios/
Other
17 stars 5 forks source link

SLTS Demo Throws Error from Polars Code Writing Results #96

Open SWRIganderson opened 3 weeks ago

SWRIganderson commented 3 weeks ago

@mbbruch I'm sure this is something simple, but the SLTS example throws an error when its checking if the results were written. This is with the SLTS demo almost unchanged. I added one line of code to save the simulation to json. I would expect this to have no bearing on this error. Hopefully this is something pretty easy to fix, but I am no polars expert yet.

image

SWRIganderson commented 3 weeks ago

I'm using altrios version 0.2.3. I set it up last week in a new conda environment running python 3.10. Polars version '0.20.25'. Do we need to update our requirements.txt? Polars is at version 1.10.0 now.

mbbruch commented 3 weeks ago

I'll look into this... it's probably time to update the requirements.txt, but I'll need to do a scan through the codebase and update some Polars usage. The Polars API is considered stable now that it's past v1.0, but there were some breaking changes from 0.20 to 1.0.

mbbruch commented 3 weeks ago

@SWRIganderson to confirm, this is on main?

SWRIganderson commented 3 weeks ago

This is main. I have played around with this a bit more this morning. I was able to create the dataframe if I manually executed the code under the if statement. ENABLE_REF_OVERIDE is false. ENABLE_ASSERTS is true. That is why the error is occuring. Not the polars versions.

SWRIganderson commented 3 weeks ago

@mbbruch I was in between meetings earlier and couldn't type much. The two variables that I mentioned in my previous comment. Do those get set on the altrios install? I really feel like that example should work without errors straight out of the box without having to set environment variables. Is this being caused by me installing it for the development path? This is not an urgent problem. I just wanted to make sure you were aware so that we can have a good set of clean examples.

calbaker commented 3 weeks ago

@SWRIganderson can you post the head of to_dataframe_expected and train_sim.to_dataframe()[-1] here?

calbaker commented 3 weeks ago

@mbbruch and @SWRIganderson , we very intentionally do not have a requirements.txt because that's all handled in pyproject.toml. If you modified the demo file, that might well have altered train_sim.to_dataframe()[-1] to be inconsistent. The environment variable ENABLE_ASSERTS was set to true by default because I wanted to make sure the test_demos.py script actually ran an assert in this.

calbaker commented 3 weeks ago

@SWRIganderson, troubleshooting steps in no particular order: