1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-24 12:36:30 +00:00

Fix CSV generation

This commit is contained in:
Thibaud Gasser 2018-12-19 11:02:19 +01:00
parent d6436a941f
commit 6042134412

View File

@ -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):