From 7ef46d01513abf85834e97deef12ccd46cdfec3a Mon Sep 17 00:00:00 2001 From: Cundo Arellano <51237056+cundo92@users.noreply.github.com> Date: Mon, 6 May 2024 14:09:07 -0700 Subject: [PATCH] Update import_network.py modified headway calculation to skip headway values of zero --- src/main/emme/toolbox/import/import_network.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/emme/toolbox/import/import_network.py b/src/main/emme/toolbox/import/import_network.py index 2a2303f39..6986961e7 100644 --- a/src/main/emme/toolbox/import/import_network.py +++ b/src/main/emme/toolbox/import/import_network.py @@ -74,6 +74,7 @@ import fiona as _fiona from math import ceil as _ceiling +from math import floor as _floor from copy import deepcopy as _copy import numpy as _np import heapq as _heapq @@ -1062,8 +1063,9 @@ def calc_transit_attributes(self, network): elif period == "ev": num_hours_period = 8 # Caution hard-coded number of hours in period if period in ["ea", "ev"]: - num_runs = line["@hours_" + period]*60/line["@headway_" + period] - line["@headway_" + period] = floor(num_hours_period*60/num_runs) + if line["@headway_" + period] > 0: + num_runs = line["@hours_" + period]*60/line["@headway_" + period] + line["@headway_" + period] = _floor(num_hours_period*60/num_runs) line["@headway_rev_" + period] = revised_headway(line["@headway_" + period]) self._log.append({"type": "text", "content": "Revised headway calculation complete"})