C*******************************************************************************
C                  BYPASS SPECIFICATIONS FILE
C
C             Generated by pyiwfm
C             {{ generation_time }}
C*******************************************************************************
C
C   NBYPASS ; Number of bypasses
C
C-------------------------------------------------------------------------------
    {{ n_bypasses | fortran_int(10) }}                         / NBYPASS
C-------------------------------------------------------------------------------
{% if n_bypasses > 0 %}
    {{ flow_factor }}                   / FACTX
    {{ flow_time_unit | pad_right(14) }}             / TUNITX
    {{ spill_factor }}                   / FACTY
    {{ spill_time_unit | pad_right(14) }}             / TUNITY
C
C   Bypass specifications
C   ID  IBPS  IBPD  IDIVC  DIVRL  DIVNL  NBPSEEP  NAME
C-------------------------------------------------------------------------------
{% for bp in bypasses %}
    {{ bp.id | fortran_int(5) }} {{ bp.source_node | fortran_int(7) }} {{ bp.destination_node | fortran_int(7) }}  {{ bp.diversion_column | fortran_int(5) }}  {{ bp.recoverable_loss_fraction | fortran_float(8, 4) }}  {{ bp.non_recoverable_loss_fraction | fortran_float(8, 4) }}  {{ bp.n_seepage_locs | fortran_int(3) }}  {{ bp.name }}
{% if bp.rating_table %}
C   Rating table for bypass {{ bp.id }} ({{ bp.n_rating_points }} points)
{% for pt in bp.rating_table %}
    {{ pt.flow | fortran_float(14, 4) }}  {{ pt.spill | fortran_float(14, 4) }}
{% endfor %}
{% endif %}
{% if bp.seepage_locations %}
C   Seepage locations for bypass {{ bp.id }}
{% for sl in bp.seepage_locations %}
    {{ sl.n_nodes | fortran_int(5) }}  {% for item in sl.nodes %}{{ item.node | fortran_int(6) }} {{ item.fraction | fortran_float(8, 4) }} {% endfor %}

{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
