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)
|
writer = csv.writer(f)
|
||||||
# Write CSV headers
|
# Write CSV headers
|
||||||
writer.writerow(itertools.chain(('Step',), (a.name for a in grid)))
|
writer.writerow(itertools.chain(('Step',), (a.name for a in grid)))
|
||||||
emissions = (a.emissions_by_step for a in grid)
|
# Write all areas emission value for each step
|
||||||
step = 0
|
for step in range(config.n_steps):
|
||||||
for em in emissions:
|
em_for_step = (f'{a.emissions_by_step[step].value():.3f}' for a in grid)
|
||||||
writer.writerow(itertools.chain((step,), (e.value() for e in em)))
|
writer.writerow(itertools.chain((step,), em_for_step))
|
||||||
step += 1
|
|
||||||
|
|
||||||
|
|
||||||
def run(config, logger):
|
def run(config, logger):
|
||||||
|
Loading…
Reference in New Issue
Block a user