C*******************************************************************************
C                  DIVERSION SPECIFICATIONS FILE
C
C             Generated by pyiwfm
C             {{ generation_time }}
C*******************************************************************************
C
C   NDIVER  ; Number of diversions
C
C-------------------------------------------------------------------------------
    {{ n_diversions | fortran_int(10) }}                         / NDIVER
C-------------------------------------------------------------------------------
{% if diversions %}
C
C   Diversion specifications
C   ID  IDVS  IRDV  ICDVMAX  FDVMAX  ICOLRL  FRACRL  ICOLNL  FRACNL  ICOLSL  FRACSL  TYPDSTDL  DSTDL  ICOLDL  FRACDL  ICFSIRIG  ICADJ  NDLDV  NAME
C-------------------------------------------------------------------------------
{% for div in diversions %}
    {{ div.id | fortran_int(5) }} {{ div.source_node | fortran_int(7) }} {{ div.reach_id | fortran_int(5) }}  {{ div.max_div_column | fortran_int(5) }}  {{ div.max_div_fraction | fortran_float(8, 4) }}  {{ div.recoverable_loss_column | fortran_int(5) }}  {{ div.recoverable_loss_fraction | fortran_float(8, 4) }}  {{ div.non_recoverable_loss_column | fortran_int(5) }}  {{ div.non_recoverable_loss_fraction | fortran_float(8, 4) }}  {{ div.spill_column | fortran_int(5) }}  {{ div.spill_fraction | fortran_float(8, 4) }}  {{ div.delivery_dest_type | fortran_int(5) }}  {{ div.delivery_dest_id | fortran_int(5) }}  {{ div.delivery_column | fortran_int(5) }}  {{ div.delivery_fraction | fortran_float(8, 4) }}  {{ div.irrigation_fraction_column | fortran_int(5) }}  {{ div.adjustment_column | fortran_int(5) }}  {{ div.n_delivery_locs | fortran_int(3) }}  {{ div.name }}
{% if div.element_groups %}
C   Element groups for diversion {{ div.id }}
{% for eg in div.element_groups %}
    {{ eg.n_elements | fortran_int(5) }}  {% for e in eg.elements %}{{ e | fortran_int(6) }} {% endfor %}

{% endfor %}
{% endif %}
{% if div.recharge_zones %}
C   Recharge zones for diversion {{ div.id }}
{% for rz in div.recharge_zones %}
    {{ rz.n_nodes | fortran_int(5) }}  {% for item in rz.nodes %}{{ item.node | fortran_int(6) }} {{ item.fraction | fortran_float(8, 4) }} {% endfor %}

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