cyipt / actdev

ActDev - Active travel provision and potential in planned and proposed development sites
https://actdev.cyipt.bike
7 stars 3 forks source link

Fix the duration field in all scenario JSON files, as a workaround to… #180

Closed dabreegster closed 3 years ago

dabreegster commented 3 years ago

… a-b-street/abstr#29.

Using a python script again:

#!/usr/bin/python3
# ./fix_json.py data-small/*/scenario_*.json

import json
import sys

for path in sys.argv[1:]:
    with open(path) as f:
        data = json.load(f)
        for person in data['people']:
            assert(len(person['trips']) == 1)
            person['trips'][0]['departure'] = 10000 * person['trips'][0]['departure']

        with open(path, 'w') as f:
            f.write(json.dumps(data, indent=2))
            f.close()

and then reverting LCID, because that one file already had the changes from 6044e943e000971c2bea2cb3ae215c1f5adb92de