-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Hi Yall,
I'm currently working with RTI on various CIROH & NWS RFC projects. We are using T-Route and recently encountered a bug. As I'm not a contributor, I can't create a branch & pull-request to resolve the issue. Thus, I have outlined the minor bug and quick fix below.
Case:
The dt of the lateral qlat inflow files was 1 Day.
Error:
File "/root/T-Route/src/troute-network/troute/AbstractNetwork.py", line 850, in build_forcing_sets
nfiles = int(np.ceil(nts / qts_subdivisions))
ZeroDivisionError: division by zero
Source:
line 840 was evaluating to 0.
dt_qlat = dt_qlat_timedelta.seconds
Fix:
https://docs.python.org/3/library/datetime.html
Caution It is a somewhat common bug for code to unintentionally use this attribute when it is actually intended to get a [total_seconds()] value instead:
line 840 was evaluating to 0.
dt_qlat = dt_qlat_timedelta.total_seconds()
Additional:
Despite qts_subdivisions being defined in the control YAML, it was being ignored / overwritten.