hydrograph_storage_location Function

public function hydrograph_storage_location(icodes, ihouts, inum1s, mhyd, nsubs, subnr)

Arguments

Type IntentOptional AttributesName
integer, intent(in), dimension(:):: icodes
integer, intent(in), dimension(:):: ihouts
integer, intent(in), dimension(:):: inum1s
integer, intent(in) :: mhyd
integer, intent(in) :: nsubs
integer, intent(in) :: subnr(nsubs)

Return Value integer (nsubs)


Called by

proc~~hydrograph_storage_location~~CalledByGraph proc~hydrograph_storage_location hydrograph_storage_location proc~subbasin_initialise subbasin_initialise proc~subbasin_initialise->proc~hydrograph_storage_location proc~initialise initialise proc~initialise->proc~subbasin_initialise program~swim swim program~swim->proc~initialise

Contents


Source Code

  function hydrograph_storage_location(icodes, ihouts, inum1s, mhyd, nsubs, subnr)
    ! Function returns an array with the hydrograph storage locations (.fig file)
    ! for subbasins listed in subnr

    ! number of subbasins asking for ihout
    integer, intent(in) :: nsubs
    ! 1 - dim array containing subbasin numbers
    integer , intent(in) :: subnr(nsubs)
    integer, dimension(:), intent(in) :: icodes
    integer, dimension(:), intent(in) :: ihouts
    integer, dimension(:), intent(in) :: inum1s
    integer, intent(in) :: mhyd
    ! array of hydrograph storage locations
    integer :: hydrograph_storage_location(nsubs)
    integer :: i, j

    hydrograph_storage_location = 0

    ! identify hydrograph storage location for each output gauge (subbasin)
    do i = 1, mhyd
      if (icodes(i) == 2 ) then ! ROUTE command
        do j = 1, nsubs
          if (inum1s(i) == subnr(j) ) then
            ! The desired hydrograph storage location is always the next (+1)
            !ihouts_out(j) = ihouts(i) + 1
            hydrograph_storage_location(j) = ihouts(i) + 1
          end if
        end do
      end if
    end do

    ! Some subbasins will certainly not be captured by the algorithm above.
    ! Normally these are headwater subbasins.
    ! The following loop captures those headwater subbasins.
    do j = 1, nsubs
      if (hydrograph_storage_location(j) == 0) then
        hydrograph_storage_location(j) = subnr(j)
      end if
    end do

  end function hydrograph_storage_location