mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-24 20:46:29 +00:00
Fix CSV generation
This commit is contained in:
parent
d6436a941f
commit
6042134412
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user