management_read_time_series Subroutine

public subroutine management_read_time_series(nval, fname, n, wu_id, iyr, nDaysSim, nbyr)

Uses

  • proc~~management_read_time_series~~UsesGraph proc~management_read_time_series management_read_time_series module~input input proc~management_read_time_series->module~input module~utilities utilities proc~management_read_time_series->module~utilities module~input->module~utilities

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: nval
character(len=n) :: fname
integer, intent(in) :: n
integer, intent(in) :: wu_id
integer, intent(in) :: iyr
integer, intent(in) :: nDaysSim
integer, intent(in) :: nbyr

Calls

proc~~management_read_time_series~~CallsGraph proc~management_read_time_series management_read_time_series proc~management_convert_to_daily management_convert_to_daily proc~management_read_time_series->proc~management_convert_to_daily proc~open_file open_file proc~management_read_time_series->proc~open_file proc~read_real_column read_real_column proc~management_read_time_series->proc~read_real_column proc~days_in_month days_in_month proc~management_convert_to_daily->proc~days_in_month proc~log_error log_error proc~open_file->proc~log_error proc~input_type_conversion_error input_type_conversion_error proc~read_real_column->proc~input_type_conversion_error proc~move_lines move_lines proc~read_real_column->proc~move_lines proc~read_real_column->proc~log_error proc~check_range check_range proc~read_real_column->proc~check_range proc~read_csv_item read_csv_item proc~read_real_column->proc~read_csv_item proc~header_column_index header_column_index proc~read_real_column->proc~header_column_index proc~input_error_column_not_found input_error_column_not_found proc~read_real_column->proc~input_error_column_not_found proc~input_type_conversion_error->proc~log_error proc~log_message log_message proc~log_error->proc~log_message proc~check_range->proc~log_error proc~log_warn log_warn proc~check_range->proc~log_warn proc~out_of_range_error out_of_range_error proc~check_range->proc~out_of_range_error proc~header_column_index->proc~move_lines proc~header_column_index->proc~input_error_column_not_found proc~is_leap_year is_leap_year proc~days_in_month->proc~is_leap_year proc~input_error_column_not_found->proc~log_error proc~log_warn->proc~log_message proc~out_of_range_error->proc~log_error proc~to_string to_string proc~out_of_range_error->proc~to_string proc~log_write log_write proc~log_message->proc~log_write proc~log_format_message log_format_message proc~log_message->proc~log_format_message proc~log_write->proc~to_string proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~string_index string_index proc~colourise->proc~string_index

Called by

proc~~management_read_time_series~~CalledByGraph proc~management_read_time_series management_read_time_series proc~management_read_wu_inout management_read_wu_inout proc~management_read_wu_inout->proc~management_read_time_series proc~management_initialise management_initialise proc~management_initialise->proc~management_read_wu_inout proc~initialise initialise proc~initialise->proc~management_initialise program~swim swim program~swim->proc~initialise

Contents


Source Code

  subroutine management_read_time_series(nval, fname, n, wu_id, iyr, ndayssim, nbyr)
    use input, only : read_real_column
    use utilities, only : open_file
    integer, intent(in) :: iyr
    integer, intent(in) :: nDaysSim
    integer, intent(in) :: nbyr
    ! number of values in InOut and Q_min
    integer, intent(in) :: nval
    ! length of file name and transfer user ID
    integer, intent(in) :: n, wu_id
    ! number of columns in input files
    ! file name
    character(len = n) :: fname
    ! first column of input file (indicates the month)
    ! number of years * 12 monthly values m3 / s
    real(dp), dimension(nval) :: InOut, Q_min
    integer :: fid
    ! subbasin number
    integer :: sub

    sub = TWU(wu_id) % subs

    fid = open_file(trim(management_users_input_dir)//'/'//trim(fname))
    call read_real_column(fid, "Q_in_out_m3s", InOut)
    call read_real_column(fid, "Qmin_m3s", Q_min)
    close(fid)

    ! Assign water user data to: TWU(i)%data and convert to daily if necessary.
    call management_convert_to_daily(nval, TWU(wu_id) % data, InOut, wu_id, iyr, nDaysSim, nbyr)

    ! Assign subbasin's minimal flow data to: (TSub)%Q_min and convert to daily if necessary.
    ! NOTE: Subbasin (TSub)%Q_min values might be overwritten if the number of water users in a subbasin > 1
    ! In this case, the values of the last water user are considered!
    if (TWU(wu_id) % wu_opt <= 2 .OR. TWU(wu_id) % wu_opt == 4 .AND. sub > 0 ) &
      call management_convert_to_daily(nval, wamTSub(sub) % pSub % Q_min, Q_min, wu_id, iyr, nDaysSim, nbyr)

    ! in case WU is of type irrigation .AND. demand is calculated from plant demand,
    ! overwrite values of data with 0.
    if (TWU(wu_id) % wu_opt == 4 .AND. TWU(wu_id) % irr_opt > 1 ) TWU(wu_id) % data = 0.

    RETURN

  end subroutine management_read_time_series