Closed johnwang0576 closed 4 months ago
Hi @johnwang0576, not sure how I missed this, but in any case thanks for opening this up!
This is something that I've seen a couple of times, but stems from modifying the example workflow. In particular, sim.env.cleanup_log_files()
deletes the initialized operations and events logging files, and therefore the headers contained inside. I recommend moving this to either the end of your analysis workflow, or removing it altogether if you plan to inspect the files later because sim.run()
is recreating and writing to those files that have just been deleted.
Bellow, is what your example should look like to operate correctly. I'll be sure to update the documentation to be more clear about when users should and shouldn't run sim.env.cleanup_log_files()
.
from time import perf_counter
from wombat import Simulation
from wombat.core.library import load_yaml, DINWOODIE
library_path = DINWOODIE
config = load_yaml(library_path / "project/config", "base.yaml")
sim = Simulation.from_config(config)
start = perf_counter()
sim.run()
end = perf_counter()
timing = end - start
print(f"Run time: {timing / 60:,.2f} minutes")
sim.env.cleanup_log_files() # delete the events and operations CSV files
I was running the
how_to
jupyter notebook (see the code that I ran below) and encounter the following errors. I think the issue is that the code expects the first column of the event log file to have the column names. I can resolve this issue by setting the read_option to beReadOptions(autogenerate_column_names=True)
, but then another error popped up as the code is expecting the some fixed column names such asdate_time
.Code
Error Message
First 4 lines of the event log file (note no column names)