diff --git a/sumo_project/emissions.py b/sumo_project/emissions.py index 5c11a41..d155679 100644 --- a/sumo_project/emissions.py +++ b/sumo_project/emissions.py @@ -143,11 +143,10 @@ def export_data_to_csv(config, grid): writer = csv.writer(f) # Write CSV headers writer.writerow(itertools.chain(('Step',), (a.name for a in grid))) - emissions = (a.emissions_by_step for a in grid) - step = 0 - for em in emissions: - writer.writerow(itertools.chain((step,), (e.value() for e in em))) - step += 1 + # Write all areas emission value for each step + for step in range(config.n_steps): + em_for_step = (f'{a.emissions_by_step[step].value():.3f}' for a in grid) + writer.writerow(itertools.chain((step,), em_for_step)) def run(config, logger):