Skip to content

AbstractNetwork qts_subdivisions bug #861

@kindlyturnips

Description

@kindlyturnips

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions